本文整理汇总了PHP中Library::getPatronHomeLibrary方法的典型用法代码示例。如果您正苦于以下问题:PHP Library::getPatronHomeLibrary方法的具体用法?PHP Library::getPatronHomeLibrary怎么用?PHP Library::getPatronHomeLibrary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library::getPatronHomeLibrary方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CancelRequest
function CancelRequest()
{
global $user;
if (!$user) {
return array('success' => false, 'error' => 'Could not cancel the request, you must be logged in to cancel the request.');
} elseif (!isset($_REQUEST['id'])) {
return array('success' => false, 'error' => 'Could not cancel the request, no id provided.');
} else {
$id = $_REQUEST['id'];
$materialsRequest = new MaterialsRequest();
$materialsRequest->id = $id;
$materialsRequest->createdBy = $user->id;
if ($materialsRequest->find(true)) {
//get the correct status to set based on the user's home library
$homeLibrary = Library::getPatronHomeLibrary();
$cancelledStatus = new MaterialsRequestStatus();
$cancelledStatus->isPatronCancel = 1;
$cancelledStatus->libraryId = $homeLibrary->libraryId;
$cancelledStatus->find(true);
$materialsRequest->dateUpdated = time();
$materialsRequest->status = $cancelledStatus->id;
if ($materialsRequest->update()) {
return array('success' => true);
} else {
return array('success' => false, 'error' => 'Could not cancel the request, error during update.');
}
} else {
return array('success' => false, 'error' => 'Could not cancel the request, could not find a request for the provided id.');
}
}
}
示例2: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
require_once ROOT_DIR . '/sys/Browse/BrowseCategory.php';
$browseCategories = new BrowseCategory();
$browseCategories->orderBy('label');
$browseCategories->find();
$browseCategoryList = array();
while ($browseCategories->fetch()) {
$browseCategoryList[$browseCategories->textId] = $browseCategories->label . " ({$browseCategories->textId})";
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'browseCategoryTextId' => array('property' => 'browseCategoryTextId', 'type' => 'enum', 'values' => $browseCategoryList, 'label' => 'Browse Category', 'description' => 'The browse category to display '), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例3: isValidForUser
function isValidForUser($locationCode, $eContentFieldData)
{
$sharing = $this->getSharing($locationCode, $eContentFieldData);
if ($sharing == 'shared') {
return true;
} else {
if ($sharing == 'library') {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary == null || strlen($searchLibrary->ilsCode) > 0 && strpos($locationCode, $searchLibrary->ilsCode) === 0) {
global $user;
if ($user) {
$patronHomeLibrary = Library::getPatronHomeLibrary();
return $patronHomeLibrary == null || strlen($patronHomeLibrary->ilsCode) > 0 && strpos($locationCode, $patronHomeLibrary->ilsCode) === 0;
} else {
return true;
}
} else {
return false;
}
} else {
//Just share with the specific location
$searchLocation = Location::getSearchLocation();
if (!$searchLocation) {
return true;
} elseif (strpos($locationCode, $searchLocation->code) === 0) {
return true;
} else {
return false;
}
}
}
}
示例4: launch
function launch()
{
global $configArray;
global $interface;
global $user;
$source = $_REQUEST['source'];
$sourceId = $_REQUEST['id'];
$existingWidget = isset($_REQUEST['widgetId']) ? $_REQUEST['widgetId'] : -1;
$widgetName = isset($_REQUEST['widgetName']) ? $_REQUEST['widgetName'] : '';
if ($existingWidget == -1) {
$widget = new ListWidget();
$widget->name = $widgetName;
if ($user->hasRole('libraryAdmin') || $user->hasRole('contentEditor')) {
//Get all widgets for the library
$userLibrary = Library::getPatronHomeLibrary();
$widget->libraryId = $userLibrary->libraryId;
} else {
$widget->libraryId = -1;
}
$widget->customCss = '';
$widget->autoRotate = 0;
$widget->description = '';
$widget->showTitleDescriptions = 1;
$widget->onSelectCallback = '';
$widget->fullListLink = '';
$widget->listDisplayType = 'tabs';
$widget->showMultipleTitles = 1;
$widget->insert();
} else {
$widget = new ListWidget();
$widget->id = $existingWidget;
$widget->find(true);
}
//Make sure to save the search
if ($source == 'search') {
$searchObject = new SearchEntry();
$searchObject->id = $sourceId;
$searchObject->find(true);
$searchObject->saved = 1;
$searchObject->update();
}
//Add the list to the widget
$widgetList = new ListWidgetList();
$widgetList->listWidgetId = $widget->id;
$widgetList->displayFor = 'all';
$widgetList->source = "{$source}:{$sourceId}";
$widgetList->name = $widgetName;
$widgetList->weight = 0;
$widgetList->insert();
//Redirect to the widget
header("Location: {$path}/Admin/ListWidgets?objectAction=view&id={$widget->id}");
}
示例5: launch
function launch()
{
global $interface;
global $configArray;
global $user;
global $analytics;
$interface->setPageTitle('eContent Support');
if (isset($_REQUEST['submit'])) {
//E-mail the library with details of the support request
require_once ROOT_DIR . '/sys/Mailer.php';
$mail = new VuFindMailer();
$userLibrary = Library::getPatronHomeLibrary();
if ($userLibrary == null) {
$to = $configArray['Site']['email'];
} else {
$to = $userLibrary->eContentSupportAddress;
}
$name = $_REQUEST['name'];
$interface->assign('bookAuthor', $_REQUEST['bookAuthor']);
$interface->assign('device', $_REQUEST['device']);
$interface->assign('format', $_REQUEST['format']);
$interface->assign('operatingSystem', $_REQUEST['operatingSystem']);
$interface->assign('problem', $_REQUEST['problem']);
$subject = 'eContent Support Request from ' . $name;
$from = $_REQUEST['email'];
$body = $interface->fetch('Help/eContentSupportEmail.tpl');
if ($mail->send($to, $configArray['Site']['email'], $subject, $body, $from)) {
$analytics->addEvent("Emails", "eContent Support Succeeded", $_REQUEST['device'], $_REQUEST['format'], $_REQUEST['operatingSystem']);
echo json_encode(array('title' => "Support Request Sent", 'message' => "<p>Your request was sent to our support team. We will respond to your request as quickly as possible.</p><p>Thank you for using the catalog.</p>"));
} else {
$analytics->addEvent("Emails", "eContent Support Failed", $_REQUEST['device'], $_REQUEST['format'], $_REQUEST['operatingSystem']);
echo json_encode(array('title' => "Support Request Not Sent", 'message' => "<p>We're sorry, but your request could not be submitted to our support team at this time.</p><p>Please try again later.</p>"));
}
} else {
if (isset($_REQUEST['lightbox'])) {
$interface->assign('lightbox', true);
if ($user) {
$interface->assign('name', $user->cat_username);
$interface->assign('email', $user->email);
}
$result = array('title' => 'eContent Support', 'modalBody' => $interface->fetch('Help/eContentSupport.tpl'), 'modalButtons' => "<button class='btn btn-sm btn-primary' onclick='return VuFind.EContent.submitHelpForm();'>Submit</button>");
echo json_encode($result);
} else {
$interface->assign('lightbox', false);
$interface->setTemplate('eContentSupport.tpl');
$interface->assign('sidebar', 'Search/home-sidebar.tpl');
$interface->display('layout.tpl');
}
}
}
示例6: launch
function launch()
{
global $interface;
global $configArray;
global $user;
global $analytics;
$interface->setPageTitle('eContent Support');
if (isset($_REQUEST['submit'])) {
//E-mail the library with details of the support request
require_once ROOT_DIR . '/sys/Mailer.php';
$mail = new VuFindMailer();
$userLibrary = Library::getPatronHomeLibrary();
if ($userLibrary == null) {
$to = $configArray['Site']['email'];
} else {
$to = $userLibrary->eContentSupportAddress;
}
$name = $_REQUEST['name'];
$interface->assign('bookAuthor', $_REQUEST['bookAuthor']);
$interface->assign('device', $_REQUEST['device']);
$interface->assign('format', $_REQUEST['format']);
$interface->assign('operatingSystem', $_REQUEST['operatingSystem']);
$interface->assign('problem', $_REQUEST['problem']);
$subject = 'eContent Support Request from ' . $name;
$from = $_REQUEST['email'];
$body = $interface->fetch('Help/eContentSupportEmail.tpl');
if ($mail->send($to, $configArray['Site']['email'], $subject, $body, $from)) {
$analytics->addEvent("Emails", "eContent Support Succeeded", $_REQUEST['device'], $_REQUEST['format'], $_REQUEST['operatingSystem']);
echo "<p>Your request was sent to our support team. We will respond to your request as quickly as possible.</p><p>Thank you for using the catalog.</p><input type='button' onclick='hideLightbox()' value='Close'/>";
} else {
$analytics->addEvent("Emails", "eContent Support Failed", $_REQUEST['device'], $_REQUEST['format'], $_REQUEST['operatingSystem']);
echo "<p>We're sorry, but your request could not be submitted to our support team at this time.</p><p>Please try again later.</p><input type='button' onclick='hideLightbox()' value='Close' />";
}
} else {
if (isset($_REQUEST['lightbox'])) {
if ($user) {
$interface->assign('name', $user->cat_username);
$interface->assign('email', $user->email);
}
$interface->assign('popupTitle', 'eContent Support');
$popupContent = $interface->fetch('Help/eContentSupport.tpl');
$interface->assign('popupContent', $popupContent);
$interface->display('popup-wrapper.tpl');
} else {
$interface->setTemplate('eContentSupport.tpl');
$interface->display('layout.tpl');
}
}
}
示例7: getObjectStructure
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;
}
//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;
}
// get the structure for the location's hours
$hoursStructure = LocationHours::getObjectStructure();
// we don't want to make the locationId property editable
// because it is associated with this location only
unset($hoursStructure['locationId']);
$facetSettingStructure = LocationFacetSetting::getObjectStructure();
unset($facetSettingStructure['weight']);
unset($facetSettingStructure['locationId']);
unset($facetSettingStructure['numEntriesToShowByDefault']);
unset($facetSettingStructure['showAsDropDown']);
//unset($facetSettingStructure['sortMode']);
$structure = array(array('property' => 'code', 'type' => 'text', 'label' => 'Code', 'description' => 'The code for use when communicating with Millennium'), array('property' => 'displayName', 'type' => 'text', 'label' => 'Display Name', 'description' => 'The full name of the location for display to the user', 'size' => '40'), array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), array('property' => 'extraLocationCodesToInclude', 'type' => 'text', 'label' => 'Extra Locations To Include', 'description' => 'A list of other location codes to include in this location for indexing special collections, juvenile collections, etc.', 'size' => '40', 'hideInLists' => true), array('property' => 'nearbyLocation1', 'type' => 'enum', 'values' => $locationLookupList, 'label' => 'Nearby Location 1', 'description' => 'A secondary location which is nearby and could be used for pickup of materials.', 'hideInLists' => true), array('property' => 'nearbyLocation2', 'type' => 'enum', 'values' => $locationLookupList, 'label' => 'Nearby Location 2', 'description' => 'A tertiary location which is nearby and could be used for pickup of materials.', 'hideInLists' => true), array('property' => 'automaticTimeoutLength', 'type' => 'integer', 'label' => 'Automatic Timeout Length (logged in)', 'description' => 'The length of time before the user is automatically logged out in seconds.', 'size' => '8', 'hideInLists' => true), array('property' => 'automaticTimeoutLengthLoggedOut', 'type' => 'integer', 'label' => 'Automatic Timeout Length (logged out)', 'description' => 'The length of time before the catalog resets to the home page set to 0 to disable.', 'size' => '8', 'hideInLists' => true), array('property' => 'displaySection', 'type' => 'section', 'label' => 'Basic Display', 'hideInLists' => true, 'properties' => array(array('property' => 'homeLink', 'type' => 'text', 'label' => 'Home Link', 'description' => 'The location to send the user when they click on the home button or logo. Use default or blank to go back to the vufind home location.', 'hideInLists' => true, 'size' => '40'), array('property' => 'homePageWidgetId', 'type' => 'integer', 'label' => 'Home Page Widget Id', 'description' => 'An id for the list widget to display on the home page', 'hideInLists' => true), array('property' => 'footerTemplate', 'type' => 'text', 'label' => 'Footer Template', 'description' => 'The name of the footer file to display in the regular interface when scoped to a single school. Use default to display the default footer', 'hideInLists' => true, 'default' => 'default'))), array('property' => 'ilsSection', 'type' => 'section', 'label' => 'ILS/Account Integration', 'hideInLists' => true, 'properties' => array(array('property' => 'holdingBranchLabel', 'type' => 'text', 'label' => 'Holding Branch Label', 'description' => 'The label used within the holdings table in Millennium'), array('property' => 'scope', 'type' => 'text', 'label' => 'Scope', 'description' => 'The scope for the system in Millennium to refine holdings to the branch. If there is no scope defined for the branch, this can be set to 0.'), array('property' => 'useScope', 'type' => 'checkbox', 'label' => 'Use Scope?', 'description' => 'Whether or not the scope should be used when displaying holdings.', 'hideInLists' => true), array('property' => 'defaultPType', 'type' => 'text', 'label' => 'Default P-Type', 'description' => 'The P-Type to use when accessing a subdomain if the patron is not logged in. Use -1 to use the library default PType.'), array('property' => 'validHoldPickupBranch', 'type' => 'checkbox', 'label' => 'Valid Hold Pickup Branch?', 'description' => 'Determines if the location can be used as a pickup location if it is not the patrons home location or the location they are in.', 'hideInLists' => true), array('property' => 'showHoldButton', 'type' => 'checkbox', 'label' => 'Show Hold Button', 'description' => 'Whether or not the hold button is displayed so patrons can place holds on items', 'hideInLists' => true), array('property' => 'ptypesToAllowRenewals', 'type' => 'text', 'label' => 'PTypes that can renew', 'description' => 'A list of P-Types that can renew items or * to allow all P-Types to renew items.', 'hideInLists' => true), array('property' => 'suppressHoldings', 'type' => 'checkbox', 'label' => 'Suppress Holdings', 'description' => 'Whether or not all items for the title should be suppressed', 'hideInLists' => true))), array('property' => 'searchingSection', 'type' => 'section', 'label' => 'Searching', 'hideInLists' => true, 'properties' => array(array('property' => 'facetLabel', 'type' => 'text', 'label' => 'Facet Label', 'description' => 'The label of the facet that identifies this location.', 'hideInLists' => true, 'size' => '40'), array('property' => 'restrictSearchByLocation', 'type' => 'checkbox', 'label' => 'Restrict Search By Location', 'description' => 'Whether or not search results should only include titles from this location', 'hideInLists' => true), array('property' => 'includeDigitalCollection', 'type' => 'checkbox', 'label' => 'Include Digital Collection', 'description' => 'Whether or not titles from the digital collection should be included in searches', 'hideInLists' => true), array('property' => 'boostByLocation', 'type' => 'checkbox', 'label' => 'Boost By Location', 'description' => 'Whether or not boosting of titles owned by this location should be applied', 'hideInLists' => true), array('property' => 'recordsToBlackList', 'type' => 'textarea', 'label' => 'Records to deaccession', 'description' => 'A list of records to deaccession (hide) in search results. Enter one record per line.', 'hideInLists' => true), array('property' => 'repeatSearchOption', 'type' => 'enum', 'values' => array('none' => 'None', 'librarySystem' => 'Library System', 'marmot' => 'Marmot'), 'label' => 'Repeat Search Options', 'description' => 'Where to allow repeating search. Valid options are: none, librarySystem, marmot, all'), array('property' => 'repeatInProspector', 'type' => 'checkbox', 'label' => 'Repeat In Prospector', 'description' => 'Turn on to allow repeat search in Prospector functionality.', 'hideInLists' => true), array('property' => 'repeatInWorldCat', 'type' => 'checkbox', 'label' => 'Repeat In WorldCat', 'description' => 'Turn on to allow repeat search in WorldCat functionality.', 'hideInLists' => true), array('property' => 'repeatInOverdrive', 'type' => 'checkbox', 'label' => 'Repeat In Overdrive', 'description' => 'Turn on to allow repeat search in Overdrive functionality.', 'hideInLists' => true), array('property' => 'systemsToRepeatIn', 'type' => 'text', 'label' => 'Systems To Repeat In', 'description' => 'A list of library codes that you would like to repeat search in separated by pipes |.', 'hideInLists' => true))), array('property' => 'enrichmentSection', 'type' => 'section', 'label' => 'Catalog Enrichment', 'hideInLists' => true, 'properties' => array(array('property' => 'showAmazonReviews', 'type' => 'checkbox', 'label' => 'Show Amazon Reviews', 'description' => 'Whether or not reviews from Amazon are displayed on the full record page.', 'hideInLists' => true), array('property' => 'showStandardReviews', 'type' => 'checkbox', 'label' => 'Show Standard Reviews', 'description' => 'Whether or not reviews from Content Cafe/Syndetics are displayed on the full record page.', 'hideInLists' => true))), array('property' => 'hours', 'type' => 'oneToMany', 'keyThis' => 'locationId', 'keyOther' => 'locationId', 'subObjectType' => 'LocationHours', 'structure' => $hoursStructure, 'label' => 'Hours', 'description' => 'Library Hours', 'sortable' => false, 'storeDb' => true), 'facets' => array('property' => 'facets', 'type' => 'oneToMany', 'label' => 'Facets', 'description' => 'A list of facets to display in search results', 'keyThis' => 'locationId', 'keyOther' => 'locationId', 'subObjectType' => 'LocationFacetSetting', 'structure' => $facetSettingStructure, 'sortable' => true, 'storeDb' => true, 'allowEdit' => true, 'canEdit' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例8: launch
function launch()
{
global $configArray;
global $interface;
global $user;
$showOpen = true;
if (isset($_REQUEST['requestsToShow']) && $_REQUEST['requestsToShow'] == 'allRequests') {
$showOpen = false;
}
$interface->assign('showOpen', $showOpen);
$defaultStatus = new MaterialsRequestStatus();
$defaultStatus->isDefault = 1;
$defaultStatus->libraryId = Library::getPatronHomeLibrary()->libraryId;
$defaultStatus->find(true);
$interface->assign('defaultStatus', $defaultStatus->id);
//Get a list of all materials requests for the user
$allRequests = array();
if ($user) {
$materialsRequests = new MaterialsRequest();
$materialsRequests->createdBy = $user->id;
$materialsRequests->orderBy('title, dateCreated');
$statusQuery = new MaterialsRequestStatus();
if ($showOpen) {
$homeLibrary = Library::getPatronHomeLibrary();
$statusQuery->libraryId = $homeLibrary->libraryId;
$statusQuery->isOpen = 1;
}
$materialsRequests->joinAdd($statusQuery);
$materialsRequests->selectAdd();
$materialsRequests->selectAdd('materials_request.*, description as statusLabel');
$materialsRequests->find();
while ($materialsRequests->fetch()) {
$allRequests[] = clone $materialsRequests;
}
} else {
header('Location: ' . $configArray['Site']['path'] . '/MyResearch/Home?followupModule=MaterialsRequest&followupAction=MyRequests');
//$interface->assign('error', "You must be logged in to view your requests.");
}
$interface->assign('allRequests', $allRequests);
$interface->assign('sidebar', 'MyAccount/account-sidebar.tpl');
$interface->setTemplate('myMaterialRequests.tpl');
$interface->setPageTitle('My Materials Requests');
$interface->display('layout.tpl');
}
示例9: getObjectStructure
static function getObjectStructure()
{
global $user;
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$structure = parent::getObjectStructure();
$structure['libraryId'] = array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'The id of a library');
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例10: getObjectStructure
function getObjectStructure()
{
global $user;
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('library_material_requests')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
} else {
$libraryList[-1] = 'Default';
}
$library->find();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the libary within the database'), 'description' => array('property' => 'description', 'type' => 'text', 'size' => 80, 'label' => 'Description', 'description' => 'A unique name for the Status'), 'isDefault' => array('property' => 'isDefault', 'type' => 'checkbox', 'label' => 'Default Status?', 'description' => 'Whether or not this status is the default status to apply to new requests'), 'isPatronCancel' => array('property' => 'isPatronCancel', 'type' => 'checkbox', 'label' => 'Set When Patron Cancels?', 'description' => 'Whether or not this status should be set when the patron cancels their request'), 'isOpen' => array('property' => 'isOpen', 'type' => 'checkbox', 'label' => 'Open Status?', 'description' => 'Whether or not this status needs further processing'), 'sendEmailToPatron' => array('property' => 'sendEmailToPatron', 'type' => 'checkbox', 'label' => 'Send Email To Patron?', 'description' => 'Whether or not an email should be sent to the patron when this status is set'), 'emailTemplate' => array('property' => 'emailTemplate', 'type' => 'textarea', 'rows' => 6, 'cols' => 60, 'label' => 'Email Template', 'description' => 'The template to use when sending emails to the user', 'hideInLists' => true), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'The id of a library'));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例11: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'category' => array('property' => 'category', 'type' => 'text', 'label' => 'Category', 'description' => 'The category of the link', 'size' => '80', 'maxLength' => 100), 'linkText' => array('property' => 'linkText', 'type' => 'text', 'label' => 'Link Text', 'description' => 'The text to display for the link ', 'size' => '80', 'maxLength' => 100), 'url' => array('property' => 'url', 'type' => 'text', 'label' => 'URL', 'description' => 'The url to link to', 'size' => '80', 'maxLength' => 255), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例12: getObjectStructure
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;
}
示例13: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
require_once ROOT_DIR . '/RecordDrivers/Interface.php';
$validSources = RecordInterface::getValidMoreDetailsSources();
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'source' => array('property' => 'source', 'type' => 'enum', 'label' => 'Source', 'values' => $validSources, 'description' => 'The source of the data to display'), 'collapseByDefault' => array('property' => 'collapseByDefault', 'type' => 'checkbox', 'label' => 'Collapse By Default', 'description' => 'Whether or not the section should be collapsed by default', 'default' => true), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例14: getObjectStructure
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;
}
示例15: getMyProfile
//.........这里部分代码省略.........
$availableHoldsRS->close();
}
//Get number of unavailable
$waitingHoldsRS = mysqli_query($this->dbConnection, 'SELECT count(*) as numHolds FROM reserves WHERE waitingdate is null and borrowernumber = ' . $patron->username);
$numWaitingHolds = 0;
if ($waitingHoldsRS) {
$waitingHolds = $waitingHoldsRS->fetch_assoc();
$numWaitingHolds = $waitingHolds['numHolds'];
$waitingHoldsRS->close();
}
$homeBranchCode = $userFromDb['branchcode'];
$location = new Location();
$location->code = $homeBranchCode;
$location->find(1);
if ($location->N == 0) {
unset($location);
}
global $user;
$profile = array('lastname' => $patron->lastname, 'firstname' => $patron->firstname, 'displayName' => isset($patron->displayName) ? $patron->displayName : '', 'fullname' => $user->lastname . ', ' . $user->firstname, 'address1' => trim($userFromDb['streetnumber'] . ' ' . $userFromDb['address'] . ' ' . $userFromDb['address2']), 'city' => $city, 'state' => $state, 'zip' => $userFromDb['zipcode'], 'phone' => $userFromDb['phone'], 'email' => $userFromDb['email'], 'homeLocationId' => isset($location) ? $location->locationId : -1, 'homeLocationName' => '', 'expires' => $userFromDb['dateexpiry'], 'fines' => sprintf('$%0.2f', $outstandingFines), 'finesval' => floatval($outstandingFines), 'numHolds' => $numWaitingHolds + $numAvailableHolds, 'numHoldsAvailable' => $numAvailableHolds, 'numHoldsRequested' => $numWaitingHolds, 'numCheckedOut' => $numCheckouts, 'bypassAutoLogout' => $user ? $user->bypassAutoLogout : false);
$profile['noticePreferenceLabel'] = 'Unknown';
//Get eContent info as well
require_once ROOT_DIR . '/Drivers/EContentDriver.php';
$eContentDriver = new EContentDriver();
$eContentAccountSummary = $eContentDriver->getAccountSummary();
$profile = array_merge($profile, $eContentAccountSummary);
require_once ROOT_DIR . '/Drivers/OverDriveDriverFactory.php';
$overDriveDriver = OverDriveDriverFactory::getDriver();
if ($overDriveDriver->isUserValidForOverDrive($user)) {
$overDriveSummary = $overDriveDriver->getOverDriveSummary($user);
$profile['numOverDriveCheckedOut'] = $overDriveSummary['numCheckedOut'];
$profile['numOverDriveHoldsAvailable'] = $overDriveSummary['numAvailableHolds'];
$profile['numOverDriveHoldsRequested'] = $overDriveSummary['numUnavailableHolds'];
$profile['canUseOverDrive'] = true;
} else {
$profile['numOverDriveCheckedOut'] = 0;
$profile['numOverDriveHoldsAvailable'] = 0;
$profile['numOverDriveHoldsRequested'] = 0;
$profile['canUseOverDrive'] = false;
}
$profile['numCheckedOutTotal'] = $profile['numCheckedOut'] + $profile['numOverDriveCheckedOut'] + $eContentAccountSummary['numEContentCheckedOut'];
$profile['numHoldsAvailableTotal'] = $profile['numHoldsAvailable'] + $profile['numOverDriveHoldsAvailable'] + $eContentAccountSummary['numEContentAvailableHolds'];
$profile['numHoldsRequestedTotal'] = $profile['numHoldsRequested'] + $profile['numOverDriveHoldsRequested'] + $eContentAccountSummary['numEContentUnavailableHolds'];
$profile['numHoldsTotal'] = $profile['numHoldsAvailableTotal'] + $profile['numHoldsRequestedTotal'];
//Get a count of the materials requests for the user
if ($user) {
$homeLibrary = Library::getPatronHomeLibrary();
if ($homeLibrary) {
$materialsRequest = new MaterialsRequest();
$materialsRequest->createdBy = $user->id;
$statusQuery = new MaterialsRequestStatus();
$statusQuery->isOpen = 1;
$statusQuery->libraryId = $homeLibrary->libraryId;
$materialsRequest->joinAdd($statusQuery);
$materialsRequest->find();
$profile['numMaterialsRequests'] = $materialsRequest->N;
} else {
$profile['numMaterialsRequests'] = 0;
}
if ($user->homeLocationId == 0 && isset($location)) {
$user->homeLocationId = $location->locationId;
if ($location->nearbyLocation1 > 0) {
$user->myLocation1Id = $location->nearbyLocation1;
} else {
$user->myLocation1Id = $location->locationId;
}
if ($location->nearbyLocation2 > 0) {
$user->myLocation2Id = $location->nearbyLocation2;
} else {
$user->myLocation2Id = $location->locationId;
}
if ($user instanceof User) {
//Update the database
$user->update();
//Update the serialized instance stored in the session
$_SESSION['userinfo'] = serialize($user);
}
} else {
if (isset($location) && $location->locationId != $user->homeLocationId) {
$user->homeLocationId = $location->locationId;
//Update the database
$user->update();
//Update the serialized instance stored in the session
$_SESSION['userinfo'] = serialize($user);
}
}
}
} else {
$profile = PEAR_Singleton::raiseError('patron_info_error_technical - could not load from database');
}
} else {
$profile = PEAR_Singleton::raiseError('patron_info_error_technical - could not execute user info statement');
}
$this->patronProfiles[$patron->username] = $profile;
$timer->logTime('Retrieved Profile for Patron from Database');
global $configArray, $serverName;
$memCache->set($memCacheProfileKey, $profile, 0, $configArray['Caching']['patron_profile']);
// Looks like all drivers but aspencat use id rather than username.
// plb 4-16-2014
return $profile;
}