本文整理汇总了PHP中Location::whereAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::whereAdd方法的具体用法?PHP Location::whereAdd怎么用?PHP Location::whereAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::whereAdd方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHolding
/**
* Load status (holdings) for a record and filter them based on the logged in user information.
*
* Format of return array is:
* key = {section#}{location}-### where ### is the holding iteration
*
* value = array (
* id = The id of the bib
* number = The position of the holding within the original list of holdings
* section = A description of the section
* sectionId = a numeric id of the section for sorting
* type = holding
* status
* statusfull
* availability
* holdable
* nonHoldableReason
* reserve
* holdQueueLength
* duedate
* location
* libraryDisplayName
* locationCode
* locationLink
* callnumber
* link = array
* linkText
* isDownload
* )
*
* Includes both physical titles as well as titles on order
*
* @param string $id the id of the record
* @return array A list of holdings for the record
*/
public function getHolding($id)
{
if (array_key_exists($id, HorizonAPI::$loadedStatus)) {
return HorizonAPI::$loadedStatus[$id];
}
global $configArray;
global $library;
//Get location information so we can put things into sections
global $locationSingleton;
/** @var $locationSingleton Location */
$physicalLocation = $locationSingleton->getPhysicalLocation();
if ($physicalLocation != null) {
$physicalBranch = $physicalLocation->holdingBranchLabel;
} else {
$physicalBranch = '';
}
$homeBranch = '';
$homeBranchId = 0;
$nearbyBranch1 = '';
$nearbyBranch1Id = 0;
$nearbyBranch2 = '';
$nearbyBranch2Id = 0;
//Set location information based on the user login. This will override information based
if (isset($user) && $user != false) {
$homeBranchId = $user->homeLocationId;
$nearbyBranch1Id = $user->myLocation1Id;
$nearbyBranch2Id = $user->myLocation2Id;
} else {
//Check to see if the cookie for home location is set.
if (isset($_COOKIE['home_location']) && is_numeric($_COOKIE['home_location'])) {
$cookieLocation = new Location();
$locationId = $_COOKIE['home_location'];
$cookieLocation->whereAdd("locationId = '{$locationId}'");
$cookieLocation->find();
if ($cookieLocation->N == 1) {
$cookieLocation->fetch();
$homeBranchId = $cookieLocation->locationId;
$nearbyBranch1Id = $cookieLocation->nearbyLocation1;
$nearbyBranch2Id = $cookieLocation->nearbyLocation2;
}
}
}
//Load the holding label for the user's home location.
$userLocation = new Location();
$userLocation->whereAdd("locationId = '{$homeBranchId}'");
$userLocation->find();
if ($userLocation->N == 1) {
$userLocation->fetch();
$homeBranch = $userLocation->holdingBranchLabel;
}
//Load nearby branch 1
$nearbyLocation1 = new Location();
$nearbyLocation1->whereAdd("locationId = '{$nearbyBranch1Id}'");
$nearbyLocation1->find();
if ($nearbyLocation1->N == 1) {
$nearbyLocation1->fetch();
$nearbyBranch1 = $nearbyLocation1->holdingBranchLabel;
}
//Load nearby branch 2
$nearbyLocation2 = new Location();
$nearbyLocation2->whereAdd();
$nearbyLocation2->whereAdd("locationId = '{$nearbyBranch2Id}'");
$nearbyLocation2->find();
if ($nearbyLocation2->N == 1) {
$nearbyLocation2->fetch();
//.........这里部分代码省略.........
示例2: parseHoldsPage
public function parseHoldsPage($pageContents)
{
//global $logger;
$availableHolds = array();
$unavailableHolds = array();
$holds = array('available' => $availableHolds, 'unavailable' => $unavailableHolds);
//Get the headers from the table
preg_match_all('/<th\\s+class="patFuncHeaders">\\s*([\\w\\s]*?)\\s*<\\/th>/si', $pageContents, $result, PREG_SET_ORDER);
$sKeys = array();
for ($matchi = 0; $matchi < count($result); $matchi++) {
$sKeys[] = $result[$matchi][1];
}
//Get the rows for the table
preg_match_all('/<tr\\s+class="patFuncEntry(?: on_ice)?">(.*?)<\\/tr>/si', $pageContents, $result, PREG_SET_ORDER);
$sRows = array();
for ($matchi = 0; $matchi < count($result); $matchi++) {
$sRows[] = $result[$matchi][1];
}
$sCount = 0;
foreach ($sRows as $sRow) {
preg_match_all('/<td[^>]*>(.*?)<\\/td>/si', $sRow, $result, PREG_SET_ORDER);
$sCols = array();
for ($matchi = 0; $matchi < count($result); $matchi++) {
$sCols[] = $result[$matchi][1];
}
//$sCols = preg_split("/<t(h|d)([^>]*)>/",$sRow);
$curHold = array();
$curHold['create'] = null;
$curHold['reqnum'] = null;
$curHold['holdSource'] = 'ILS';
//Holds page occasionally has a header with number of items checked out.
for ($i = 0; $i < sizeof($sCols); $i++) {
$sCols[$i] = str_replace(" ", " ", $sCols[$i]);
$sCols[$i] = preg_replace("/<br+?>/", " ", $sCols[$i]);
$sCols[$i] = html_entity_decode(trim($sCols[$i]));
//print_r($scols[$i]);
/*if ($sCount <= 1) {
$sKeys[$i] = $sCols[$i];
} else if ($sCount > 1) {*/
if ($sKeys[$i] == "CANCEL") {
//Only check Cancel key, not Cancel if not filled by
//Extract the id from the checkbox
$matches = array();
$numMatches = preg_match_all('/.*?cancel(.*?)x(\\d\\d).*/s', $sCols[$i], $matches);
if ($numMatches > 0) {
$curHold['renew'] = "BOX";
$curHold['cancelable'] = true;
$curHold['itemId'] = $matches[1][0];
$curHold['xnum'] = $matches[2][0];
$curHold['cancelId'] = $matches[1][0] . '~' . $matches[2][0];
} else {
$curHold['cancelable'] = false;
}
}
if (stripos($sKeys[$i], "TITLE") > -1) {
if (preg_match('/.*?<a href=\\"\\/record=(.*?)(?:~S\\d{1,2})\\">(.*?)<\\/a>.*/', $sCols[$i], $matches)) {
$shortId = $matches[1];
$bibid = '.' . $matches[1] . $this->driver->getCheckDigit($shortId);
$title = strip_tags($matches[2]);
} elseif (preg_match('/.*<a href=".*?\\/record\\/C__R(.*?)\\?.*?">(.*?)<\\/a>.*/si', $sCols[$i], $matches)) {
$shortId = $matches[1];
$bibid = '.' . $matches[1] . $this->driver->getCheckDigit($shortId);
$title = strip_tags($matches[2]);
} else {
//This happens for prospector titles
$bibid = '';
$shortId = '';
$title = trim($sCols[$i]);
/*global $configArray;
if ($configArray['System']['debug']){
echo("Unexpected format in title column. Got " . htmlentities($sCols[$i]) . "<br/>");
}*/
}
$curHold['id'] = $bibid;
$curHold['recordId'] = $bibid;
$curHold['shortId'] = $shortId;
$curHold['title'] = $title;
}
if (stripos($sKeys[$i], "Ratings") > -1) {
$curHold['request'] = "STARS";
}
if (stripos($sKeys[$i], "PICKUP LOCATION") > -1) {
//Extract the current location for the hold if possible
$matches = array();
if (preg_match('/<select\\s+name=loc(.*?)x(\\d\\d).*?<option\\s+value="([a-z]{1,5})[+ ]*"\\s+selected="selected">.*/s', $sCols[$i], $matches)) {
$curHold['locationId'] = $matches[1];
$curHold['locationXnum'] = $matches[2];
$curPickupBranch = new Location();
$curPickupBranch->whereAdd("code = '{$matches[3]}'");
$curPickupBranch->find(1);
if ($curPickupBranch->N > 0) {
$curPickupBranch->fetch();
$curHold['currentPickupId'] = $curPickupBranch->locationId;
$curHold['currentPickupName'] = $curPickupBranch->displayName;
$curHold['location'] = $curPickupBranch->displayName;
}
$curHold['locationUpdateable'] = true;
//Return the full select box for reference.
$curHold['locationSelect'] = $sCols[$i];
} else {
//.........这里部分代码省略.........
示例3: getItemsFast
public function getItemsFast()
{
global $configArray;
if ($this->fastItems == null) {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary) {
$libraryLocationCode = $searchLibrary->ilsCode;
}
$searchLocation = Location::getSearchLocation();
if ($searchLocation) {
$homeLocationCode = $searchLocation->code;
} else {
$homeLocation = Location::getUserHomeLocation();
if ($homeLocation) {
$homeLocationCode = $homeLocation->code;
}
}
$this->fastItems = array();
if ($this->itemsFromIndex) {
$this->fastItems = array();
foreach ($this->itemsFromIndex as $itemData) {
$isLocalItem = false;
$isLibraryItem = false;
if (array_key_exists('item', $itemData)) {
$itemId = $itemData['item'][0];
$locationCode = $itemData['item'][1];
$shelfLocation = mapValue('shelf_location', $locationCode);
$sharing = $itemData['item'][3];
$source = $itemData['item'][4];
$fileOrUrl = '';
if (count($itemData['item']) > 5) {
$fileOrUrl = $itemData['item'][5];
}
if (array_key_exists('scope', $itemData)) {
$isLocalItem = $itemData['scope'][1] == 'true';
$isLibraryItem = $itemData['scope'][2] == 'true';
}
} else {
$itemId = $itemData[1];
$locationCode = $itemData[2];
$shelfLocation = mapValue('shelf_location', $itemData[2]);
$sharing = $itemData[4];
$source = $itemData[5];
$fileOrUrl = '';
if (count($itemData) > 6) {
$fileOrUrl = $itemData[6];
}
$isLocalItem = isset($libraryLocationCode) && strlen($libraryLocationCode) > 0 && strpos($locationCode, $libraryLocationCode) === 0;
$isLibraryItem = isset($homeLocationCode) && strlen($homeLocationCode) > 0 && strpos($locationCode, $homeLocationCode) === 0;
}
$actions = $this->getActionsForItem($itemId, $fileOrUrl, null);
$libraryLabelObj = new Library();
$libraryLabelObj->whereAdd("'{$locationCode}' LIKE CONCAT(ilsCode, '%') and ilsCode <> ''");
$libraryLabelObj->selectAdd();
$libraryLabelObj->selectAdd('displayName');
if ($libraryLabelObj->find(true)) {
$libraryLabel = $libraryLabelObj->displayName;
} else {
$libraryLabel = $locationCode . ' Online';
}
//TODO: Get the correct number of available copies
$totalCopies = 1;
$this->fastItems[] = array('itemId' => $itemId, 'location' => $locationCode, 'callnumber' => '', 'availability' => $this->isItemAvailable($itemId, $totalCopies), 'holdable' => $this->isEContentHoldable($locationCode, $itemData), 'inLibraryUseOnly' => false, 'isLocalItem' => $isLocalItem, 'isLibraryItem' => $isLibraryItem, 'locationLabel' => 'Online', 'libraryLabel' => $libraryLabel, 'shelfLocation' => $shelfLocation, 'source' => 'Online ' . $source, 'sharing' => $sharing, 'actions' => $actions);
}
} else {
/** @var File_MARC_Data_Field[] $itemFields */
$itemFields = $this->getMarcRecord()->getFields('989');
foreach ($itemFields as $itemField) {
$locationCode = trim($itemField->getSubfield('d') != null ? $itemField->getSubfield('d')->getData() : '');
//Each item can have multiple item fields
/** @var File_MARC_Subfield[] $eContentFields */
$eContentFields = $itemField->getSubfields('w');
$itemId = $itemField->getSubfield('1')->getData();
$iType = $itemField->getSubfield($configArray['Reindex']['iTypeSubfield'])->getData();
foreach ($eContentFields as $eContentField) {
$eContentData = trim($eContentField->getData() != null ? $eContentField->getData() : '');
if ($eContentData && strpos($eContentData, ':') > 0) {
$eContentFieldData = explode(':', $eContentData);
$source = trim($eContentFieldData[0]);
$protectionType = strtolower(trim($eContentFieldData[1]));
$totalCopies = 1;
if ($this->isValidProtectionType($protectionType)) {
if ($this->isValidForUser($locationCode, $eContentFieldData)) {
$libraryLabelObj = new Library();
$libraryLabelObj->whereAdd("'{$locationCode}' LIKE CONCAT(ilsCode, '%') and ilsCode <> ''");
$libraryLabelObj->selectAdd();
$libraryLabelObj->selectAdd('displayName');
if ($libraryLabelObj->find(true)) {
$libraryLabel = $libraryLabelObj->displayName;
} else {
$libraryLabel = $locationCode . ' Online';
}
$locationLabelObj = new Location();
$locationLabelObj->whereAdd("'{$locationCode}' LIKE CONCAT(code, '%') and code <> ''");
if ($locationLabelObj->find(true)) {
$locationLabel = $locationLabelObj->displayName;
} else {
$locationLabel = $locationCode . ' Online';
}
//Get the file or url that is related to this item.
//.........这里部分代码省略.........
示例4: _updateVuFindPatronInfo
protected function _updateVuFindPatronInfo()
{
global $user;
//Validate that the input data is correct
if (isset($_POST['myLocation1']) && preg_match('/^\\d{1,3}$/', $_POST['myLocation1']) == 0) {
PEAR_Singleton::raiseError('The 1st location had an incorrect format.');
}
if (isset($_POST['myLocation2']) && preg_match('/^\\d{1,3}$/', $_POST['myLocation2']) == 0) {
PEAR_Singleton::raiseError('The 2nd location had an incorrect format.');
}
if (isset($_REQUEST['bypassAutoLogout'])) {
if ($_REQUEST['bypassAutoLogout'] == 'yes') {
$user->bypassAutoLogout = 1;
} else {
$user->bypassAutoLogout = 0;
}
}
if (isset($_REQUEST['promptForOverdriveEmail'])) {
if ($_REQUEST['promptForOverdriveEmail'] == 'yes') {
$user->promptForOverdriveEmail = 1;
} else {
$user->promptForOverdriveEmail = 0;
}
}
if (isset($_REQUEST['overdriveEmail'])) {
$user->overdriveEmail = strip_tags($_REQUEST['overdriveEmail']);
}
//Make sure the selected location codes are in the database.
if (isset($_POST['myLocation1'])) {
$location = new Location();
$location->whereAdd("locationId = '{$_POST['myLocation1']}'");
$location->find();
if ($location->N != 1) {
PEAR_Singleton::raiseError('The 1st location could not be found in the database.');
}
$user->myLocation1Id = $_POST['myLocation1'];
}
if (isset($_POST['myLocation2'])) {
$location = new Location();
$location->whereAdd();
$location->whereAdd("locationId = '{$_POST['myLocation2']}'");
$location->find();
if ($location->N != 1) {
PEAR_Singleton::raiseError('The 2nd location could not be found in the database.');
}
$user->myLocation2Id = $_POST['myLocation2'];
}
$user->update();
//Update the serialized instance stored in the session
$_SESSION['userinfo'] = serialize($user);
}
示例5: getSortingDataForHoldings
protected static function getSortingDataForHoldings()
{
if (self::$holdingSortingData == null) {
global $user;
global $library;
global $locationSingleton;
/** @var $locationSingleton Location */
$holdingSortingData = array();
//Get location information so we can put things into sections
$physicalLocation = $locationSingleton->getPhysicalLocation();
if ($physicalLocation != null) {
$holdingSortingData['physicalBranch'] = $physicalLocation->holdingBranchLabel;
} else {
$holdingSortingData['physicalBranch'] = '';
}
$holdingSortingData['homeBranch'] = '';
$homeBranchId = 0;
$holdingSortingData['nearbyBranch1'] = '';
$nearbyBranch1Id = 0;
$holdingSortingData['nearbyBranch2'] = '';
$nearbyBranch2Id = 0;
//Set location information based on the user login. This will override information based
if (isset($user) && $user != false) {
$homeBranchId = $user->homeLocationId;
$nearbyBranch1Id = $user->myLocation1Id;
$nearbyBranch2Id = $user->myLocation2Id;
} else {
//Check to see if the cookie for home location is set.
if (isset($_COOKIE['home_location']) && is_numeric($_COOKIE['home_location'])) {
$cookieLocation = new Location();
$locationId = $_COOKIE['home_location'];
$cookieLocation->whereAdd("locationId = '{$locationId}'");
$cookieLocation->find();
if ($cookieLocation->N == 1) {
$cookieLocation->fetch();
$homeBranchId = $cookieLocation->locationId;
$nearbyBranch1Id = $cookieLocation->nearbyLocation1;
$nearbyBranch2Id = $cookieLocation->nearbyLocation2;
}
}
}
//Load the holding label for the user's home location.
$userLocation = new Location();
$userLocation->whereAdd("locationId = '{$homeBranchId}'");
$userLocation->find();
if ($userLocation->N == 1) {
$userLocation->fetch();
$holdingSortingData['homeBranch'] = $userLocation->holdingBranchLabel;
}
//Load nearby branch 1
$nearbyLocation1 = new Location();
$nearbyLocation1->whereAdd("locationId = '{$nearbyBranch1Id}'");
$nearbyLocation1->find();
if ($nearbyLocation1->N == 1) {
$nearbyLocation1->fetch();
$holdingSortingData['nearbyBranch1'] = $nearbyLocation1->holdingBranchLabel;
}
//Load nearby branch 2
$nearbyLocation2 = new Location();
$nearbyLocation2->whereAdd();
$nearbyLocation2->whereAdd("locationId = '{$nearbyBranch2Id}'");
$nearbyLocation2->find();
if ($nearbyLocation2->N == 1) {
$nearbyLocation2->fetch();
$holdingSortingData['nearbyBranch2'] = $nearbyLocation2->holdingBranchLabel;
}
//Get a list of the display names for all locations based on holding label.
$locationLabels = array();
$location = new Location();
$location->find();
$holdingSortingData['libraryLocationLabels'] = array();
$locationCodes = array();
$suppressedLocationCodes = array();
while ($location->fetch()) {
if (strlen($location->holdingBranchLabel) > 0 && $location->holdingBranchLabel != '???') {
if ($library && $library->libraryId == $location->libraryId) {
$cleanLabel = str_replace('/', '\\/', $location->holdingBranchLabel);
$libraryLocationLabels[] = str_replace('.', '\\.', $cleanLabel);
}
$locationLabels[$location->holdingBranchLabel] = $location->displayName;
$locationCodes[$location->code] = $location->holdingBranchLabel;
if ($location->suppressHoldings == 1) {
$suppressedLocationCodes[$location->code] = $location->code;
}
}
}
if (count($holdingSortingData['libraryLocationLabels']) > 0) {
$holdingSortingData['libraryLocationLabels'] = '/^(' . join('|', $holdingSortingData['libraryLocationLabels']) . ').*/i';
} else {
$holdingSortingData['libraryLocationLabels'] = '';
}
self::$holdingSortingData = $holdingSortingData;
global $timer;
$timer->logTime("Finished loading sorting information for holdings");
}
return self::$holdingSortingData;
}
示例6: getMyProfile
/**
* Get Patron Profile
*
* This is responsible for retrieving the profile for a specific patron.
* Interface defined in CatalogConnection.php
*
* @param array $patron The patron array
* @param boolean $forceReload Whether or not we should force a reload of the data
* @return array Array of the patron's profile data
* If an error occurs, return a PEAR_Error
* @access public
*/
public function getMyProfile($patron, $forceReload = false)
{
global $timer;
global $configArray;
/** @var Memcache $memCache */
global $memCache;
global $serverName;
$memCacheProfileKey = "patronProfile_{$serverName}_";
if (is_object($patron)) {
$patron = get_object_vars($patron);
$memCacheProfileKey .= $patron['username'];
$id2 = $this->_getBarcode($patron);
} else {
global $user;
$memCacheProfileKey .= $user->username;
$id2 = $patron['cat_password'];
}
if (!$forceReload && !isset($_REQUEST['reload'])) {
$patronProfile = $memCache->get($memCacheProfileKey);
if ($patronProfile) {
$timer->logTime('Retrieved Cached Profile for Patron');
return $patronProfile;
}
}
global $user;
if ($configArray['Catalog']['offline'] == true) {
$fullName = $patron['cat_username'];
$Address1 = "";
$City = "";
$State = "";
$Zip = "";
$finesVal = 0;
$expireClose = false;
$homeBranchCode = '';
$numHoldsAvailable = '?';
$numHoldsRequested = '?';
if (!$user) {
$user = new User();
$user->cat_password = $id2;
if ($user->find(true)) {
$location = new Location();
$location->locationId = $user->homeLocationId;
$location->find(1);
$homeBranchCode = $location->code;
}
}
} else {
//Load the raw information about the patron
$patronDump = $this->_getPatronDump($id2);
if (isset($patronDump['ADDRESS'])) {
$fullAddress = $patronDump['ADDRESS'];
$addressParts = explode('$', $fullAddress);
$Address1 = $addressParts[0];
$City = isset($addressParts[1]) ? $addressParts[1] : '';
$State = isset($addressParts[2]) ? $addressParts[2] : '';
$Zip = isset($addressParts[3]) ? $addressParts[3] : '';
if (preg_match('/(.*?),\\s+(.*)\\s+(\\d*(?:-\\d*)?)/', $City, $matches)) {
$City = $matches[1];
$State = $matches[2];
$Zip = $matches[3];
} else {
if (preg_match('/(.*?)\\s+(\\w{2})\\s+(\\d*(?:-\\d*)?)/', $City, $matches)) {
$City = $matches[1];
$State = $matches[2];
$Zip = $matches[3];
}
}
} else {
$Address1 = "";
$City = "";
$State = "";
$Zip = "";
}
$fullName = $patronDump['PATRN_NAME'];
//Get additional information about the patron's home branch for display.
$location = null;
if (isset($patronDump['HOME_LIBR']) || isset($patronDump['HOLD_LIBR'])) {
$homeBranchCode = isset($patronDump['HOME_LIBR']) ? $patronDump['HOME_LIBR'] : $patronDump['HOLD_LIBR'];
$homeBranchCode = str_replace('+', '', $homeBranchCode);
//Translate home branch to plain text
$location = new Location();
$location->whereAdd("code = '{$homeBranchCode}'");
$location->find(1);
if ($location->N == 0) {
unset($location);
}
}
if ($user) {
//.........这里部分代码省略.........
示例7: 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;
}
示例8: getStatus
//.........这里部分代码省略.........
$ret[] = $newHolding;
}
}
}
}
$timer->logTime('processed all holdings rows');
} else {
$ret = null;
}
global $locationSingleton;
/** @var $locationSingleton Location */
$physicalLocation = $locationSingleton->getPhysicalLocation();
if ($physicalLocation != null) {
$physicalBranch = $physicalLocation->holdingBranchLabel;
} else {
$physicalBranch = '';
}
$homeBranch = '';
$homeBranchId = 0;
$nearbyBranch1 = '';
$nearbyBranch1Id = 0;
$nearbyBranch2 = '';
$nearbyBranch2Id = 0;
//Set location information based on the user login. This will override information based
if (isset($user) && $user != false) {
$homeBranchId = $user->homeLocationId;
$nearbyBranch1Id = $user->myLocation1Id;
$nearbyBranch2Id = $user->myLocation2Id;
} else {
//Check to see if the cookie for home location is set.
if (isset($_COOKIE['home_location']) && is_numeric($_COOKIE['home_location'])) {
$cookieLocation = new Location();
$locationId = $_COOKIE['home_location'];
$cookieLocation->whereAdd("locationId = '{$locationId}'");
$cookieLocation->find();
if ($cookieLocation->N == 1) {
$cookieLocation->fetch();
$homeBranchId = $cookieLocation->locationId;
$nearbyBranch1Id = $cookieLocation->nearbyLocation1;
$nearbyBranch2Id = $cookieLocation->nearbyLocation2;
}
}
}
//Load the holding label for the user's home location.
$userLocation = new Location();
$userLocation->whereAdd("locationId = '{$homeBranchId}'");
$userLocation->find();
if ($userLocation->N == 1) {
$userLocation->fetch();
$homeBranch = $userLocation->holdingBranchLabel;
}
//Load nearby branch 1
$nearbyLocation1 = new Location();
$nearbyLocation1->whereAdd("locationId = '{$nearbyBranch1Id}'");
$nearbyLocation1->find();
if ($nearbyLocation1->N == 1) {
$nearbyLocation1->fetch();
$nearbyBranch1 = $nearbyLocation1->holdingBranchLabel;
}
//Load nearby branch 2
$nearbyLocation2 = new Location();
$nearbyLocation2->whereAdd();
$nearbyLocation2->whereAdd("locationId = '{$nearbyBranch2Id}'");
$nearbyLocation2->find();
if ($nearbyLocation2->N == 1) {
$nearbyLocation2->fetch();
示例9: updateCatalogOptions
function updateCatalogOptions()
{
//Validate that the input data is correct
if (isset($_POST['myLocation1']) && preg_match('/^\\d{1,3}$/', $_POST['myLocation1']) == 0) {
PEAR_Singleton::raiseError('The 1st location had an incorrect format.');
}
if (isset($_POST['myLocation2']) && preg_match('/^\\d{1,3}$/', $_POST['myLocation2']) == 0) {
PEAR_Singleton::raiseError('The 2nd location had an incorrect format.');
}
if (isset($_REQUEST['bypassAutoLogout']) && ($_REQUEST['bypassAutoLogout'] == 'yes' || $_REQUEST['bypassAutoLogout'] == 'on')) {
$this->bypassAutoLogout = 1;
} else {
$this->bypassAutoLogout = 0;
}
//Make sure the selected location codes are in the database.
if (isset($_POST['myLocation1'])) {
$location = new Location();
$location->whereAdd("locationId = '{$_POST['myLocation1']}'");
$location->find();
if ($location->N != 1) {
PEAR_Singleton::raiseError('The 1st location could not be found in the database.');
}
$this->myLocation1Id = $_POST['myLocation1'];
}
if (isset($_POST['myLocation2'])) {
$location = new Location();
$location->whereAdd();
$location->whereAdd("locationId = '{$_POST['myLocation2']}'");
$location->find();
if ($location->N != 1) {
PEAR_Singleton::raiseError('The 2nd location could not be found in the database.');
}
$this->myLocation2Id = $_POST['myLocation2'];
}
$this->update();
//Update the serialized instance stored in the session
$_SESSION['userinfo'] = serialize($this);
/** @var Memcache $memCache */
global $memCache;
global $serverName;
$memCache->delete("patronProfile_{$serverName}_" . $this->username);
}
示例10: parseHoldsPage
public function parseHoldsPage($sResult)
{
global $logger;
$availableHolds = array();
$unavailableHolds = array();
$holds = array('available' => $availableHolds, 'unavailable' => $unavailableHolds);
$sResult = preg_replace("/<[^<]+?>\\W<[^<]+?>\\W\\d* HOLD.?\\W<[^<]+?>\\W<[^<]+?>/", "", $sResult);
//$logger->log('Hold information = ' . $sresult, PEAR_LOG_INFO);
$s = substr($sResult, stripos($sResult, 'patFunc'));
$s = substr($s, strpos($s, ">") + 1);
$s = substr($s, 0, stripos($s, "</table"));
$s = preg_replace("/<br \\/>/", "", $s);
$sRows = preg_split("/<tr([^>]*)>/", $s);
$sCount = 0;
$sKeys = array_pad(array(), 10, "");
foreach ($sRows as $sRow) {
$sCols = preg_split("/<t(h|d)([^>]*)>/", $sRow);
$curHold = array();
$curHold['create'] = null;
$curHold['reqnum'] = null;
//Holds page occassionally has a header with number of items checked out.
for ($i = 0; $i < sizeof($sCols); $i++) {
$sCols[$i] = str_replace(" ", " ", $sCols[$i]);
$sCols[$i] = preg_replace("/<br+?>/", " ", $sCols[$i]);
$sCols[$i] = html_entity_decode(trim(substr($sCols[$i], 0, stripos($sCols[$i], "</t"))));
//print_r($scols[$i]);
if ($sCount <= 1) {
$sKeys[$i] = $sCols[$i];
} else {
if ($sCount > 1) {
if ($sKeys[$i] == "CANCEL") {
//Only check Cancel key, not Cancel if not filled by
//Extract the id from the checkbox
$matches = array();
$numMatches = preg_match_all('/.*?cancel(.*?)x(\\d\\d).*/s', $sCols[$i], $matches);
if ($numMatches > 0) {
$curHold['renew'] = "BOX";
$curHold['cancelable'] = true;
$curHold['itemId'] = $matches[1][0];
$curHold['xnum'] = $matches[2][0];
$curHold['cancelId'] = $matches[1][0] . '~' . $matches[2][0];
} else {
$curHold['cancelable'] = false;
}
}
if (stripos($sKeys[$i], "TITLE") > -1) {
if (preg_match('/.*?<a href=\\"\\/record=(.*?)(?:~S\\d{1,2})\\">(.*?)<\\/a>.*/', $sCols[$i], $matches)) {
$shortId = $matches[1];
$bibid = '.' . $matches[1];
//Technically, this isn't corrcect since the check digit is missing
$title = $matches[2];
} else {
$bibid = '';
$shortId = '';
$title = trim($sCols[$i]);
}
$curHold['id'] = $bibid;
$curHold['shortId'] = $shortId;
$curHold['title'] = $title;
}
if (stripos($sKeys[$i], "Ratings") > -1) {
$curHold['request'] = "STARS";
}
if (stripos($sKeys[$i], "PICKUP LOCATION") > -1) {
//Extract the current location for the hold if possible
$matches = array();
if (preg_match('/<select\\s+name=loc(.*?)x(\\d\\d).*?<option\\s+value="([a-z]{1,5})[+ ]*"\\s+selected="selected">.*/s', $sCols[$i], $matches)) {
$curHold['locationId'] = $matches[1];
$curHold['locationXnum'] = $matches[2];
$curPickupBranch = new Location();
$curPickupBranch->whereAdd("code = '{$matches[3]}'");
$curPickupBranch->find(1);
if ($curPickupBranch->N > 0) {
$curPickupBranch->fetch();
$curHold['currentPickupId'] = $curPickupBranch->locationId;
$curHold['currentPickupName'] = $curPickupBranch->displayName;
$curHold['location'] = $curPickupBranch->displayName;
}
$curHold['locationUpdateable'] = true;
//Return the full select box for reference.
$curHold['locationSelect'] = $sCols[$i];
} else {
$curHold['location'] = $sCols[$i];
//Trim the carrier code if any
if (preg_match('/.*\\s[\\w\\d]{4}/', $curHold['location'])) {
$curHold['location'] = substr($curHold['location'], 0, strlen($curHold['location']) - 5);
}
$curHold['currentPickupName'] = $curHold['location'];
$curHold['locationUpdateable'] = false;
}
}
if (stripos($sKeys[$i], "STATUS") > -1) {
$status = trim(strip_tags($sCols[$i]));
$status = strtolower($status);
$status = ucwords($status);
if ($status != " ") {
$curHold['status'] = $status;
if (preg_match('/READY.*(\\d{2}-\\d{2}-\\d{2})/i', $status, $matches)) {
$curHold['status'] = 'Ready';
//Get expiration date
//.........这里部分代码省略.........
示例11: getStatus
/**
* Load status (holdings) for a record and filter them based on the logged in user information.
*
* @param string $id the id of the record
* @return array A list of holdings for the record
*/
public function getStatus($id)
{
global $library;
global $user;
global $timer;
global $logger;
//Get information about holdings, order information, and issue information
$millenniumInfo = $this->driver->getMillenniumRecordInfo($id);
//Get the number of holds
if ($millenniumInfo->framesetInfo) {
if (preg_match('/(\\d+) hold(s?) on .*? of \\d+ (copies|copy)/', $millenniumInfo->framesetInfo, $matches)) {
$holdQueueLength = $matches[1];
} else {
$holdQueueLength = 0;
}
}
// Load Record Page
$r = substr($millenniumInfo->holdingsInfo, stripos($millenniumInfo->holdingsInfo, 'bibItems'));
$r = substr($r, strpos($r, ">") + 1);
$r = substr($r, 0, stripos($r, "</table"));
$rows = preg_split("/<tr([^>]*)>/", $r);
// Load the full marc record so we can get the iType for each record.
$marcRecord = MarcLoader::loadMarcRecordByILSId($id);
$itemFields = $marcRecord->getFields("989");
$marcItemData = array();
$pType = $this->driver->getPType();
$scope = $this->driver->getMillenniumScope();
//Load item information from marc record
foreach ($itemFields as $itemField) {
/** @var $itemField File_MARC_Data_Field */
$fullCallNumber = $itemField->getSubfield('s') != null ? $itemField->getSubfield('s')->getData() . ' ' : '';
$fullCallNumber .= $itemField->getSubfield('a') != null ? $itemField->getSubfield('a')->getData() : '';
$fullCallNumber .= $itemField->getSubfield('r') != null ? ' ' . $itemField->getSubfield('r')->getData() : '';
$itemData['callnumber'] = $fullCallNumber;
$itemData['location'] = $itemField->getSubfield('d') != null ? $itemField->getSubfield('d')->getData() : ($itemField->getSubfield('p') != null ? $itemField->getSubfield('p')->getData() : '?????');
$itemData['iType'] = $itemField->getSubfield('j') != null ? $itemField->getSubfield('j')->getData() : '0';
$itemData['matched'] = false;
$marcItemData[] = $itemData;
}
//Process each row in the callnumber table.
$ret = $this->parseHoldingRows($id, $rows);
$timer->logTime('processed all holdings rows');
global $locationSingleton;
/** @var $locationSingleton Location */
$physicalLocation = $locationSingleton->getPhysicalLocation();
if ($physicalLocation != null) {
$physicalBranch = $physicalLocation->holdingBranchLabel;
} else {
$physicalBranch = '';
}
$homeBranch = '';
$homeBranchId = 0;
$nearbyBranch1 = '';
$nearbyBranch1Id = 0;
$nearbyBranch2 = '';
$nearbyBranch2Id = 0;
//Set location information based on the user login. This will override information based
if (isset($user) && $user != false) {
$homeBranchId = $user->homeLocationId;
$nearbyBranch1Id = $user->myLocation1Id;
$nearbyBranch2Id = $user->myLocation2Id;
} else {
//Check to see if the cookie for home location is set.
if (isset($_COOKIE['home_location']) && is_numeric($_COOKIE['home_location'])) {
$cookieLocation = new Location();
$locationId = $_COOKIE['home_location'];
$cookieLocation->whereAdd("locationId = '{$locationId}'");
$cookieLocation->find();
if ($cookieLocation->N == 1) {
$cookieLocation->fetch();
$homeBranchId = $cookieLocation->locationId;
$nearbyBranch1Id = $cookieLocation->nearbyLocation1;
$nearbyBranch2Id = $cookieLocation->nearbyLocation2;
}
}
}
//Load the holding label for the user's home location.
$userLocation = new Location();
$userLocation->whereAdd("locationId = '{$homeBranchId}'");
$userLocation->find();
if ($userLocation->N == 1) {
$userLocation->fetch();
$homeBranch = $userLocation->holdingBranchLabel;
}
//Load nearby branch 1
$nearbyLocation1 = new Location();
$nearbyLocation1->whereAdd("locationId = '{$nearbyBranch1Id}'");
$nearbyLocation1->find();
if ($nearbyLocation1->N == 1) {
$nearbyLocation1->fetch();
$nearbyBranch1 = $nearbyLocation1->holdingBranchLabel;
}
//Load nearby branch 2
$nearbyLocation2 = new Location();
//.........这里部分代码省略.........
示例12: getStatus
/**
* In Sierra, all status information is up to date within the MARC record
* due to the export so we don't need to screen scrape!
*
* Format of return array is:
* key = {section#}{location}-### where ### is the holding iteration
*
* value = array (
* id = The id of the bib
* number = The position of the holding within the original list of holdings
* section = A description of the section
* sectionId = a numeric id of the section for sorting
* type = holding
* status
* statusfull
* reserve
* holdQueueLength
* duedate
* location
* locationLink
* callnumber
* link = array
* linkText
* isDownload
* )
*
* Includes both physical titles as well as titles on order
*
* @param string $id the id of the record
* @return array A list of holdings for the record
*/
public function getStatus($id)
{
$recordDriver = RecordDriverFactory::initRecordDriverById('ils:' . $id);
$format = $recordDriver->getFormat();
if ($format[0] == 'Journal') {
return parent::getStatus($id);
}
if (array_key_exists($id, SierraStatusLoader::$loadedStatus)) {
return SierraStatusLoader::$loadedStatus[$id];
}
//Load local information
global $library;
global $locationSingleton;
/** @var $locationSingleton Location */
global $user;
$physicalLocation = $locationSingleton->getPhysicalLocation();
if ($physicalLocation != null) {
$physicalBranch = $physicalLocation->holdingBranchLabel;
} else {
$physicalBranch = '';
}
$homeBranch = '';
$homeBranchId = 0;
$nearbyBranch1 = '';
$nearbyBranch1Id = 0;
$nearbyBranch2 = '';
$nearbyBranch2Id = 0;
//Set location information based on the user login. This will override information based
if (isset($user) && $user != false) {
$homeBranchId = $user->homeLocationId;
$nearbyBranch1Id = $user->myLocation1Id;
$nearbyBranch2Id = $user->myLocation2Id;
} else {
//Check to see if the cookie for home location is set.
if (isset($_COOKIE['home_location']) && is_numeric($_COOKIE['home_location'])) {
$cookieLocation = new Location();
$locationId = $_COOKIE['home_location'];
$cookieLocation->whereAdd("locationId = '{$locationId}'");
$cookieLocation->find();
if ($cookieLocation->N == 1) {
$cookieLocation->fetch();
$homeBranchId = $cookieLocation->locationId;
$nearbyBranch1Id = $cookieLocation->nearbyLocation1;
$nearbyBranch2Id = $cookieLocation->nearbyLocation2;
}
}
}
//Load the holding label for the user's home location.
$userLocation = new Location();
$userLocation->whereAdd("locationId = '{$homeBranchId}'");
$userLocation->find();
if ($userLocation->N == 1) {
$userLocation->fetch();
$homeBranch = $userLocation->holdingBranchLabel;
}
//Load nearby branch 1
$nearbyLocation1 = new Location();
$nearbyLocation1->whereAdd("locationId = '{$nearbyBranch1Id}'");
$nearbyLocation1->find();
if ($nearbyLocation1->N == 1) {
$nearbyLocation1->fetch();
$nearbyBranch1 = $nearbyLocation1->holdingBranchLabel;
}
//Load nearby branch 2
$nearbyLocation2 = new Location();
$nearbyLocation2->whereAdd();
$nearbyLocation2->whereAdd("locationId = '{$nearbyBranch2Id}'");
$nearbyLocation2->find();
if ($nearbyLocation2->N == 1) {
//.........这里部分代码省略.........