Click a link below to see a list of items published in the last years, and added to the library in the last days.
Books
- Adult
- Young Adult
- Children's
- Large Print
$heading)
{
$row[$heading] = (isset($data[$key])) ? $data[$key] : '';
}
$return[] = $row;
}
else
{
$return[] = $data;
}
}
fclose($handle);
return $return;
}
$data = importcsv($report_location);
function culler($v)
{
/**
* culler will examine the contents of the CSV file array of new items
* and return only those that correspond to the collections the patron
* wants to see, based upon the call numbers of the collections.
*
* If call numbers won't work for your situation, change this function
* as needed to make it work for you.
*/
// collection the patron wants to see, parsed from the URL
$items = $_GET['items'];
// we'll check the GET variable against a list of valid collections
$possible_collections = array("new_adult_fiction",
"new_adult_nonfiction",
"new_young_adult_fiction",
"new_young_adult_nonfiction",
"new_children's_fiction",
"new_children's_nonfiction",
"new_large_print_fiction",
"new_large_print_nonfiction",
"new_adult_audiobooks",
"new_children's_audiobooks",
"new_ipod_audiobooks",
"new_adult_music",
"new_children's_music",
"new_adult_videos",
"new_children's_videos");
$flag = false;
foreach ($possible_collections as $value)
{
if ($items == $value)
{
$flag = true;
}
}
if ($flag == false)
{
die("\"" . $items . "\" is not a valid collection");
}
$this_year = (int)date("Y");
$pub_year = $v[5];
$date_added = explode("-", $v[4]);
$date_added_timestamp = mktime(0, 0, 0, (int)$date_added[1], (int)$date_added[2], (int)$date_added[0]);
$day_difference = round((time() - $date_added_timestamp) / 86400);
// remove items more than $year_limit years old
if ($this_year - $pub_year > (year_limit() -1))
{
return false;
}
else
{
// remove items more than $day_limit days old
if ($day_difference > day_limit())
{
return false;
}
else
{
// split the call numbers up as arrays of their parts with [space] as the delimiter.
$call_number_parts = explode(" ", $v[3]);
// new_adult_fiction
if ($items == "new_adult_fiction")
{
if ($call_number_parts[0] == "FIC" ||
$call_number_parts[0] == "M" ||
$call_number_parts[0] == "SF" ||
$call_number_parts[0] == "W" ||
($call_number_parts[0] == "MICHIGAN" && !is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_adult_nonfiction
if ($items == "new_adult_nonfiction")
{
if (is_numeric($call_number_parts[0]) ||
$call_number_parts[0] == "C&C" ||
$call_number_parts[0] == "REF" ||
$call_number_parts[0] == "TRAVEL" ||
$call_number_parts[0] == "A&C" ||
($call_number_parts[0] == "MICHIGAN" && is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_young_adult_fiction
if ($items == "new_young_adult_fiction")
{
if (($call_number_parts[0] == "YA" && !is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_young_adult_nonfiction
if ($items == "new_young_adult_nonfiction")
{
if (($call_number_parts[0] == "YA" && is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_children's_fiction
if ($items == "new_children's_fiction")
{
if (($call_number_parts[0] == "J" && !is_numeric($call_number_parts[1])) ||
($call_number_parts[0] == "J-HOLIDAY" && !is_numeric($call_number_parts[1])) ||
($call_number_parts[0] == "J-KIT" && !is_numeric($call_number_parts[1])) ||
$call_number_parts[0] == "J-M" ||
$call_number_parts[0] == "J-SF" ||
$call_number_parts[0] == "J-BEG" ||
($call_number_parts[0] == "J-MICHIGAN" && !is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_children's_nonfiction
if ($items == "new_children's_nonfiction")
{
if (($call_number_parts[0] == "J" && is_numeric($call_number_parts[1])) ||
($call_number_parts[0] == "J-HOLIDAY" && is_numeric($call_number_parts[1])) ||
($call_number_parts[0] == "J-KIT" && is_numeric($call_number_parts[1])) ||
$call_number_parts[0] == "J-REF" ||
($call_number_parts[0] == "J-MICHIGAN" && is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_large_print_fiction
if ($items == "new_large_print_fiction")
{
if (($call_number_parts[0] == "LP" && !is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_large_print_nonfiction
if ($items == "new_large_print_nonfiction")
{
if (($call_number_parts[0] == "LP" && is_numeric($call_number_parts[1])))
{
return true;
}
}
// new_adult_audiobooks
if ($items == "new_adult_audiobooks")
{
if ($call_number_parts[0] == "AC" ||
$call_number_parts[0] == "CD")
{
$call_number_parts = array_reverse($call_number_parts);
if ($call_number_parts[0] != "[MUSIC]")
{
return true;
}
}
}
// new_children's_audiobooks
if ($items == "new_children's_audiobooks")
{
if ($call_number_parts[0] == "J-AC" ||
$call_number_parts[0] == "J-CD" )
{
$call_number_parts = array_reverse($call_number_parts);
if ($call_number_parts[0] != "[MUSIC]")
{
return true;
}
}
}
// new_ipod_books
if ($items == "new_ipod_audiobooks")
{
if ($call_number_parts[0] == "EPOD")
{
return true;
}
}
// new_adult_music
if ($items == "new_adult_music")
{
if ($call_number_parts[0] == "CD")
{
$call_number_parts = array_reverse($call_number_parts);
if ($call_number_parts[0] == "[MUSIC]")
{
return true;
}
}
}
// new_children's_music
if ($items == "new_adult_music")
{
if ($call_number_parts[0] == "J-CD")
{
$call_number_parts = array_reverse($call_number_parts);
if ($call_number_parts[0] == "[MUSIC]")
{
return true;
}
}
}
// new_adult_videos
if ($items == "new_adult_videos")
{
if ($call_number_parts[0] == "VC" ||
$call_number_parts[0] == "DVD" )
{
return true;
}
}
// new_children's_videos
if ($items == "new_children's_videos")
{
if ($call_number_parts[0] == "J-VC" ||
$call_number_parts[0] == "J-DVD" )
{
return true;
}
}
return false;
}
}
}
function de_dupe($v)
{
/**
* de_dupe will remove duplicate items of the same bib record.
*/
static $last_bib = 0;
$this_bib = $v[6];
if ($last_bib == $this_bib)
{
$last_bib = $this_bib;
return false;
}
else
{
$last_bib = $this_bib;
return true;
}
}
// remove all the items except those the patron want to see
$data = array_filter($data, culler);
// reverse the array and modify the array on multiple items
// when sorting by date added, we won't do this so we can see all books.
if ($_GET['sort'] != "date_added" && $_GET['sort'] != "branch")
{
$data = array_reverse($data);
foreach ($data as $key => &$value)
{
static $last_bib = 0;
$this_bib = $value[6];
if ($last_bib == $this_bib)
{
$last_bib = $this_bib;
$value[2] = "";
$value[3] = "";
$value[4] = "";
$value[8] = "[multiple copies]";
}
else
{
$last_bib = $this_bib;
}
}
// put the array back in the right order
$data = array_reverse($data);
// do the de-duping
$data = array_filter($data, de_dupe);
}
// sorting
// obtain a list of columns
if ($_GET['sort'] == "author" || $_GET['sort'] == "title" || $_GET['sort'] == "date_added" || $_GET['sort'] == "branch")
{
foreach ($data as $key => $row)
{
$title[$key] = $row[0];
$author[$key] = $row[1];
$date_added[$key] = $row[4];
$branch[$key] = $row[8];
}
if ($_GET['sort'] == "author" && $_GET['dir'] == "asc")
{
array_multisort($author, SORT_ASC, $data);
}
if ($_GET['sort'] == "author" && $_GET['dir'] == "desc")
{
array_multisort($author, SORT_DESC, $data);
}
if ($_GET['sort'] == "title" && $_GET['dir'] == "desc")
{
array_multisort($title, SORT_DESC, $data);
}
if ($_GET['sort'] == "date_added" && $_GET['dir'] == "asc")
{
array_multisort($date_added, SORT_ASC, $data);
}
if ($_GET['sort'] == "date_added" && $_GET['dir'] == "desc")
{
array_multisort($date_added, SORT_DESC, $data);
}
if ($_GET['sort'] == "branch" && $_GET['dir'] == "asc")
{
array_multisort($branch, SORT_ASC, $data);
}
if ($_GET['sort'] == "branch" && $_GET['dir'] == "desc")
{
array_multisort($branch, SORT_DESC, $data);
}
}
$data_count = count($data);
if ($data_count == 0)
{
?>
No items added in the last days in "".
← Return to New Items Categories.
added in "".
← Return to New Items Categories.
|
";} ?>
|
|
← Return to New Items Categories.