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; }
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; }
function getAllObjects() { $libraryList = array(); global $user; if ($user->hasRole('opacAdmin')) { $library = new Library(); $library->orderBy('subdomain'); $library->find(); while ($library->fetch()) { $libraryList[$library->libraryId] = clone $library; } } else { if ($user->hasRole('libraryAdmin')) { $patronLibrary = Library::getLibraryForLocation($user->homeLocationId); $libraryList[$patronLibrary->libraryId] = clone $patronLibrary; } } return $libraryList; }
static function getObjectStructure() { global $configArray; //Load Libraries for lookup values $library = new Library(); $library->orderBy('displayName'); $library->find(); $libraryList = array(); $libraryList[-1] = "All Libraries"; while ($library->fetch()) { $libraryList[$library->libraryId] = $library->displayName; } $structure = array('id' => array('property' => 'id', 'type' => 'hidden', 'label' => 'Id', 'primaryKey' => true, 'description' => 'The unique id of the e-pub file.'), 'item_type' => array('property' => 'item_type', 'type' => 'enum', 'label' => 'Type', 'values' => EContentItem::getValidItemTypes(), 'description' => 'The type of file being added', 'required' => true, 'storeDb' => true, 'storeSolr' => false), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'label' => 'For use by', 'values' => $libraryList, 'description' => 'The library system that has access to the link', 'required' => true, 'storeDb' => true, 'storeSolr' => false), 'link' => array('property' => 'link', 'type' => 'text', 'label' => 'External Link', 'size' => 100, 'maxLength' => 255, 'description' => 'A link to an external website or document.', 'required' => false, 'storeDb' => true, 'storeSolr' => false), 'filename' => array('property' => 'filename', 'type' => 'file', 'label' => 'Source File', 'path' => $configArray['EContent']['library'], 'description' => 'The source file for display or download within VuFind.', 'serverValidation' => 'validateEpub', 'required' => false, 'storeDb' => true, 'storeSolr' => false), 'folder' => array('property' => 'folder', 'type' => 'folder', 'size' => 100, 'maxLength' => 100, 'label' => 'Folder of MP3 Files (must exist already)', 'path' => $configArray['EContent']['library'], 'description' => 'The directory containing the MP3 files. Must already exist on the econtent server.', 'serverValidation' => 'validateEpub', 'required' => false, 'storeDb' => true, 'storeSolr' => false), 'acsId' => array('property' => 'acsId', 'type' => 'hidden', 'label' => 'ACS ID', 'description' => 'The ID of the title within the Adobe Content Server.', 'storeDb' => true, 'storeSolr' => false), 'recordId' => array('property' => 'recordId', 'type' => 'hidden', 'label' => 'Record ID', 'description' => 'The ID of the record this item is attached to.', 'storeDb' => true, 'storeSolr' => false), 'notes' => array('property' => 'notes', 'type' => 'text', 'label' => 'Notes', 'description' => 'Notes to the patron to be displayed in the catalog.', 'storeDb' => true, 'storeSolr' => false), 'reviewStatus' => array('property' => 'reviewStatus', 'type' => 'enum', 'values' => array('Not Reviewed' => 'Not Reviewed', 'Approved' => 'Approved', 'Rejected' => 'Rejected'), 'label' => 'Review Status', 'description' => 'The status of the review of the item.', 'storeDb' => true, 'storeSolr' => false, 'default' => 'Not Reviewed'), 'reviewNotes' => array('property' => 'reviewNotes', 'type' => 'textarea', 'label' => 'Review Notes', 'description' => 'Notes relating to the reivew.', 'storeDb' => true, 'storeSolr' => false), 'size' => array('property' => 'size', 'type' => 'label', 'label' => 'Size', 'description' => 'The size of the item in bytes or 0 if not known.', 'storeDb' => false, 'storeSolr' => false), 'externalFormat' => array('property' => 'externalFormat', 'type' => 'label', 'label' => 'External Format', 'description' => 'The textual format for external items for use with OverDrive.', 'storeDb' => false, 'storeSolr' => false), 'externalFormatId' => array('property' => 'externalFormatId', 'type' => 'hidden', 'label' => 'External Format Id', 'description' => 'The internal format for external items for use with OverDrive.', 'storeDb' => false, 'storeSolr' => false), 'externalFormatNumeric' => array('property' => 'externalFormatNumeric', 'type' => 'hidden', 'label' => 'External Format Id', 'description' => 'The numeric format for external items for use with OverDrive.', 'storeDb' => false, 'storeSolr' => false), 'identifier' => array('property' => 'identifier', 'type' => 'label', 'label' => 'Identifier (ISBN/ASIN)', 'description' => 'The Identifier (ISBN/ASIN) for the item if we can split from record.', 'storeDb' => false, 'storeSolr' => false), 'sample' => array('property' => 'sample', 'type' => 'label', 'label' => 'Sample', 'description' => 'A url to get a sample of the title.', 'storeDb' => false, 'storeSolr' => false)); foreach ($structure as $fieldName => $field) { $field['propertyOld'] = $field['property'] . 'Old'; $structure[$fieldName] = $field; } return $structure; }
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; }
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; }
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; }
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; }
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; }
function getObjectStructure() { global $user; //Load Libraries for lookup values $libraryList = array(); if ($user->hasRole('opacAdmin')) { $library = new Library(); $library->orderBy('displayName'); $library->find(); $libraryList[-1] = 'All Libraries'; while ($library->fetch()) { $libraryList[$library->libraryId] = $library->displayName; } } elseif ($user->hasRole('libraryAdmin') || $user->hasRole('contentEditor')) { $homeLibrary = Library::getPatronHomeLibrary(); $libraryList[$homeLibrary->libraryId] = $homeLibrary->displayName; } $structure = array('id' => array('property' => 'id', 'type' => 'hidden', 'label' => 'Id', 'description' => 'The unique id of the list widget file.', 'primaryKey' => true, 'storeDb' => true), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'name' => array('property' => 'name', 'type' => 'text', 'label' => 'Name', 'description' => 'The name of the widget.', 'maxLength' => 255, 'size' => 100, 'serverValidation' => 'validateName', 'storeDb' => true), 'description' => array('property' => 'description', 'type' => 'textarea', 'rows' => 3, 'cols' => 80, 'label' => 'Description', 'description' => 'A description for the widget', 'storeDb' => true, 'hideInLists' => true), 'showTitle' => array('property' => 'showTitle', 'type' => 'checkbox', 'label' => 'Should the title for the currently selected title be shown?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'showAuthor' => array('property' => 'showAuthor', 'type' => 'checkbox', 'label' => 'Should the author for the currently selected title be shown?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'showRatings' => array('property' => 'showRatings', 'type' => 'checkbox', 'label' => 'Should ratings widgets be shown under each cover?', 'storeDb' => true, 'default' => false, 'hideInLists' => true), 'style' => array('property' => 'style', 'type' => 'enum', 'label' => 'The style to use when displaying the list widget', 'values' => $this->styles, 'storeDb' => true, 'default' => 'horizontal', 'hideInLists' => true), 'autoRotate' => array('property' => 'autoRotate', 'type' => 'checkbox', 'label' => 'Should the widget automatically rotate between titles?', 'storeDb' => true, 'hideInLists' => true), 'coverSize' => array('property' => 'coverSize', 'type' => 'enum', 'label' => 'The cover size to use when showing a widget', 'values' => array('small' => 'Small', 'medium' => 'Medium'), 'storeDb' => true, 'default' => 'small', 'hideInLists' => true), 'customCss' => array('property' => 'customCss', 'type' => 'url', 'label' => 'Custom CSS File', 'maxLength' => 255, 'size' => 100, 'description' => 'The URL to an external css file to be included when rendering as an iFrame.', 'storeDb' => true, 'required' => false, 'hideInLists' => true), 'listDisplayType' => array('property' => 'listDisplayType', 'type' => 'enum', 'values' => $this->displayTypes, 'label' => 'Display lists as', 'description' => 'The method used to show the user the multiple lists associated with the widget.', 'storeDb' => true, 'hideInLists' => true), 'showListWidgetTitle' => array('property' => 'showListWidgetTitle', 'type' => 'checkbox', 'label' => 'Show the list widget\'s title bar', 'description' => 'Whether or not the widget\'s title bar is shown. (Enabling the Show More Link will force the title bar to be shown as well.)', 'storeDb' => true, 'hideInLists' => true, 'default' => true), 'showViewMoreLink' => array('property' => 'showViewMoreLink', 'type' => 'checkbox', 'label' => 'Show the View More link on the title bar of the widget.', 'storeDb' => true, 'hideInLists' => true, 'default' => false), 'viewMoreLinkMode' => array('property' => 'viewMoreLinkMode', 'type' => 'enum', 'values' => array('list' => 'List', 'covers' => 'Covers'), 'label' => 'Display mode for search results link', 'description' => 'The mode to show full search results in when the View More link is clicked.', 'storeDb' => true, 'hideInLists' => true), 'lists' => array('property' => 'lists', 'type' => 'oneToMany', 'keyThis' => 'id', 'keyOther' => 'listWidgetId', 'subObjectType' => 'ListWidgetList', 'structure' => ListWidgetList::getObjectStructure(), 'label' => 'Lists', 'description' => 'The lists to be displayed within the widget.', 'sortable' => true, 'storeDb' => true, 'serverValidation' => 'validateLists', 'editLink' => 'ListWidgetsListsLinks', 'hideInLists' => true)); foreach ($structure as $fieldName => $field) { $field['propertyOld'] = $field['property'] . 'Old'; $structure[$fieldName] = $field; } return $structure; }
function getObjectStructure() { global $user; //Load Libraries for lookup values $libraryList = array(); if ($user->hasRole('opacAdmin')) { $library = new Library(); $library->orderBy('displayName'); $library->find(); $libraryList[-1] = 'All Libraries'; while ($library->fetch()) { $libraryList[$library->libraryId] = $library->displayName; } } elseif ($user->hasRole('libraryAdmin') || $user->hasRole('contentEditor')) { $homeLibrary = Library::getPatronHomeLibrary(); $libraryList[$homeLibrary->libraryId] = $homeLibrary->displayName; } $structure = array('id' => array('property' => 'id', 'type' => 'hidden', 'label' => 'Id', 'description' => 'The unique id of the list widget file.', 'primaryKey' => true, 'storeDb' => true), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'name' => array('property' => 'name', 'type' => 'text', 'label' => 'Name', 'description' => 'The name of the widget.', 'maxLength' => 255, 'size' => 100, 'serverValidation' => 'validateName', 'storeDb' => true), 'description' => array('property' => 'description', 'type' => 'textarea', 'rows' => 3, 'cols' => 80, 'label' => 'Description', 'description' => 'A description for the widget', 'storeDb' => true, 'hideInLists' => true), 'showTitleDescriptions' => array('property' => 'showTitleDescriptions', 'type' => 'checkbox', 'label' => 'Should the description pop-up be shown when hovering over titles?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'showMultipleTitles' => array('property' => 'showMultipleTitles', 'type' => 'checkbox', 'label' => 'Should multiple titles by shown in in the widget or should only one title be shown at a time?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'style' => array('property' => 'style', 'type' => 'enum', 'label' => 'The style to use when displaying the list widget', 'values' => array('horizontal' => 'Horizontal', 'vertical' => 'Vertical', 'single' => 'Single Title'), 'storeDb' => true, 'default' => 'horizontal', 'hideInLists' => true), 'autoRotate' => array('property' => 'autoRotate', 'type' => 'checkbox', 'label' => 'Should the widget automatically rotate between titles?', 'storeDb' => true, 'hideInLists' => true), 'onSelectCallback' => array('property' => 'onSelectCallback', 'type' => 'text', 'label' => 'On Select Callback', 'description' => 'A javascript callback to invoke when a title is selected to override the default behavior.', 'storeDb' => true, 'hideInLists' => true), 'customCss' => array('property' => 'customCss', 'type' => 'url', 'label' => 'Custom CSS File', 'maxLength' => 255, 'size' => 100, 'description' => 'The URL to an external css file to be included when rendering as an iFrame.', 'storeDb' => true, 'required' => false, 'hideInLists' => true), 'listDisplayType' => array('property' => 'listDisplayType', 'type' => 'enum', 'values' => array('tabs' => 'Tabbed Display', 'dropdown' => 'Drop Down List'), 'label' => 'Display lists as', 'description' => 'The URL to an external css file to be included wen rendering as an iFrame.', 'storeDb' => true, 'hideInLists' => true), 'lists' => array('property' => 'lists', 'type' => 'oneToMany', 'keyThis' => 'id', 'keyOther' => 'listWidgetId', 'subObjectType' => 'ListWidgetList', 'structure' => ListWidgetList::getObjectStructure(), 'label' => 'Lists', 'description' => 'The lists to be displayed within the widget.', 'sortable' => true, 'storeDb' => true, 'serverValidation' => 'validateLists', 'editLink' => 'ListWidgetsListsLinks', 'hideInLists' => true)); foreach ($structure as $fieldName => $field) { $field['propertyOld'] = $field['property'] . 'Old'; $structure[$fieldName] = $field; } return $structure; }
set_time_limit(300); mysql_query('set @r=0; UPDATE title_browse SET alphaRank = @r:=(@r + 1) ORDER BY `sortValue`;'); $logger->log('Updated Alpha Rank for Title browse index', PEAR_LOG_INFO); mysql_query('TRUNCATE title_browse_metadata;'); mysql_query('INSERT INTO title_browse_metadata (SELECT 0, -1, MIN(alphaRank) as minAlphaRank, MAX(alphaRank) as maxAlphaRank, count(id) as numResults FROM title_browse inner join title_browse_scoped_results_global ON id = browseValueId where alphaRank > 0)'); echo "<br>Built Title browse index\r\n"; $logger->log('Built Title browse index', PEAR_LOG_INFO); ob_flush(); set_time_limit(300); mysql_query('set @r=0; UPDATE subject_browse SET alphaRank = @r:=(@r + 1) ORDER BY `sortValue`;'); $logger->log('Updated Alpha Rank for Subject browse index', PEAR_LOG_INFO); mysql_query('TRUNCATE subject_browse_metadata;'); mysql_query('INSERT INTO subject_browse_metadata (SELECT 0, -1, MIN(alphaRank) as minAlphaRank, MAX(alphaRank) as maxAlphaRank, count(id) as numResults FROM subject_browse inner join subject_browse_scoped_results_global ON id = browseValueId where alphaRank > 0)'); echo "<br>Built Subject browse index\r\n"; $logger->log('Built Subject browse index', PEAR_LOG_INFO); ob_flush(); set_time_limit(300); mysql_query('set @r=0; UPDATE callnumber_browse SET alphaRank = @r:=(@r + 1) ORDER BY `sortValue`;'); $logger->log('Updated Alpha Rank for Call number browse index', PEAR_LOG_INFO); mysql_query('TRUNCATE callnumber_browse_metadata;'); mysql_query('INSERT INTO callnumber_browse_metadata (SELECT 0, -1, MIN(alphaRank) as minAlphaRank, MAX(alphaRank) as maxAlphaRank, count(id) as numResults FROM callnumber_browse inner join callnumber_browse_scoped_results_global ON id = browseValueId where alphaRank > 0)'); echo "<br>Built Call Number browse index\r\n"; $logger->log('Built Call Number browse index', PEAR_LOG_INFO); ob_flush(); while ($library->fetch()) { mysql_query("INSERT INTO title_browse_metadata (SELECT 1, {$library->libraryId}, MIN(alphaRank) as minAlphaRank, MAX(alphaRank) as maxAlphaRank, count(id) as numResults FROM title_browse inner join title_browse_scoped_results_library_{$library->subdomain} ON id = browseValueId where alphaRank > 0)"); mysql_query("INSERT INTO author_browse_metadata (SELECT 1, {$library->libraryId}, MIN(alphaRank) as minAlphaRank, MAX(alphaRank) as maxAlphaRank, count(id) as numResults FROM author_browse inner join author_browse_scoped_results_library_{$library->subdomain} ON id = browseValueId where alphaRank > 0)"); mysql_query("INSERT INTO subject_browse_metadata (SELECT 1, {$library->libraryId}, MIN(alphaRank) as minAlphaRank, MAX(alphaRank) as maxAlphaRank, count(id) as numResults FROM subject_browse inner join subject_browse_scoped_results_library_{$library->subdomain} ON id = browseValueId where alphaRank > 0)"); mysql_query("INSERT INTO callnumber_browse_metadata (SELECT 1, {$library->libraryId}, MIN(alphaRank) as minAlphaRank, MAX(alphaRank) as maxAlphaRank, count(id) as numResults FROM callnumber_browse inner join callnumber_browse_scoped_results_library_{$library->subdomain} ON id = browseValueId where alphaRank > 0)"); echo "<br>Built meta data for {$library->displayName}\r\n"; }
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'); }
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; }
static function getLibraryForLocation($locationId) { if (isset($locationId)) { $libLookup = new Library(); require_once ROOT_DIR . '/Drivers/marmot_inc/Location.php'; $libLookup->whereAdd('libraryId = (SELECT libraryId FROM location WHERE locationId = ' . $libLookup->escape($locationId) . ')'); $libLookup->find(); if ($libLookup->N > 0) { $libLookup->fetch(); return clone $libLookup; } } return null; }
/** * 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; }
function getPickupBranches($patronProfile, $selectedBranchId) { //Get the library for the patron's home branch. /** @var Library $librarySingleton */ global $librarySingleton; if ($patronProfile) { if (is_object($patronProfile)) { $patronProfile = get_object_vars($patronProfile); } } $homeLibrary = $librarySingleton->getLibraryForLocation($patronProfile['homeLocationId']); if (isset($homeLibrary) && $homeLibrary->inSystemPickupsOnly == 1) { if (strlen($homeLibrary->validPickupSystems) > 0) { $pickupIds = array(); $pickupIds[] = $homeLibrary->libraryId; $validPickupSystems = explode('|', $homeLibrary->validPickupSystems); foreach ($validPickupSystems as $pickupSystem) { $pickupLocation = new Library(); $pickupLocation->subdomain = $pickupSystem; $pickupLocation->find(); if ($pickupLocation->N == 1) { $pickupLocation->fetch(); $pickupIds[] = $pickupLocation->libraryId; } } $this->whereAdd("libraryId IN (" . implode(',', $pickupIds) . ")", 'AND'); //Deal with Steamboat Springs Juvenile which is a special case. $this->whereAdd("code <> 'ssjuv'", 'AND'); } else { $this->whereAdd("libraryId = {$homeLibrary->libraryId}", 'AND'); $this->whereAdd("validHoldPickupBranch = 1", 'AND'); //$this->whereAdd("locationId = {$patronProfile['homeLocationId']}", 'OR'); } } else { $this->whereAdd("validHoldPickupBranch = 1"); } /*if (isset($selectedBranchId) && is_numeric($selectedBranchId)){ $this->whereAdd("locationId = $selectedBranchId", 'OR'); }*/ $this->orderBy('displayName'); $this->find(); //Load the locations and sort them based on the user profile information as well as their physical location. $physicalLocation = $this->getPhysicalLocation(); $locationList = array(); while ($this->fetch()) { if ($this->locationId == $selectedBranchId) { $selected = 'selected'; } else { $selected = ''; } $this->selected = $selected; if (isset($physicalLocation) && $physicalLocation->locationId == $this->locationId) { //If the user is in a branch, those holdings come first. $locationList['1' . $this->displayName] = clone $this; } else { if ($this->locationId == $patronProfile['homeLocationId']) { //Next come the user's home branch if the user is logged in or has the home_branch cookie set. $locationList['2' . $this->displayName] = clone $this; } else { if (isset($patronProfile['myLocation1Id']) && $this->locationId == $patronProfile['myLocation1Id']) { //Next come nearby locations for the user $locationList['3' . $this->displayName] = clone $this; } else { if (isset($patronProfile['myLocation2Id']) && $this->locationId == $patronProfile['myLocation2Id']) { //Next come nearby locations for the user $locationList['4' . $this->displayName] = clone $this; } else { if (isset($homeLibrary) && $this->libraryId == $homeLibrary->libraryId) { //Other locations that are within the same library system $locationList['5' . $this->displayName] = clone $this; } else { //Finally, all other locations are shown sorted alphabetically. $locationList['6' . $this->displayName] = clone $this; } } } } } } ksort($locationList); return $locationList; }
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); } //Check to see if Gold Rush is a valid option if (isset($library) && strlen($library->goldRushCode) > 0 && !$interface->isMobile()) { $searchOptions['goldrush'] = array('name' => 'Gold Rush Magazine Finder', 'description' => 'A catalog of online journals and full text articles.', 'external' => true); } if ($repeatInAmazon && !$interface->isMobile()) { $searchOptions['amazon'] = array('name' => 'Amazon', 'description' => 'Online retailer selling a wide variety of books, movies, music, and more.', 'external' => true); } return $searchOptions; }
function removeScopingTableIndex(&$update) { $this->runSQLStatement($update, "TRUNCATE TABLE title_browse_scoped_results_global"); $this->runSQLStatement($update, "ALTER TABLE `title_browse_scoped_results_global` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `title_browse_scoped_results_global` ENGINE = MYISAM"); $this->runSQLStatement($update, "TRUNCATE TABLE author_browse_scoped_results_global"); $this->runSQLStatement($update, "ALTER TABLE `author_browse_scoped_results_global` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `author_browse_scoped_results_global` ENGINE = MYISAM"); $this->runSQLStatement($update, "TRUNCATE TABLE subject_browse_scoped_results_global"); $this->runSQLStatement($update, "ALTER TABLE `subject_browse_scoped_results_global` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `subject_browse_scoped_results_global` ENGINE = MYISAM"); $this->runSQLStatement($update, "TRUNCATE TABLE callnumber_browse_scoped_results_global"); $this->runSQLStatement($update, "ALTER TABLE `callnumber_browse_scoped_results_global` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `callnumber_browse_scoped_results_global` ENGINE = MYISAM"); $library = new Library(); $library->find(); while ($library->fetch()) { $this->runSQLStatement($update, "TRUNCATE TABLE `title_browse_scoped_results_library_{$library->subdomain}`"); $this->runSQLStatement($update, "ALTER TABLE `title_browse_scoped_results_library_{$library->subdomain}` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `title_browse_scoped_results_library_{$library->subdomain}` ENGINE = MYISAM"); $this->runSQLStatement($update, "TRUNCATE TABLE `author_browse_scoped_results_library_{$library->subdomain}`"); $this->runSQLStatement($update, "ALTER TABLE `author_browse_scoped_results_library_{$library->subdomain}` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `author_browse_scoped_results_library_{$library->subdomain}` ENGINE = MYISAM"); $this->runSQLStatement($update, "TRUNCATE TABLE `subject_browse_scoped_results_library_{$library->subdomain}`"); $this->runSQLStatement($update, "ALTER TABLE `subject_browse_scoped_results_library_{$library->subdomain}` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `subject_browse_scoped_results_library_{$library->subdomain}` ENGINE = MYISAM"); $this->runSQLStatement($update, "TRUNCATE TABLE `callnumber_browse_scoped_results_library_{$library->subdomain}`"); $this->runSQLStatement($update, "ALTER TABLE `callnumber_browse_scoped_results_library_{$library->subdomain}` DROP INDEX `record`"); $this->runSQLStatement($update, "ALTER TABLE `callnumber_browse_scoped_results_library_{$library->subdomain}` ENGINE = MYISAM"); } }
/** * Retrieve details about a record within prospector * * @param $record - The full record information from Prospector * @return Associative array with the record number in prospector and the list of libraries that own the title in prospector */ function getProspectorDetailsForLocalRecord($record) { //Disable prospector details for now. return false; global $logger; //Check to see if one of our libraries has a copy in Prospector. $shortId = substr($record['id'], 1, -1); $library = new Library(); $institutions = ''; foreach ($record['institution'] as $institution) { if (strlen($institutions) > 0) { $institutions .= ', '; } $institutions .= "'" . mysql_escape_string($institution) . "'"; } $library->whereAdd("facetLabel IN ({$institutions})"); $library->whereAdd("prospectorCode != ''"); $library->find(); $results = array('recordId' => '', 'title' => $record['title'], 'author' => isset($record['author']) ? $record['author'] : null, 'numLibraries' => 0, 'owningLibraries' => array(), 'prospectorClassicUrl' => '', 'prospectorEncoreUrl' => ''); if ($library->N > 0) { while ($library->fetch()) { $prospectorCode = $library->prospectorCode; //Call the url for the record using a local call number search $curl_url = "http://prospector.coalliance.org/search~S0?/z{$prospectorCode}+{$shortId}/z{$prospectorCode}+{$shortId}/1,1,1,B/detlframeset&FF=z{$prospectorCode}+{$shortId}"; $cookieJar = tempnam("/tmp", "CURLCOOKIE"); $logger->log('Loading page ' . $curl_url, PEAR_LOG_INFO); $curl_connection = curl_init($curl_url); curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl_connection, CURLOPT_UNRESTRICTED_AUTH, true); curl_setopt($curl_connection, CURLOPT_COOKIEJAR, $cookieJar); curl_setopt($curl_connection, CURLOPT_COOKIESESSION, false); $sresult = curl_exec($curl_connection); //We are getting bad results from Prospector from some local call number searches if (preg_match('/Prehistoric Europe, from stone age man to the early Greeks/', $sresult)) { continue; } //Parse the page to extract the owning libraries and the record id //Record Id can be extracted from the save link if (preg_match('/save=(.*?)"/s', $sresult, $matches)) { $results['recordId'] = $matches[1]; } //Owning libraries can be extracted with this regex $libraries = array(); if (preg_match_all('/<tr class="holdings(.*?)"><td><a name="(.*?)"><\\/a>(.*?)<\\/td>/s', $sresult, $matches)) { foreach ($matches[1] as $index => $libraryCode) { $libraries[$libraryCode] = $matches[3][$index]; } } else { $fineInfo = ""; } $results['numLibraries'] = count($libraries); $results['owningLibraries'] = $libraries; $prospectorUrl = "http://prospector.coalliance.org/search~S0/.{$results['recordId']}/.{$results['recordId']}/1,1,1,B/frameset~.{$results['recordId']}"; $results['prospectorClassicUrl'] = $prospectorUrl; $prospectorUrl = "http://encore.coalliance.org/iii/encore/record/C__R" . urlencode($results['recordId']) . "?lang=eng&suite=def"; $results['prospectorEncoreUrl'] = $prospectorUrl; $requestUrl = "http://encore.coalliance.org/iii/encore/InnreachRequestPage.external?lang=eng&sp=S" . urlencode($results['recordId']) . "&suite=def"; $results['requestUrl'] = $requestUrl; break; } } return $results; }