本文整理汇总了PHP中Library::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Library::find方法的具体用法?PHP Library::find怎么用?PHP Library::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
require_once ROOT_DIR . '/sys/Browse/BrowseCategory.php';
$browseCategories = new BrowseCategory();
$browseCategories->orderBy('label');
$browseCategories->find();
$browseCategoryList = array();
while ($browseCategories->fetch()) {
$browseCategoryList[$browseCategories->textId] = $browseCategories->label . " ({$browseCategories->textId})";
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'browseCategoryTextId' => array('property' => 'browseCategoryTextId', 'type' => 'enum', 'values' => $browseCategoryList, 'label' => 'Browse Category', 'description' => 'The browse category to display '), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例2: getLibraryName
function getLibraryName()
{
if ($this->libraryId == -1) {
return 'Shared Digital Collection';
} else {
$library = new Library();
$library->libraryId = $this->libraryId;
$library->find(true);
return $library->displayName;
}
}
示例3: getObjectStructure
static function getObjectStructure()
{
$library = new Library();
$library->orderBy('displayName');
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the holiday within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library'), 'date' => array('property' => 'date', 'type' => 'date', 'label' => 'Date', 'description' => 'The date of a holiday.', 'required' => true), 'name' => array('property' => 'name', 'type' => 'text', 'label' => 'Holiday Name', 'description' => 'The name of a holiday'));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例4: getObjectStructure
static function getObjectStructure()
{
global $user;
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$structure = parent::getObjectStructure();
$structure['libraryId'] = array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'The id of a library');
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例5: getObjectStructure
function getObjectStructure()
{
global $user;
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('library_material_requests')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
} else {
$libraryList[-1] = 'Default';
}
$library->find();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the libary within the database'), 'description' => array('property' => 'description', 'type' => 'text', 'size' => 80, 'label' => 'Description', 'description' => 'A unique name for the Status'), 'isDefault' => array('property' => 'isDefault', 'type' => 'checkbox', 'label' => 'Default Status?', 'description' => 'Whether or not this status is the default status to apply to new requests'), 'isPatronCancel' => array('property' => 'isPatronCancel', 'type' => 'checkbox', 'label' => 'Set When Patron Cancels?', 'description' => 'Whether or not this status should be set when the patron cancels their request'), 'isOpen' => array('property' => 'isOpen', 'type' => 'checkbox', 'label' => 'Open Status?', 'description' => 'Whether or not this status needs further processing'), 'sendEmailToPatron' => array('property' => 'sendEmailToPatron', 'type' => 'checkbox', 'label' => 'Send Email To Patron?', 'description' => 'Whether or not an email should be sent to the patron when this status is set'), 'emailTemplate' => array('property' => 'emailTemplate', 'type' => 'textarea', 'rows' => 6, 'cols' => 60, 'label' => 'Email Template', 'description' => 'The template to use when sending emails to the user', 'hideInLists' => true), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'The id of a library'));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例6: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'category' => array('property' => 'category', 'type' => 'text', 'label' => 'Category', 'description' => 'The category of the link', 'size' => '80', 'maxLength' => 100), 'linkText' => array('property' => 'linkText', 'type' => 'text', 'label' => 'Link Text', 'description' => 'The text to display for the link ', 'size' => '80', 'maxLength' => 100), 'url' => array('property' => 'url', 'type' => 'text', 'label' => 'URL', 'description' => 'The url to link to', 'size' => '80', 'maxLength' => 255), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例7: getObjectStructure
static function getObjectStructure()
{
$library = new Library();
$library->orderBy('displayName');
$library->find();
$libraryList = array('-1' => 'Default');
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$store = new BookStore();
$store->orderBy('storeName');
$store->find();
$storeList = array();
while ($store->fetch()) {
$storeList[$store->id] = $store->storeName;
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of this association'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'The id of a library'), 'storeId' => array('property' => 'storeId', 'type' => 'enum', 'values' => $storeList, 'label' => 'Book Store', 'description' => 'The id of a book store'), 'weight' => array('property' => 'weight', 'type' => 'text', 'label' => 'Weight', 'description' => 'The sort order of the book store'));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例8: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
require_once ROOT_DIR . '/RecordDrivers/Interface.php';
$validSources = RecordInterface::getValidMoreDetailsSources();
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'source' => array('property' => 'source', 'type' => 'enum', 'label' => 'Source', 'values' => $validSources, 'description' => 'The source of the data to display'), 'collapseByDefault' => array('property' => 'collapseByDefault', 'type' => 'checkbox', 'label' => 'Collapse By Default', 'description' => 'Whether or not the section should be collapsed by default', 'default' => true), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例9: copySearchSourcesFromLibrary
function copySearchSourcesFromLibrary()
{
$libraryId = $_REQUEST['id'];
if (isset($_REQUEST['submit'])) {
$library = new Library();
$library->libraryId = $libraryId;
$library->find(true);
$library->clearSearchSources();
$libraryToCopyFromId = $_REQUEST['libraryToCopyFrom'];
$libraryToCopyFrom = new Library();
$libraryToCopyFrom->libraryId = $libraryToCopyFromId;
$library->find(true);
$searchSourcesToCopy = $libraryToCopyFrom->searchSources;
foreach ($searchSourcesToCopy as $searchKey => $searchSources) {
$searchSources->libraryId = $libraryId;
$searchSources->id = null;
$searchSourcesToCopy[$searchKey] = $searchSources;
}
$library->searchSources = $searchSourcesToCopy;
$library->update();
header("Location: /Admin/Libraries?objectAction=edit&id=" . $libraryId);
} else {
//Prompt user for the library to copy from
$allLibraries = $this->getAllObjects();
unset($allLibraries[$libraryId]);
foreach ($allLibraries as $key => $library) {
if (count($library->searchSources) == 0) {
unset($allLibraries[$key]);
}
}
global $interface;
$interface->assign('allLibraries', $allLibraries);
$interface->assign('id', $libraryId);
$interface->setTemplate('../Admin/copyLibrarySearchSources.tpl');
}
}
示例10: getSearchSourcesDefault
private static function getSearchSourcesDefault()
{
$searchOptions = array();
//Check to see if marmot catalog is a valid option
global $library;
global $interface;
$repeatSearchSetting = '';
$repeatInWorldCat = false;
$repeatInProspector = true;
$repeatInAmazon = true;
$repeatInOverdrive = false;
$systemsToRepeatIn = array();
$searchGenealogy = true;
$repeatCourseReserves = false;
/** @var $locationSingleton Location */
global $locationSingleton;
$location = $locationSingleton->getActiveLocation();
if ($location != null && $location->useScope && $location->restrictSearchByLocation) {
$repeatSearchSetting = $location->repeatSearchOption;
$repeatInWorldCat = $location->repeatInWorldCat == 1;
$repeatInProspector = $location->repeatInProspector == 1;
$repeatInOverdrive = $location->repeatInOverdrive == 1;
if (strlen($location->systemsToRepeatIn) > 0) {
$systemsToRepeatIn = explode('|', $location->systemsToRepeatIn);
} else {
$systemsToRepeatIn = explode('|', $library->systemsToRepeatIn);
}
} elseif (isset($library)) {
$repeatSearchSetting = $library->repeatSearchOption;
$repeatInWorldCat = $library->repeatInWorldCat == 1;
$repeatInProspector = $library->repeatInProspector == 1;
$repeatInOverdrive = $library->repeatInOverdrive == 1;
$systemsToRepeatIn = explode('|', $library->systemsToRepeatIn);
}
if (isset($library)) {
$repeatInAmazon = $library->repeatInAmazon;
$searchGenealogy = $library->enableGenealogy;
$repeatCourseReserves = $library->enableCourseReserves == 1;
}
$marmotAdded = false;
//Local search
if (isset($location) && $location != null && $location->useScope && $location->restrictSearchByLocation) {
$searchOptions['local'] = array('name' => $location->displayName, 'description' => "The {$location->displayName} catalog.");
} elseif (isset($library)) {
$searchOptions['local'] = array('name' => $library->displayName, 'description' => "The {$library->displayName} catalog.");
} else {
$marmotAdded = true;
$searchOptions['local'] = array('name' => 'Marmot Catalog', 'description' => "The entire Marmot catalog.");
}
if ($location != null && ($repeatSearchSetting == 'marmot' || $repeatSearchSetting == 'librarySystem') && ($location->useScope && $location->restrictSearchByLocation)) {
$searchOptions[$library->subdomain] = array('name' => $library->displayName, 'description' => "The entire {$library->displayName} catalog not limited to a particular branch.");
}
//Process additional systems to repeat in
if (count($systemsToRepeatIn) > 0) {
foreach ($systemsToRepeatIn as $system) {
if (strlen($system) > 0) {
$repeatInLibrary = new Library();
$repeatInLibrary->subdomain = $system;
$repeatInLibrary->find();
if ($repeatInLibrary->N == 1) {
$repeatInLibrary->fetch();
$searchOptions[$repeatInLibrary->subdomain] = array('name' => $repeatInLibrary->displayName, 'description' => '');
} else {
//See if this is a repeat within a location
$repeatInLocation = new Location();
$repeatInLocation->code = $system;
$repeatInLocation->find();
if ($repeatInLocation->N == 1) {
$repeatInLocation->fetch();
$searchOptions[$repeatInLocation->code] = array('name' => $repeatInLocation->displayName, 'description' => '');
}
}
}
}
}
//eContent Search
$searchOptions['econtent'] = array('name' => 'Online Collection', 'description' => 'Digital Media available for use online and with portable devices');
//Marmot Global search
if (isset($library) && $repeatSearchSetting == 'marmot' && $library->restrictSearchByLibrary && $marmotAdded == false) {
$searchOptions['marmot'] = array('name' => 'Marmot Catalog', 'description' => 'A shared catalog of public, academic, and school libraries on the Western Slope.');
}
//Genealogy Search
if ($searchGenealogy && !$interface->isMobile()) {
$searchOptions['genealogy'] = array('name' => 'Genealogy Records', 'description' => 'Genealogy Records from Colorado');
}
//Overdrive
if ($repeatInOverdrive && !$interface->isMobile()) {
$searchOptions['overdrive'] = array('name' => 'OverDrive Digital Catalog', 'description' => 'Downloadable Books, Videos, Music, and eBooks with free use for library card holders.', 'external' => true);
}
if ($repeatInProspector && !$interface->isMobile()) {
$searchOptions['prospector'] = array('name' => 'Prospector Catalog', 'description' => 'A shared catalog of academic, public, and special libraries all over Colorado.', 'external' => true);
}
//Course reserves for colleges
if ($repeatCourseReserves) {
//Mesa State
$searchOptions['course-reserves-course-name'] = array('name' => 'Course Reserves by Name or Number', 'description' => 'Search course reserves by course name or number', 'external' => true);
$searchOptions['course-reserves-instructor'] = array('name' => 'Course Reserves by Instructor', 'description' => 'Search course reserves by professor, lecturer, or instructor name', 'external' => true);
}
if ($repeatInWorldCat && !$interface->isMobile()) {
$searchOptions['worldcat'] = array('name' => 'WorldCat', 'description' => 'A shared catalog of libraries all over the world.', 'external' => true);
//.........这里部分代码省略.........
示例11: launch
function launch()
{
global $interface;
global $user;
global $logger;
$libraries = array();
$library = new Library();
$library->orderBy('displayName');
$library->find();
while ($library->fetch()) {
$libraries[$library->libraryId] = array('id' => $library->libraryId, 'displayName' => $library->displayName, 'subdomain' => $library->subdomain);
}
$interface->assign('libraries', $libraries);
global $locationSingleton;
$physicalLocation = $locationSingleton->getActiveLocation();
if (isset($_REQUEST['gotoModule'])) {
$gotoModule = $_REQUEST['gotoModule'];
$interface->assign('gotoModule', $gotoModule);
}
if (isset($_REQUEST['gotoAction'])) {
$gotoAction = $_REQUEST['gotoAction'];
$interface->assign('gotoAction', $gotoAction);
}
$redirectLibrary = null;
if (isset($_REQUEST['library'])) {
$redirectLibrary = $_REQUEST['library'];
} elseif (!is_null($physicalLocation)) {
$redirectLibrary = $physicalLocation->libraryId;
} elseif ($user && isset($user->preferredLibraryInterface) && is_numeric($user->preferredLibraryInterface)) {
$redirectLibrary = $user->preferredLibraryInterface;
} elseif (isset($_COOKIE['PreferredLibrarySystem'])) {
$redirectLibrary = $_COOKIE['PreferredLibrarySystem'];
}
if ($redirectLibrary != null) {
$logger->log("Selected library {$redirectLibrary}", PEAR_LOG_DEBUG);
$selectedLibrary = $libraries[$redirectLibrary];
global $configArray;
$baseUrl = $configArray['Site']['url'];
$urlPortions = explode('://', $baseUrl);
//Get rid of extra portions of the url
$subdomain = $selectedLibrary['subdomain'];
if (strpos($urlPortions[1], 'opac2') !== false) {
$urlPortions[1] = str_replace('opac2.', '', $urlPortions[1]);
$subdomain .= '2';
}
$urlPortions[1] = str_replace('opac.', '', $urlPortions[1]);
$baseUrl = $urlPortions[0] . '://' . $subdomain . '.' . $urlPortions[1];
if ($gotoModule) {
$baseUrl .= '/' . $gotoModule;
}
if ($gotoAction) {
$baseUrl .= '/' . $gotoAction;
}
if (isset($_REQUEST['rememberThis']) && isset($_REQUEST['submit'])) {
if ($user) {
$user->preferredLibraryInterface = $redirectLibrary;
$user->update();
$_SESSION['userinfo'] = serialize($user);
}
//Set a cookie to remember the location when not logged in
//Remember for a year
setcookie('PreferredLibrarySystem', $redirectLibrary, time() + 60 * 60 * 24 * 365, '/');
}
header('Location:' . $baseUrl);
die;
}
//Build the actual view
$interface->setTemplate('selectInterface.tpl');
$interface->setPageTitle('Select Library Catalog');
// Display Page
$interface->display('layout.tpl');
}
示例12: getStatusSummary
/**
* Returns a summary of the holdings information for a single id. Used to display
* within the search results and at the top of a full record display to ensure
* the holding information makes sense to all users.
*
* @param string $id the id of the bid to load holdings for
* @return array an associative array with a summary of the holdings.
*/
public function getStatusSummary($id, $record = null, $mysip = null)
{
global $timer;
global $library;
global $locationSingleton;
global $configArray;
global $memCache;
//Holdings summaries need to be cached based on the actual location since part of the information
//includes local call numbers and statuses.
$ipLocation = $locationSingleton->getPhysicalLocation();
$location = $ipLocation;
if (!isset($location) && $location == null) {
$location = $locationSingleton->getUserHomeLocation();
}
$ipLibrary = null;
if (isset($ipLocation)) {
$ipLibrary = new Library();
$ipLibrary->libraryId = $ipLocation->getLibraryId;
if (!$ipLibrary->find(true)) {
$ipLibrary = null;
}
}
if (!isset($location) && $location == null) {
$locationId = -1;
} else {
$locationId = $location->locationId;
}
$summaryInformation = $memCache->get("holdings_summary_{$id}_{$locationId}");
if ($summaryInformation == false) {
$canShowHoldButton = true;
if ($library && $library->showHoldButton == 0) {
$canShowHoldButton = false;
}
if ($location != null && $location->showHoldButton == 0) {
$canShowHoldButton = false;
}
$holdings = $this->getStatus($id, $record, $mysip, true);
$timer->logTime('Retrieved Status of holding');
$counter = 0;
$summaryInformation = array();
$summaryInformation['recordId'] = $id;
$summaryInformation['shortId'] = $id;
$summaryInformation['isDownloadable'] = false;
//Default value, reset later if needed.
$summaryInformation['holdQueueLength'] = 0;
//Check to see if we are getting issue summaries or actual holdings
$isIssueSummary = false;
$numSubscriptions = 0;
if (count($holdings) > 0) {
$lastHolding = end($holdings);
if (isset($lastHolding['type']) && ($lastHolding['type'] == 'issueSummary' || $lastHolding['type'] == 'issue')) {
$isIssueSummary = true;
$issueSummaries = $holdings;
$numSubscriptions = count($issueSummaries);
$holdings = array();
foreach ($issueSummaries as $issueSummary) {
if (isset($issueSummary['holdings'])) {
$holdings = array_merge($holdings, $issueSummary['holdings']);
} else {
//Create a fake holding for subscriptions so something
//will be displayed in the holdings summary.
$holdings[$issueSummary['location']] = array('availability' => '1', 'location' => $issueSummary['location'], 'libraryDisplayName' => $issueSummary['location'], 'callnumber' => $issueSummary['cALL'], 'status' => 'Lib Use Only', 'statusfull' => 'In Library Use Only');
}
}
}
}
$timer->logTime('Processed for subscriptions');
//Valid statuses are:
//Available by Request
// - not at the user's home branch or preferred location, but at least one copy is not checked out
// - do not show the call number
// - show place hold button
//Checked Out
// - all copies are checked out
// - show the call number for the local library if any
// - show place hold button
//Downloadable
// - there is at least one download link for the record.
$numAvailableCopies = 0;
$numHoldableCopies = 0;
$numCopies = 0;
$numCopiesOnOrder = 0;
$availableLocations = array();
$unavailableStatus = null;
//The status of all items. Will be set to an actual status if all are the same
//or null if the item statuses are inconsistent
$allItemStatus = '';
$firstAvailableBarcode = '';
$availableHere = false;
foreach ($holdings as $holdingKey => $holding) {
if (is_null($allItemStatus)) {
//Do nothing, the status is not distinct
//.........这里部分代码省略.........
示例13: getStatusSummary
/**
* Returns a summary of the holdings information for a single id. Used to display
* within the search results and at the top of a full record display to ensure
* the holding information makes sense to all users.
*
* @param string $id the id of the bid to load holdings for
*
* @return array an associative array with a summary of the holdings.
*/
public function getStatusSummary($id)
{
global $timer;
global $library;
global $locationSingleton;
global $configArray;
/** @var Memcache $memCache */
global $memCache;
//Holdings summaries need to be cached based on the actual location since part of the information
//includes local call numbers and statuses.
$ipLocation = $locationSingleton->getPhysicalLocation();
$location = $ipLocation;
if (!isset($location) && $location == null) {
$location = $locationSingleton->getUserHomeLocation();
}
$ipLibrary = null;
if (isset($ipLocation)) {
$ipLibrary = new Library();
$ipLibrary->libraryId = $ipLocation->libraryId;
if (!$ipLibrary->find(true)) {
$ipLibrary = null;
}
}
if (!isset($location) && $location == null) {
$locationId = -1;
} else {
$locationId = $location->locationId;
}
$summaryInformation = $memCache->get("holdings_summary_{$id}_{$locationId}");
if ($summaryInformation == false) {
$canShowHoldButton = true;
if ($library && $library->showHoldButton == 0) {
$canShowHoldButton = false;
}
if ($location != null && $location->showHoldButton == 0) {
$canShowHoldButton = false;
}
$holdings = $this->getStatus($id);
$timer->logTime('Retrieved Status of holding');
$summaryInformation = array();
$summaryInformation['recordId'] = $id;
$summaryInformation['shortId'] = $id;
$summaryInformation['isDownloadable'] = false;
//Default value, reset later if needed.
$summaryInformation['holdQueueLength'] = 0;
//Check to see if we are getting issue summaries or actual holdings
if (count($holdings) > 0) {
$lastHolding = end($holdings);
if (isset($lastHolding['type']) && ($lastHolding['type'] == 'issueSummary' || $lastHolding['type'] == 'issue')) {
$issueSummaries = $holdings;
$holdings = array();
foreach ($issueSummaries as $issueSummary) {
if (isset($issueSummary['holdings'])) {
$holdings = array_merge($holdings, $issueSummary['holdings']);
} else {
//Create a fake holding for subscriptions so something
//will be displayed in the holdings summary.
$holdings[$issueSummary['location']] = array('availability' => '1', 'location' => $issueSummary['location'], 'libraryDisplayName' => $issueSummary['location'], 'callnumber' => $issueSummary['cALL'], 'status' => 'Lib Use Only', 'statusfull' => 'In Library Use Only');
}
}
}
}
$timer->logTime('Processed for subscriptions');
//Valid statuses are:
//Available by Request
// - not at the user's home branch or preferred location, but at least one copy is not checked out
// - do not show the call number
// - show place hold button
//Checked Out
// - all copies are checked out
// - show the call number for the local library if any
// - show place hold button
//Downloadable
// - there is at least one download link for the record.
$numAvailableCopies = 0;
$numHoldableCopies = 0;
$numCopies = 0;
$numCopiesOnOrder = 0;
$availableLocations = array();
$unavailableStatus = null;
//The status of all items. Will be set to an actual status if all are the same
//or null if the item statuses are inconsistent
$allItemStatus = '';
$firstAvailableBarcode = '';
$availableHere = false;
foreach ($holdings as $holding) {
if (is_null($allItemStatus)) {
//Do nothing, the status is not distinct
} else {
if ($allItemStatus == '') {
$allItemStatus = $holding['statusfull'];
//.........这里部分代码省略.........
示例14: updateConfigForScoping
/**
* Update the configuration array as needed based on scoping rules defined
* by the subdomain.
*
* @param array $configArray the existing main configuration options.
*
* @return array the configuration options adjusted based on the scoping rules.
*/
function updateConfigForScoping($configArray)
{
global $timer;
//Get the subdomain for the request
global $serverName;
//split the servername based on
global $subdomain;
$subdomain = null;
if (strpos($_SERVER['SERVER_NAME'], '.')) {
$serverComponents = explode('.', $_SERVER['SERVER_NAME']);
if (count($serverComponents) >= 3) {
//URL is probably of the form subdomain.marmot.org or subdomain.opac.marmot.org
$subdomain = $serverComponents[0];
} else {
if (count($serverComponents) == 2) {
//URL could be either subdomain.localhost or marmot.org. Only use the subdomain
//If the second component is localhost.
if (strcasecmp($serverComponents[1], 'localhost') == 0) {
$subdomain = $serverComponents[0];
}
}
}
//Trim off test indicator when doing lookups for library/location
if (substr($subdomain, -1) == '2' || substr($subdomain, -1) == '3') {
$subdomain = substr($subdomain, 0, -1);
}
}
$timer->logTime('got subdomain');
//Load the library system information
global $library;
global $locationSingleton;
if (isset($_SESSION['library']) && isset($_SESSION['location'])) {
$library = $_SESSION['library'];
$locationSingleton = $_SESSION['library'];
} else {
$Library = new Library();
$Library->whereAdd("subdomain = '{$subdomain}'");
$Library->find();
if ($Library->N == 1) {
$Library->fetch();
//Make the library information global so we can work with it later.
$library = $Library;
} else {
//The subdomain can also indicate a location.
$Location = new Location();
$Location->whereAdd("code = '{$subdomain}'");
$Location->find();
if ($Location->N == 1) {
$Location->fetch();
//We found a location for the subdomain, get the library.
/** @var Library $librarySingleton */
global $librarySingleton;
$library = $librarySingleton->getLibraryForLocation($Location->locationId);
$locationSingleton->setActiveLocation(clone $Location);
} else {
//Check to see if there is only one library in the system
$Library = new Library();
$Library->find();
if ($Library->N == 1) {
$Library->fetch();
$library = $Library;
}
}
}
}
if (isset($library) && $library != null) {
//Update the title
$configArray['Site']['theme'] = $library->themeName . ',' . $configArray['Site']['theme'] . ',default';
$configArray['Site']['title'] = $library->displayName;
$location = $locationSingleton->getActiveLocation();
//Add an extra css file for the location if it exists.
$themes = explode(',', $library->themeName);
foreach ($themes as $themeName) {
if ($location != null && file_exists('./interface/themes/' . $themeName . '/images/' . $location->code . '_logo_responsive.png')) {
$configArray['Site']['responsiveLogo'] = '/interface/themes/' . $themeName . '/images/' . $location->code . '_logo_responsive.png';
}
if ($subdomain != null && file_exists('./interface/themes/' . $themeName . '/images/' . $subdomain . '_logo_responsive.png')) {
$configArray['Site']['responsiveLogo'] = '/interface/themes/' . $themeName . '/images/' . $subdomain . '_logo_responsive.png';
}
if ($location != null && file_exists('./interface/themes/' . $themeName . '/images/' . $location->code . '_logo_small.png')) {
$configArray['Site']['smallLogo'] = '/interface/themes/' . $themeName . '/images/' . $location->code . '_logo_small.png';
}
if ($location != null && file_exists('./interface/themes/' . $themeName . '/images/' . $location->code . '_logo_large.png')) {
$configArray['Site']['largeLogo'] = '/interface/themes/' . $themeName . '/images/' . $location->code . '_logo_large.png';
}
}
}
$timer->logTime('finished update config for scoping');
return $configArray;
}
示例15: getObjectStructure
function getObjectStructure()
{
$structure = array('id' => array('property' => 'id', 'type' => 'hidden', 'label' => 'Id', 'primaryKey' => true, 'description' => 'The unique id of the e-pub file.', 'storeDb' => true, 'storeSolr' => false), 'recordtype' => array('property' => 'recordtype', 'type' => 'method', 'methodName' => 'recordtype', 'storeDb' => false, 'storeSolr' => true), 'solrId' => array('property' => 'id', 'type' => 'method', 'methodName' => 'solrId', 'storeDb' => false, 'storeSolr' => true), 'title' => array('property' => 'title', 'type' => 'text', 'size' => 100, 'maxLength' => 255, 'label' => 'Title', 'description' => 'The title of the item.', 'required' => true, 'storeDb' => true, 'storeSolr' => true), 'title_proper' => array('property' => 'title_proper', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'title_sort' => array('property' => 'title_sort', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'format_category' => array('property' => 'format_category', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'format' => array('property' => 'format', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'description' => array('property' => 'description', 'type' => 'textarea', 'label' => 'Description', 'rows' => 3, 'cols' => 80, 'description' => 'A brief description of the file for indexing and display if there is not an existing record within the catalog.', 'required' => false, 'storeDb' => true, 'storeSolr' => true), 'num_titles' => array('property' => 'num_titles', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'num_holdings' => array('property' => 'num_holdings', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'format_boost' => array('property' => 'format_boost', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'language_boost' => array('property' => 'language_boost', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'contents' => array('property' => 'contents', 'type' => 'method', 'required' => false, 'storeDb' => false, 'storeSolr' => true), 'bib_suppression' => array('property' => 'bib_suppression', 'type' => 'method', 'storeDb' => false, 'storeSolr' => true), 'owning_library' => array('property' => 'owning_library', 'type' => 'method', 'methodName' => 'institution', 'storeDb' => false, 'storeSolr' => true), 'owning_location' => array('property' => 'owning_location', 'type' => 'method', 'methodName' => 'building', 'storeDb' => false, 'storeSolr' => true), 'usable_by' => array('property' => 'usable_by', 'type' => 'method', 'methodName' => 'usable_by', 'storeDb' => false, 'storeSolr' => true));
//Add local formats
$library = new Library();
$library->find();
while ($library->fetch() == true) {
$structure['format_' . $library->subdomain] = array('property' => 'format_' . $library->subdomain, 'type' => 'method', 'methodName' => 'format', 'storeDb' => false, 'storeSolr' => true);
}
$location = new Location();
$location->find();
while ($location->fetch() == true) {
$structure['format_' . $location->code] = array('property' => 'format_' . $location->code, 'type' => 'method', 'methodName' => 'format', 'storeDb' => false, 'storeSolr' => true);
}
return $structure;
}