Ejemplo n.º 1
0
 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;
     }
 }