当前位置: 首页>>代码示例>>PHP>>正文


PHP Location::fetch方法代码示例

本文整理汇总了PHP中Location::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::fetch方法的具体用法?PHP Location::fetch怎么用?PHP Location::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Location的用法示例。


在下文中一共展示了Location::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadLibraryLocationInformation

 private static function loadLibraryLocationInformation()
 {
     if (MillenniumDriver::$libraryLocationInformationLoaded == false) {
         //Get a list of all locations for the active library
         global $library;
         global $timer;
         $userLibrary = Library::getPatronHomeLibrary();
         MillenniumDriver::$libraryLocations = array();
         MillenniumDriver::$libraryLocationLabels = array();
         $libraryLocation = new Location();
         if ($userLibrary) {
             $libraryLocation->libraryId = $userLibrary->libraryId;
             $libraryLocation->find();
             while ($libraryLocation->fetch()) {
                 MillenniumDriver::$libraryLocations[] = $libraryLocation->code;
                 MillenniumDriver::$libraryLocationLabels[$libraryLocation->code] = $libraryLocation->facetLabel;
             }
         } else {
             $libraryLocation->libraryId = $library->libraryId;
             $libraryLocation->find();
             while ($libraryLocation->fetch()) {
                 MillenniumDriver::$libraryLocations[] = $libraryLocation->code;
                 MillenniumDriver::$libraryLocationLabels[$libraryLocation->code] = $libraryLocation->facetLabel;
             }
         }
         MillenniumDriver::$homeLocationCode = null;
         MillenniumDriver::$homeLocationLabel = null;
         $searchLocation = Location::getSearchLocation();
         if ($searchLocation) {
             MillenniumDriver::$homeLocationCode = $searchLocation->code;
             MillenniumDriver::$homeLocationLabel = $searchLocation->facetLabel;
         } else {
             $homeLocation = Location::getUserHomeLocation();
             if ($homeLocation) {
                 MillenniumDriver::$homeLocationCode = $homeLocation->code;
                 MillenniumDriver::$homeLocationLabel = $homeLocation->facetLabel;
             }
         }
         $timer->logTime("Finished loading location data");
         MillenniumDriver::$scopingLocationCode = '';
         $searchLibrary = Library::getSearchLibrary();
         $searchLocation = Location::getSearchLocation();
         if (isset($searchLibrary)) {
             MillenniumDriver::$scopingLocationCode = $searchLibrary->ilsCode;
         }
         if (isset($searchLocation)) {
             MillenniumDriver::$scopingLocationCode = $searchLocation->code;
         }
         MillenniumDriver::$libraryLocationInformationLoaded = true;
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:51,代码来源:Millennium.php

示例2: getObjectStructure

 static function getObjectStructure()
 {
     global $user;
     //Load Libraries for lookup values
     $location = new Location();
     $location->orderBy('displayName');
     if ($user->hasRole('libraryAdmin')) {
         $homeLibrary = Library::getPatronHomeLibrary();
         $location->libraryId = $homeLibrary->libraryId;
     }
     $location->find();
     $locationList = array();
     while ($location->fetch()) {
         $locationList[$location->locationId] = $location->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'), 'locationId' => array('property' => 'locationId', 'type' => 'enum', 'values' => $locationList, 'label' => 'Location', 'description' => 'A link to the location which the browse category 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;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:30,代码来源:LocationBrowseCategory.php

示例3: testSave

 public function testSave()
 {
     $loc = new Location();
     $loc->setBuildingID(1);
     $loc->setRoom(9999);
     $loc->save();
     $this->assertTrue($loc->getID() != NULL);
     $fetched = new Location();
     $fetched->fetch($loc->getID());
     $this->assertEquals($fetched->getID(), $loc->getID());
     $this->assertEquals($fetched->getBuildingID(), $loc->getBuildingID());
     $this->assertEquals($fetched->getRoom(), $loc->getRoom());
     //delete from DB for cleanup
     //TODO -- replace with proper delete method
     $sql = "DELETE FROM `locations` WHERE id=?";
     $sql = $this->db->prepareQuery($sql, $loc->getID());
     $this->db->query($sql);
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:18,代码来源:locationTest.php

示例4: getAllObjects

 function getAllObjects()
 {
     //Look lookup information for display in the user interface
     global $user;
     $location = new Location();
     $location->orderBy('displayName');
     if (!$user->hasRole('opacAdmin')) {
         //Scope to just locations for the user based on home library
         $patronLibrary = Library::getLibraryForLocation($user->homeLocationId);
         $location->libraryId = $patronLibrary->libraryId;
     }
     $location->find();
     $locationList = array();
     while ($location->fetch()) {
         $locationList[$location->locationId] = clone $location;
     }
     return $locationList;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:18,代码来源:Locations.php

示例5: getObjectStructure

 function getObjectStructure()
 {
     //Look lookup information for display in the user interface
     $location = new Location();
     $location->orderBy('displayName');
     $location->find();
     $locationList = array();
     $locationLookupList = array();
     $locationLookupList[-1] = '<No Nearby Location>';
     while ($location->fetch()) {
         $locationLookupList[$location->locationId] = $location->displayName;
         $locationList[$location->locationId] = clone $location;
     }
     $structure = array('ip' => array('property' => 'ip', 'type' => 'text', 'label' => 'IP Address', 'description' => 'The IP Address to map to a location formatted as xxx.xxx.xxx.xxx/mask'), 'location' => array('property' => 'location', 'type' => 'text', 'label' => 'Display Name', 'description' => 'Descriptive information for the IP Address for internal use'), 'locationid' => array('property' => 'locationid', 'type' => 'enum', 'values' => $locationLookupList, 'label' => 'Location', 'description' => 'The Location which this IP address maps to'));
     foreach ($structure as $fieldName => $field) {
         $field['propertyOld'] = $field['property'] . 'Old';
         $structure[$fieldName] = $field;
     }
     return $structure;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:20,代码来源:IPAddresses.php

示例6: getObjectStructure

 static function getObjectStructure()
 {
     global $user;
     $location = new Location();
     $location->orderBy('displayName');
     if ($user->hasRole('libraryAdmin')) {
         $homeLibrary = Library::getPatronHomeLibrary();
         $location->libraryId = $homeLibrary->libraryId;
     }
     $location->find();
     while ($location->fetch()) {
         $locationList[$location->locationId] = $location->displayName;
     }
     $structure = parent::getObjectStructure();
     $structure['locationId'] = array('property' => 'locationId', 'type' => 'enum', 'values' => $locationList, 'label' => 'Location', 'description' => 'The id of a location');
     foreach ($structure as $fieldName => $field) {
         $field['propertyOld'] = $field['property'] . 'Old';
         $structure[$fieldName] = $field;
     }
     return $structure;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:21,代码来源:LocationFacetSetting.php

示例7: getObjectStructure

 static function getObjectStructure()
 {
     $location = new Location();
     $location->orderBy('displayName');
     $location->find();
     $locationList = array();
     while ($location->fetch()) {
         $locationList[$location->locationId] = $location->displayName;
     }
     $days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     $time = array('01:00', '01:30', '02:00', '02:30', '03:00', '03:30', '04:00', '04:30', '05:00', '05:30', '06:00', '06:30', '07:00', '07:30', '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30');
     $timeList = array();
     foreach ($time as $t) {
         $timeList[$t] = $t;
     }
     $structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'locationId' => array('property' => 'locationId', 'type' => 'enum', 'values' => $locationList, 'label' => 'Location', 'description' => 'The library location.'), 'day' => array('property' => 'day', 'type' => 'enum', 'values' => $days, 'label' => 'Day of Week', 'description' => 'The day of the week 0 to 6 (0 = Sunday to 6 = Saturday)'), 'closed' => array('property' => 'closed', 'type' => 'checkbox', 'label' => 'Closed', 'description' => 'Check to indicate that the library is closed on this day.'), 'open' => array('property' => 'open', 'type' => 'enum', 'values' => $timeList, 'label' => 'Opening Hour', 'description' => 'The opening hour. Use 24 hour format HH:MM, eg: 08:30'), 'close' => array('property' => 'close', 'type' => 'enum', 'values' => $timeList, 'label' => 'Closing Hour', 'description' => 'The closing hour. Use 24 hour format HH:MM, eg: 16:30'));
     foreach ($structure as $fieldName => $field) {
         $field['propertyOld'] = $field['property'] . 'Old';
         $structure[$fieldName] = $field;
     }
     return $structure;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:22,代码来源:LocationHours.php

示例8: getLocationsFacetsForLibrary

 function getLocationsFacetsForLibrary($libraryId)
 {
     $location = new Location();
     $location->libraryId = $libraryId;
     $location->find();
     $facets = array();
     if ($location->N > 0) {
         while ($location->fetch()) {
             $facets[] = $location->facetLabel;
         }
     }
     return $facets;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:13,代码来源:Location.php

示例9: placeItemHold

 /**
  * Place Item Hold
  *
  * This is responsible for both placing item level holds.
  *
  * @param   string  $recordId   The id of the bib record
  * @param   string  $itemId     The id of the item to hold
  * @param   string  $patronId   The id of the patron
  * @param   string  $comment    Any comment regarding the hold or recall
  * @param   string  $type       Whether to place a hold or recall
  * @param   string  $type       The date when the hold should be cancelled if any
  * @return  mixed               True if successful, false if unsuccessful
  *                              If an error occurs, return a PEAR_Error
  * @access  public
  */
 public function placeItemHold($recordId, $itemId, $patronId, $comment, $type)
 {
     global $user;
     global $configArray;
     $hold_result = array();
     $hold_result['result'] = false;
     require_once ROOT_DIR . '/RecordDrivers/MarcRecord.php';
     $recordDriver = new MarcRecord($recordId);
     if (!$recordDriver->isValid()) {
         $hold_result['message'] = 'Unable to find a valid record for this title.  Please try your search again.';
         return $hold_result;
     }
     $hold_result['title'] = $recordDriver->getTitle();
     //Set pickup location
     if (isset($_REQUEST['campus'])) {
         $campus = trim($_REQUEST['campus']);
     } else {
         $campus = $user->homeLocationId;
         //Get the code for the location
         $locationLookup = new Location();
         $locationLookup->locationId = $campus;
         $locationLookup->find();
         if ($locationLookup->N > 0) {
             $locationLookup->fetch();
             $campus = $locationLookup->code;
         }
     }
     $campus = strtoupper($campus);
     //Login before placing the hold
     $this->loginToKoha($user);
     //Post the hold to koha
     $placeHoldPage = $configArray['Catalog']['url'] . '/cgi-bin/koha/opac-reserve.pl';
     $holdParams = array('biblionumbers' => $recordId . '/', 'branch' => $campus, "checkitem_{$recordId}" => $itemId, 'place_reserve' => 1, "reqtype_{$recordId}" => 'Specific', 'reserve_mode' => 'multi', 'selecteditems' => "{$recordId}/{$itemId}/{$campus}/", 'single_bib' => $recordId);
     $kohaHoldResult = $this->postToKohaPage($placeHoldPage, $holdParams);
     $hold_result['id'] = $recordId;
     if (preg_match('/<a href="#opac-user-holds">Holds<\\/a>/si', $kohaHoldResult)) {
         //We redirected to the holds page, everything seems to be good
         $holds = $this->getMyHolds($user, 1, -1, 'title', $kohaHoldResult);
         $hold_result['result'] = true;
         $hold_result['message'] = "Your hold was placed successfully.";
         //Find the correct hold (will be unavailable)
         foreach ($holds['holds']['unavailable'] as $holdInfo) {
             if ($holdInfo['id'] == $recordId) {
                 if (isset($holdInfo['position'])) {
                     $hold_result['message'] .= "  You are number <b>" . $holdInfo['position'] . "</b> in the queue.";
                 }
                 break;
             }
         }
     } else {
         $hold_result['result'] = false;
         //Look for an alert message
         if (preg_match('/<div class="dialog alert">(.*?)<\\/div>/', $kohaHoldResult, $matches)) {
             $hold_result['message'] = 'Your hold could not be placed. ' . $matches[1];
         } else {
             $hold_result['message'] = 'Your hold could not be placed. ';
         }
     }
     return $hold_result;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:75,代码来源:Aspencat.php

示例10: launch

 function launch()
 {
     global $interface;
     global $user;
     $period = isset($_REQUEST['period']) ? $_REQUEST['period'] : 'week';
     if ($period == 'week') {
         $periodLength = new DateInterval("P1W");
     } elseif ($period == 'day') {
         $periodLength = new DateInterval("P1D");
     } elseif ($period == 'month') {
         $periodLength = new DateInterval("P1M");
     } else {
         //year
         $periodLength = new DateInterval("P1Y");
     }
     $interface->assign('period', $period);
     $endDate = isset($_REQUEST['endDate']) && strlen($_REQUEST['endDate']) > 0 ? DateTime::createFromFormat('m/d/Y', $_REQUEST['endDate']) : new DateTime();
     $interface->assign('endDate', $endDate->format('m/d/Y'));
     if (isset($_REQUEST['startDate']) && strlen($_REQUEST['startDate']) > 0) {
         $startDate = DateTime::createFromFormat('m/d/Y', $_REQUEST['startDate']);
     } else {
         if ($period == 'day') {
             $startDate = new DateTime($endDate->format('m/d/Y') . " - 7 days");
         } elseif ($period == 'week') {
             //Get the sunday after this
             $endDate->setISODate($endDate->format('Y'), $endDate->format("W"), 0);
             $endDate->modify("+7 days");
             $startDate = new DateTime($endDate->format('m/d/Y') . " - 28 days");
         } elseif ($period == 'month') {
             $endDate->modify("+1 month");
             $numDays = $endDate->format("d");
             $endDate->modify(" -{$numDays} days");
             $startDate = new DateTime($endDate->format('m/d/Y') . " - 6 months");
         } else {
             //year
             $endDate->modify("+1 year");
             $numDays = $endDate->format("m");
             $endDate->modify(" -{$numDays} months");
             $numDays = $endDate->format("d");
             $endDate->modify(" -{$numDays} days");
             $startDate = new DateTime($endDate->format('m/d/Y') . " - 2 years");
         }
     }
     $interface->assign('startDate', $startDate->format('m/d/Y'));
     //Set the end date to the end of the day
     $endDate->setTime(24, 0, 0);
     $startDate->setTime(0, 0, 0);
     //Create the periods that are being represented
     $periods = array();
     $periodEnd = clone $endDate;
     while ($periodEnd >= $startDate) {
         array_unshift($periods, clone $periodEnd);
         $periodEnd->sub($periodLength);
     }
     //print_r($periods);
     //Load data for each period
     //this will be a two dimensional array
     //         Period 1, Period 2, Period 3
     //Status 1
     //Status 2
     //Status 3
     $periodData = array();
     for ($i = 0; $i < count($periods) - 1; $i++) {
         /** @var DateTime $periodStart */
         $periodStart = clone $periods[$i];
         /** @var DateTime $periodEnd */
         $periodEnd = clone $periods[$i + 1];
         $periodData[$periodStart->getTimestamp()] = array();
         //Determine how many requests were created
         $materialsRequest = new MaterialsRequest();
         $materialsRequest->joinAdd(new User(), 'INNER', 'user');
         $materialsRequest->selectAdd();
         $materialsRequest->selectAdd('COUNT(id) as numRequests');
         $materialsRequest->whereAdd('dateCreated >= ' . $periodStart->getTimestamp() . ' AND dateCreated < ' . $periodEnd->getTimestamp());
         if ($user->hasRole('library_material_requests')) {
             //Need to limit to only requests submitted for the user's home location
             $userHomeLibrary = Library::getPatronHomeLibrary();
             $locations = new Location();
             $locations->libraryId = $userHomeLibrary->libraryId;
             $locations->find();
             $locationsForLibrary = array();
             while ($locations->fetch()) {
                 $locationsForLibrary[] = $locations->locationId;
             }
             $materialsRequest->whereAdd('user.homeLocationId IN (' . implode(', ', $locationsForLibrary) . ')');
         }
         $materialsRequest->find();
         while ($materialsRequest->fetch()) {
             $periodData[$periodStart->getTimestamp()]['Created'] = $materialsRequest->numRequests;
         }
         //Get a list of all requests by the status of the request
         $materialsRequest = new MaterialsRequest();
         $materialsRequest->joinAdd(new MaterialsRequestStatus());
         $materialsRequest->joinAdd(new User(), 'INNER', 'user');
         $materialsRequest->selectAdd();
         $materialsRequest->selectAdd('COUNT(materials_request.id) as numRequests,description');
         $materialsRequest->whereAdd('dateUpdated >= ' . $periodStart->getTimestamp() . ' AND dateUpdated < ' . $periodEnd->getTimestamp());
         if ($user->hasRole('library_material_requests')) {
             //Need to limit to only requests submitted for the user's home location
             $userHomeLibrary = Library::getPatronHomeLibrary();
//.........这里部分代码省略.........
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:101,代码来源:SummaryReport.php

示例11: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     /** @var Library $librarySingleton */
     global $librarySingleton;
     $activeLibrary = $librarySingleton->getActiveLibrary();
     if ($activeLibrary == null) {
         $canUpdateContactInfo = true;
         $canUpdateAddress = true;
         $showWorkPhoneInProfile = false;
         $showNoticeTypeInProfile = true;
         $showPickupLocationInProfile = false;
         $treatPrintNoticesAsPhoneNotices = false;
         $allowPinReset = false;
         $showAlternateLibraryOptionsInProfile = true;
     } else {
         $canUpdateContactInfo = $activeLibrary->allowProfileUpdates == 1;
         $canUpdateAddress = $activeLibrary->allowPatronAddressUpdates == 1;
         $showWorkPhoneInProfile = $activeLibrary->showWorkPhoneInProfile == 1;
         $showNoticeTypeInProfile = $activeLibrary->showNoticeTypeInProfile == 1;
         $treatPrintNoticesAsPhoneNotices = $activeLibrary->treatPrintNoticesAsPhoneNotices == 1;
         $showPickupLocationInProfile = $activeLibrary->showPickupLocationInProfile == 1;
         $allowPinReset = $activeLibrary->allowPinReset == 1;
         $showAlternateLibraryOptionsInProfile = $activeLibrary->showAlternateLibraryOptionsInProfile == 1;
     }
     if ($showPickupLocationInProfile) {
         // only grab pickup locations if needed.
         global $locationSingleton;
         //Get the list of pickup branch locations for display in the user interface.
         $locations = $locationSingleton->getPickupBranches($user, $user->homeLocationId);
         $interface->assign('pickupLocations', $locations);
     }
     $interface->assign('canUpdateContactInfo', $canUpdateContactInfo);
     $interface->assign('canUpdateAddress', $canUpdateAddress);
     $interface->assign('showWorkPhoneInProfile', $showWorkPhoneInProfile);
     $interface->assign('showPickupLocationInProfile', $showPickupLocationInProfile);
     $interface->assign('showNoticeTypeInProfile', $showNoticeTypeInProfile);
     $interface->assign('treatPrintNoticesAsPhoneNotices', $treatPrintNoticesAsPhoneNotices);
     $interface->assign('allowPinReset', $allowPinReset);
     $interface->assign('showAlternateLibraryOptions', $showAlternateLibraryOptionsInProfile);
     $ils = $configArray['Catalog']['ils'];
     $interface->assign('showSMSNoticesInProfile', $ils == 'Sierra');
     if ($configArray['Catalog']['offline']) {
         $interface->assign('offline', true);
     } else {
         $interface->assign('offline', false);
     }
     if (isset($_POST['updateScope']) && !$configArray['Catalog']['offline']) {
         $updateScope = $_REQUEST['updateScope'];
         if ($updateScope == 'contact') {
             $errors = $this->catalog->updatePatronInfo($canUpdateContactInfo);
             session_start();
             // any writes to the session storage also closes session. Happens in updatePatronInfo (for Horizon). plb 4-21-2015
             $_SESSION['profileUpdateErrors'] = $errors;
         } elseif ($updateScope == 'catalog') {
             $user->updateCatalogOptions();
         } elseif ($updateScope == 'overdrive') {
             // overdrive setting keep changing
             /*	require_once ROOT_DIR . '/Drivers/OverDriveDriverFactory.php';
             				$overDriveDriver = OverDriveDriverFactory::getDriver();
             				$result = $overDriveDriver->updateLendingOptions();
             */
             $user->updateOverDriveOptions();
         } elseif ($updateScope == 'pin') {
             $errors = $this->catalog->updatePin();
             session_start();
             // any writes to the session storage also closes session. possibly happens in updatePin. plb 4-21-2015
             $_SESSION['profileUpdateErrors'] = $errors;
         }
         session_write_close();
         header("Location: " . $configArray['Site']['path'] . '/MyAccount/Profile');
         exit;
     } elseif (!$configArray['Catalog']['offline']) {
         $interface->assign('edit', true);
     } else {
         $interface->assign('edit', false);
     }
     /*require_once ROOT_DIR . '/Drivers/OverDriveDriverFactory.php';
     		$overDriveDriver = OverDriveDriverFactory::getDriver();
     		if ($overDriveDriver->version >= 2){
     			$lendingPeriods = $overDriveDriver->getLendingPeriods($user);
     			$interface->assign('overDriveLendingOptions', $lendingPeriods);
     		}*/
     $interface->assign('overDriveUrl', $configArray['OverDrive']['url']);
     if (isset($_SESSION['profileUpdateErrors'])) {
         $interface->assign('profileUpdateErrors', $_SESSION['profileUpdateErrors']);
         unset($_SESSION['profileUpdateErrors']);
     }
     //Get the list of locations for display in the user interface.
     $location = new Location();
     $location->validHoldPickupBranch = 1;
     $location->find();
     $locationList = array();
     while ($location->fetch()) {
         $locationList[$location->locationId] = $location->displayName;
     }
     $interface->assign('locationList', $locationList);
     if ($this->catalog->checkFunction('isUserStaff')) {
//.........这里部分代码省略.........
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:101,代码来源:Profile.php

示例12: 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();
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:MillenniumStatusLoader.php

示例13: getHoursAndLocations

 function getHoursAndLocations()
 {
     //Get a list of locations for the current library
     global $library;
     $tmpLocation = new Location();
     $tmpLocation->libraryId = $library->libraryId;
     $tmpLocation->showInLocationsAndHoursList = 1;
     $tmpLocation->orderBy('displayName');
     $libraryLocations = array();
     $tmpLocation->find();
     if ($tmpLocation->N == 0) {
         //Get all locations
         $tmpLocation = new Location();
         $tmpLocation->showInLocationsAndHoursList = 1;
         $tmpLocation->orderBy('displayName');
         $tmpLocation->find();
     }
     while ($tmpLocation->fetch()) {
         $mapAddress = urlencode(preg_replace('/\\r\\n|\\r|\\n/', '+', $tmpLocation->address));
         $clonedLocation = clone $tmpLocation;
         $hours = $clonedLocation->getHours();
         foreach ($hours as $key => $hourObj) {
             if (!$hourObj->closed) {
                 $hourString = $hourObj->open;
                 list($hour, $minutes) = explode(':', $hourString);
                 if ($hour < 12) {
                     $hourObj->open .= ' AM';
                 } elseif ($hour == 12) {
                     $hourObj->open = 'Noon';
                 } elseif ($hour == 24) {
                     $hourObj->open = 'Midnight';
                 } else {
                     $hour -= 12;
                     $hourObj->open = "{$hour}:{$minutes} PM";
                 }
                 $hourString = $hourObj->close;
                 list($hour, $minutes) = explode(':', $hourString);
                 if ($hour < 12) {
                     $hourObj->close .= ' AM';
                 } elseif ($hour == 12) {
                     $hourObj->close = 'Noon';
                 } elseif ($hour == 24) {
                     $hourObj->close = 'Midnight';
                 } else {
                     $hour -= 12;
                     $hourObj->close = "{$hour}:{$minutes} PM";
                 }
             }
             $hours[$key] = $hourObj;
         }
         $libraryLocations[] = array('id' => $tmpLocation->locationId, 'name' => $tmpLocation->displayName, 'address' => preg_replace('/\\r\\n|\\r|\\n/', '<br/>', $tmpLocation->address), 'phone' => $tmpLocation->phone, 'map_image' => "http://maps.googleapis.com/maps/api/staticmap?center={$mapAddress}&zoom=15&size=200x200&sensor=false&markers=color:red%7C{$mapAddress}", 'map_link' => "http://maps.google.com/maps?f=q&hl=en&geocode=&q={$mapAddress}&ie=UTF8&z=15&iwloc=addr&om=1&t=m", 'hours' => $hours);
     }
     global $interface;
     $interface->assign('libraryLocations', $libraryLocations);
     return $interface->fetch('AJAX/libraryHoursAndLocations.tpl');
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:56,代码来源:JSON.php

示例14: 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("&nbsp;", " ", $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 {
//.........这里部分代码省略.........
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:101,代码来源:MillenniumHolds.php

示例15: 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("&nbsp;", " ", $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 != "&nbsp") {
                             $curHold['status'] = $status;
                             if (preg_match('/READY.*(\\d{2}-\\d{2}-\\d{2})/i', $status, $matches)) {
                                 $curHold['status'] = 'Ready';
                                 //Get expiration date
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:MillenniumHolds.php


注:本文中的Location::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。