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


PHP Library::getLibraryForLocation方法代码示例

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


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

示例1: institution

 function institution()
 {
     //Get the user home library
     $user = new User();
     $user->id = $this->user_id;
     $user->find(true);
     //home library
     $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
     $institutions = array();
     $institutions[] = $homeLibrary->facetLabel;
     return $institutions;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:12,代码来源:UserList.php

示例2: __construct

 function __construct()
 {
     global $interface;
     global $configArray;
     global $user;
     //If the user isn't logged in, take them to the login page
     if (!$user) {
         header("Location: {$configArray['Site']['path']}/MyAccount/Login");
         die;
     }
     //Make sure the user has permission to access the page
     $allowableRoles = $this->getAllowableRoles();
     $userCanAccess = false;
     foreach ($allowableRoles as $roleId => $roleName) {
         if ($user->hasRole($roleName)) {
             $userCanAccess = true;
             break;
         }
     }
     //Check to see if we have any acs or single use eContent in the catalog
     //to enable the holds and wishlist appropriately
     if (isset($configArray['EContent']['hasProtectedEContent'])) {
         $interface->assign('hasProtectedEContent', $configArray['EContent']['hasProtectedEContent']);
     } else {
         $interface->assign('hasProtectedEContent', false);
     }
     //This code is also in Search/History since that page displays in the My Account menu as well.
     //It is also in MyList.php
     if ($user !== false) {
         $this->catalog = CatalogFactory::getCatalogConnectionInstance();
         //Figure out if we should show a link to classic opac to pay holds.
         $ecommerceLink = $configArray['Site']['ecommerceLink'];
         $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
         if (strlen($ecommerceLink) > 0 && isset($homeLibrary) && $homeLibrary->showEcommerceLink == 1) {
             $interface->assign('showEcommerceLink', true);
             $interface->assign('minimumFineAmount', $homeLibrary->minimumFineAmount);
             $interface->assign('ecommerceLink', $ecommerceLink);
         } else {
             $interface->assign('showEcommerceLink', false);
             $interface->assign('minimumFineAmount', 0);
         }
     }
     if (!$userCanAccess) {
         $interface->setTemplate('../Admin/noPermission.tpl');
         $interface->display('layout.tpl');
         exit;
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:48,代码来源:Admin.php

示例3: getAllObjects

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

示例4: getAllObjects

 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;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:19,代码来源:Libraries.php

示例5: getLibraryScopingId

 public function getLibraryScopingId()
 {
     //For econtent, we need to be more specific when restricting copies
     //since patrons can't use copies that are only available to other libraries.
     $searchLibrary = Library::getSearchLibrary();
     $searchLocation = Location::getSearchLocation();
     $activeLibrary = Library::getActiveLibrary();
     $activeLocation = Location::getActiveLocation();
     $homeLibrary = Library::getPatronHomeLibrary();
     //Load the holding label for the branch where the user is physically.
     if (!is_null($homeLibrary)) {
         return $homeLibrary->includeOutOfSystemExternalLinks ? -1 : $homeLibrary->libraryId;
     } else {
         if (!is_null($activeLocation)) {
             $activeLibrary = Library::getLibraryForLocation($activeLocation->locationId);
             return $activeLibrary->includeOutOfSystemExternalLinks ? -1 : $activeLibrary->libraryId;
         } else {
             if (isset($activeLibrary)) {
                 return $activeLibrary->includeOutOfSystemExternalLinks ? -1 : $activeLibrary->libraryId;
             } else {
                 if (!is_null($searchLocation)) {
                     $searchLibrary = Library::getLibraryForLocation($searchLibrary->locationId);
                     return $searchLibrary->includeOutOfSystemExternalLinks ? -1 : $searchLocation->libraryId;
                 } else {
                     if (isset($searchLibrary)) {
                         return $searchLibrary->includeOutOfSystemExternalLinks ? -1 : $searchLibrary->libraryId;
                     } else {
                         return -1;
                     }
                 }
             }
         }
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:34,代码来源:EContentDriver.php

示例6: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     //Get all lists for the user
     if ($user) {
         $tmpList = new User_list();
         $tmpList->user_id = $user->id;
         $tmpList->orderBy("title ASC");
         $tmpList->find();
         $allLists = array();
         if ($tmpList->N > 0) {
             while ($tmpList->fetch()) {
                 $allLists[$tmpList->id] = $tmpList->title;
             }
         } else {
             $allList["-1"] = "My Favorites";
         }
         $interface->assign('allLists', $allLists);
     }
     //Figure out if we should show a link to classic opac to pay holds.
     $ecommerceLink = $configArray['Site']['ecommerceLink'];
     if ($user) {
         $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
     }
     if (strlen($ecommerceLink) > 0 && isset($homeLibrary) && $homeLibrary->showEcommerceLink == 1) {
         $interface->assign('showEcommerceLink', true);
         $interface->assign('minimumFineAmount', $homeLibrary->minimumFineAmount);
         if ($homeLibrary->payFinesLink == 'default' || strlen($homeLibrary->payFinesLink) == 0) {
             $interface->assign('ecommerceLink', $ecommerceLink);
         } else {
             $interface->assign('ecommerceLink', $homeLibrary->payFinesLink);
         }
         $interface->assign('payFinesLinkText', $homeLibrary->payFinesLinkText);
     } else {
         $interface->assign('showEcommerceLink', false);
         $interface->assign('minimumFineAmount', 0);
     }
     // Fetch List object
     if (isset($_GET['id'])) {
         $list = User_list::staticGet($_GET['id']);
     } else {
         //Use the first list.
         if (isset($allLists)) {
             $firstListId = reset(array_keys($allLists));
             if ($firstListId == false || $firstListId == -1) {
                 $list = new User_list();
                 $list->user_id = $user->id;
                 $list->public = false;
                 $list->title = "My Favorites";
             } else {
                 $list = User_list::staticGet($firstListId);
             }
         }
     }
     // Ensure user have privs to view the list
     if (!isset($list) || !$list->public && !UserAccount::isLoggedIn()) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     if (!$list->public && $list->user_id != $user->id) {
         PEAR_Singleton::raiseError(new PEAR_Error(translate('list_access_denied')));
     }
     //Reindex can happen by anyone since it needs to be called by cron
     if (isset($_REQUEST['myListActionHead']) && strlen($_REQUEST['myListActionHead']) > 0) {
         $actionToPerform = $_REQUEST['myListActionHead'];
         if ($actionToPerform == 'reindex') {
             $list->updateDetailed(true);
         }
     }
     if (isset($_SESSION['listNotes'])) {
         $interface->assign('notes', $_SESSION['listNotes']);
         unset($_SESSION['listNotes']);
     }
     //Perform an action on the list, but verify that the user has permission to do so.
     $userCanEdit = false;
     if ($user != false) {
         if ($user->id == $list->user_id) {
             $userCanEdit = true;
         } elseif ($user->hasRole('opacAdmin')) {
             $userCanEdit = true;
         } elseif ($user->hasRole('libraryAdmin') || $user->hasRole('contentEditor')) {
             $listUser = new User();
             $listUser->id = $list->user_id;
             $listUser->find(true);
             $listLibrary = Library::getLibraryForLocation($listUser->homeLocationId);
             $userLibrary = Library::getLibraryForLocation($user->homeLocationId);
             if ($userLibrary->libraryId == $listLibrary->libraryId) {
                 $userCanEdit = true;
             }
         }
     }
     if ($userCanEdit && (isset($_REQUEST['myListActionHead']) || isset($_REQUEST['myListActionItem']) || isset($_GET['delete']))) {
         if (isset($_REQUEST['myListActionHead']) && strlen($_REQUEST['myListActionHead']) > 0) {
             $actionToPerform = $_REQUEST['myListActionHead'];
             if ($actionToPerform == 'makePublic') {
                 $list->public = 1;
                 $list->update();
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:MyList.php

示例7: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     //Load the materials request to determine if it can be edited
     $materialsRequest = new MaterialsRequest();
     $materialsRequest->id = $_REQUEST['id'];
     if (!$materialsRequest->find(true)) {
         $materialsRequest = null;
         $requestUser = false;
     } else {
         $requestUser = new User();
         $requestUser->id = $materialsRequest->createdBy;
         if ($requestUser->find(true)) {
             $interface->assign('requestUser', $requestUser);
         } else {
             $requestUser = false;
         }
     }
     //Make sure that the user is valid
     $processForm = true;
     if ($materialsRequest == null) {
         $interface->assign('success', false);
         $interface->assign('error', 'Sorry, we could not find a request with that id.');
         $processForm = false;
     } else {
         if (!$user) {
             $interface->assign('error', 'Sorry, you must be logged in to update a materials request.');
             $processForm = false;
         } else {
             if ($user->hasRole('cataloging')) {
                 //Ok to process the form even if it wasn't created by the current user
             } else {
                 if ($user->hasRole('library_material_requests') && $requestUser && Library::getLibraryForLocation($requestUser->homeLocationId)->libraryId == Library::getLibraryForLocation($user->homeLocationId)->libraryId) {
                     //Ok to process because they are an admin for the user's home library
                 } else {
                     if ($user->id != $materialsRequest->createdBy) {
                         $interface->assign('error', 'Sorry, you do not have permission to update this materials request.');
                         $processForm = false;
                     }
                 }
             }
         }
     }
     if ($processForm) {
         //Materials request can be submitted.
         $materialsRequest->title = strip_tags($_REQUEST['title']);
         $materialsRequest->season = isset($_REQUEST['season']) ? strip_tags($_REQUEST['season']) : '';
         $materialsRequest->magazineTitle = isset($_REQUEST['magazineTitle']) ? strip_tags($_REQUEST['magazineTitle']) : '';
         $materialsRequest->magazineDate = isset($_REQUEST['magazineDate']) ? strip_tags($_REQUEST['magazineDate']) : '';
         $materialsRequest->magazineVolume = isset($_REQUEST['magazineVolume']) ? strip_tags($_REQUEST['magazineVolume']) : '';
         $materialsRequest->magazineNumber = isset($_REQUEST['magazineNumber']) ? strip_tags($_REQUEST['magazineNumber']) : '';
         $materialsRequest->magazinePageNumbers = isset($_REQUEST['magazinePageNumbers']) ? strip_tags($_REQUEST['magazinePageNumbers']) : '';
         $materialsRequest->author = strip_tags($_REQUEST['author']);
         $materialsRequest->format = strip_tags($_REQUEST['format']);
         $materialsRequest->subFormat = isset($_REQUEST['subFormat']) ? strip_tags($_REQUEST['subFormat']) : '';
         $materialsRequest->ageLevel = strip_tags($_REQUEST['ageLevel']);
         $materialsRequest->bookType = isset($_REQUEST['bookType']) ? strip_tags($_REQUEST['bookType']) : '';
         $materialsRequest->isbn = isset($_REQUEST['isbn']) ? strip_tags($_REQUEST['isbn']) : '';
         $materialsRequest->upc = isset($_REQUEST['upc']) ? strip_tags($_REQUEST['upc']) : '';
         $materialsRequest->issn = isset($_REQUEST['issn']) ? strip_tags($_REQUEST['issn']) : '';
         $materialsRequest->oclcNumber = isset($_REQUEST['oclcNumber']) ? strip_tags($_REQUEST['oclcNumber']) : '';
         $materialsRequest->publisher = strip_tags($_REQUEST['publisher']);
         $materialsRequest->publicationYear = strip_tags($_REQUEST['publicationYear']);
         if (isset($_REQUEST['abridged'])) {
             if ($_REQUEST['abridged'] == 'abridged') {
                 $materialsRequest->abridged = 1;
             } elseif ($_REQUEST['abridged'] == 'unabridged') {
                 $materialsRequest->abridged = 0;
             } else {
                 $materialsRequest->abridged = 2;
                 //Not applicable
             }
         }
         $materialsRequest->comments = strip_tags($_REQUEST['comments']);
         $materialsRequest->dateUpdated = time();
         if ($materialsRequest->update()) {
             $interface->assign('success', true);
             $interface->assign('materialsRequest', $materialsRequest);
         } else {
             $interface->assign('success', false);
             $interface->assign('error', 'There was an error updating the materials request.');
         }
     } else {
         $interface->assign('success', false);
         $interface->assign('error', 'Sorry, we could not find a request with that id.');
     }
     //Get a list of formats to show
     $availableFormats = MaterialsRequest::getFormats();
     $interface->assign('availableFormats', $availableFormats);
     $interface->assign('showPhoneField', $configArray['MaterialsRequest']['showPhoneField']);
     $interface->assign('showAgeField', $configArray['MaterialsRequest']['showAgeField']);
     $interface->assign('showBookTypeField', $configArray['MaterialsRequest']['showBookTypeField']);
     $interface->assign('showEbookFormatField', $configArray['MaterialsRequest']['showEbookFormatField']);
     $interface->assign('showEaudioFormatField', $configArray['MaterialsRequest']['showEaudioFormatField']);
     $interface->assign('showPlaceHoldField', $configArray['MaterialsRequest']['showPlaceHoldField']);
     $interface->assign('showIllField', $configArray['MaterialsRequest']['showIllField']);
     $interface->setTemplate('update-result.tpl');
     $interface->setPageTitle('Update Result');
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:Update.php

示例8: loadUserData

                $id = $_REQUEST['recordId'];
            }
            if (isset($id)) {
                $_REQUEST['id'] = $id;
            }
            $_REQUEST['module'] = $module;
            $_REQUEST['action'] = $action;
        }
    }
}
$timer->logTime('User authentication');
//Load user data for the user as long as we aren't in the act of logging out.
if ($user && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'Logout')) {
    loadUserData();
    $interface->assign('pType', $user->patronType);
    $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
    if (isset($homeLibrary)) {
        $interface->assign('homeLibrary', $homeLibrary->displayName);
    }
} else {
    $interface->assign('pType', 'logged out');
    $interface->assign('homeLibrary', 'n/a');
}
//Find a reasonable default location to go to
if ($module == null && $action == null) {
    //We have no information about where to go, go to the default location from config
    $module = $configArray['Site']['defaultModule'];
    $action = 'Home';
} elseif ($action == null) {
    $action = 'Home';
}
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:31,代码来源:index.php

示例9: __construct

 function __construct()
 {
     global $interface;
     global $configArray;
     global $user;
     //If the user isn't logged in, take them to the login page
     if (!$user) {
         header("Location: {$configArray['Site']['path']}/MyResearch/Login");
         die;
     }
     //Make sure the user has permission to access the page
     $allowableRoles = $this->getAllowableRoles();
     $userCanAccess = false;
     foreach ($allowableRoles as $roleId => $roleName) {
         if ($user->hasRole($roleName)) {
             $userCanAccess = true;
             break;
         }
     }
     $interface->assign('ils', $configArray['Catalog']['ils']);
     //Determine whether or not materials request functionality should be enabled
     $interface->assign('enableMaterialsRequest', MaterialsRequest::enableMaterialsRequest());
     //Check to see if we have any acs or single use eContent in the catalog
     //to enable the holds and wishlist appropriately
     if (isset($configArray['EContent']['hasProtectedEContent'])) {
         $interface->assign('hasProtectedEContent', $configArray['EContent']['hasProtectedEContent']);
     } else {
         $interface->assign('hasProtectedEContent', false);
     }
     //This code is also in Search/History since that page displays in the My Account menu as well.
     //It is also in MyList.php
     if ($user !== false) {
         $this->catalog = new CatalogConnection($configArray['Catalog']['driver']);
         $interface->assign('user', $user);
         // Get My Profile
         if ($this->catalog->status) {
             if ($user->cat_username) {
                 $patron = $this->catalog->patronLogin($user->cat_username, $user->cat_password);
                 if (PEAR_Singleton::isError($patron)) {
                     PEAR_Singleton::raiseError($patron);
                 }
                 $profile = $this->catalog->getMyProfile($patron);
                 if (!PEAR_Singleton::isError($profile)) {
                     $interface->assign('profile', $profile);
                 }
             }
         }
         //Figure out if we should show a link to classic opac to pay holds.
         $ecommerceLink = $configArray['Site']['ecommerceLink'];
         $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
         if (strlen($ecommerceLink) > 0 && isset($homeLibrary) && $homeLibrary->showEcommerceLink == 1) {
             $interface->assign('showEcommerceLink', true);
             $interface->assign('minimumFineAmount', $homeLibrary->minimumFineAmount);
             $interface->assign('ecommerceLink', $ecommerceLink);
         } else {
             $interface->assign('showEcommerceLink', false);
             $interface->assign('minimumFineAmount', 0);
         }
     }
     if (!$userCanAccess) {
         $interface->setTemplate('../Admin/noPermission.tpl');
         $interface->display('layout.tpl');
         exit;
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:65,代码来源:Admin.php

示例10: UpdateMaterialsRequest

 function UpdateMaterialsRequest()
 {
     global $interface;
     global $configArray;
     $useWorldCat = false;
     if (isset($configArray['WorldCat']) && isset($configArray['WorldCat']['apiKey'])) {
         $useWorldCat = strlen($configArray['WorldCat']['apiKey']) > 0;
     }
     $interface->assign('useWorldCat', $useWorldCat);
     if (!isset($_REQUEST['id'])) {
         $interface->assign('error', 'Please provide an id of the materials request to view.');
     } else {
         $id = $_REQUEST['id'];
         $materialsRequest = new MaterialsRequest();
         $materialsRequest->id = $id;
         if ($materialsRequest->find(true)) {
             $canUpdate = false;
             //Load user information
             $requestUser = new User();
             $requestUser->id = $materialsRequest->createdBy;
             if ($requestUser->find(true)) {
                 $interface->assign('requestUser', $requestUser);
             }
             global $user;
             if ($user) {
                 if ($user->hasRole('cataloging')) {
                     $canUpdate = true;
                 } elseif ($user->id == $materialsRequest->createdBy) {
                     $canUpdate = true;
                 } else {
                     if ($user->hasRole('library_material_requests')) {
                         //User can update if the home library of the requester is their library
                         $canUpdate = Library::getLibraryForLocation($requestUser->homeLocationId)->libraryId == Library::getLibraryForLocation($user->homeLocationId)->libraryId;
                     }
                 }
             }
             if ($canUpdate) {
                 //Get a list of formats to show
                 $availableFormats = MaterialsRequest::getFormats();
                 $interface->assign('availableFormats', $availableFormats);
                 $interface->assign('showPhoneField', $configArray['MaterialsRequest']['showPhoneField']);
                 $interface->assign('showAgeField', $configArray['MaterialsRequest']['showAgeField']);
                 $interface->assign('showBookTypeField', $configArray['MaterialsRequest']['showBookTypeField']);
                 $interface->assign('showEbookFormatField', $configArray['MaterialsRequest']['showEbookFormatField']);
                 $interface->assign('showEaudioFormatField', $configArray['MaterialsRequest']['showEaudioFormatField']);
                 $interface->assign('showPlaceHoldField', $configArray['MaterialsRequest']['showPlaceHoldField']);
                 $interface->assign('showIllField', $configArray['MaterialsRequest']['showIllField']);
                 $interface->assign('requireAboutField', $configArray['MaterialsRequest']['requireAboutField']);
                 $interface->assign('materialsRequest', $materialsRequest);
                 $interface->assign('showUserInformation', true);
             } else {
                 $interface->assign('error', 'Sorry, you don\'t have permission to update this request.');
             }
         } else {
             $interface->assign('error', 'Sorry, we couldn\'t find a materials request for that id.');
         }
     }
     $return = array('title' => 'Update Materials Request', 'modalBody' => $interface->fetch('MaterialsRequest/ajax-update-request.tpl'), 'modalButtons' => "<span class='btn btn-primary' onclick='\$(\"#materialsRequestUpdateForm\").submit();'>Update Request</span>");
     return $return;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:60,代码来源:AJAX.php

示例11: __construct

 function __construct()
 {
     global $interface;
     global $configArray;
     global $user;
     $interface->assign('page_body_style', 'sidebar_left');
     if ($this->requireLogin && !UserAccount::isLoggedIn()) {
         require_once ROOT_DIR . '/services/MyAccount/Login.php';
         $myAccountAction = new MyAccount_Login();
         $myAccountAction->launch();
         exit;
     }
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $this->db = new $class($configArray['Index']['url']);
     // Connect to Database
     $this->catalog = CatalogFactory::getCatalogConnectionInstance();
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit'])) {
         if ($this->catalog && isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
             $result = $this->catalog->patronLogin($_POST['cat_username'], $_POST['cat_password']);
             if ($result && !PEAR_Singleton::isError($result)) {
                 $user->cat_username = $_POST['cat_username'];
                 $user->cat_password = $_POST['cat_password'];
                 $user->update();
                 UserAccount::updateSession($user);
                 $interface->assign('user', $user);
             } else {
                 $interface->assign('loginError', 'Invalid Patron Login');
             }
         }
     }
     //Check to see if we have any acs or single use eContent in the catalog
     //to enable the holds and wishlist appropriately
     if (isset($configArray['EContent']['hasProtectedEContent'])) {
         $interface->assign('hasProtectedEContent', $configArray['EContent']['hasProtectedEContent']);
     } else {
         $interface->assign('hasProtectedEContent', false);
     }
     //This code is also in Search/History since that page displays in the My Account menu as well.
     //It is also in MyList.php and Admin.php
     if ($user !== false) {
         $interface->assign('user', $user);
         // Profile is already loaded by index.php. plb 4-17-2015
         // (keeping in case there is a exception )
         // Get My Profile
         //			if ($this->catalog->status) {
         //				if ($user->cat_username) {
         //					$patron = $this->catalog->patronLogin($user->cat_username, $user->cat_password);
         //					if (PEAR_Singleton::isError($patron)){
         //						PEAR_Singleton::raiseError($patron);
         //					}
         //
         //					$profile = $this->catalog->getMyProfile($patron);
         //					//global $logger;
         //					//$logger->log("Patron profile phone number in MyResearch = " . $profile['phone'], PEAR_LOG_INFO);
         //					if (!PEAR_Singleton::isError($profile)) {
         //						$interface->assign('profile', $profile);
         //					}
         //				}
         //			}
         //Figure out if we should show a link to classic opac to pay holds.
         $ecommerceLink = $configArray['Site']['ecommerceLink'];
         $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
         if (strlen($ecommerceLink) > 0 && isset($homeLibrary) && $homeLibrary->showEcommerceLink == 1) {
             $interface->assign('showEcommerceLink', true);
             $interface->assign('minimumFineAmount', $homeLibrary->minimumFineAmount);
             if ($homeLibrary->payFinesLink == 'default') {
                 $interface->assign('ecommerceLink', $ecommerceLink);
             } else {
                 $interface->assign('ecommerceLink', $homeLibrary->payFinesLink);
             }
             $interface->assign('payFinesLinkText', $homeLibrary->payFinesLinkText);
         } else {
             $interface->assign('showEcommerceLink', false);
             $interface->assign('minimumFineAmount', 0);
         }
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:79,代码来源:MyAccount.php

示例12: canEditList

 /**
  * @param $list UserList           object of the user list to check permission for
  * @return  bool       true if this user can edit passed list
  */
 function canEditList($list)
 {
     if ($this->id == $list->user_id) {
         return true;
     } elseif ($this->hasRole('opacAdmin')) {
         return true;
     } elseif ($this->hasRole('libraryAdmin') || $this->hasRole('contentEditor')) {
         $listUser = new User();
         $listUser->id = $list->user_id;
         $listUser->find(true);
         $listLibrary = Library::getLibraryForLocation($listUser->homeLocationId);
         $userLibrary = Library::getLibraryForLocation($this->homeLocationId);
         if ($userLibrary->libraryId == $listLibrary->libraryId) {
             return true;
         }
     }
     return false;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:22,代码来源:User.php

示例13: __construct

 function __construct()
 {
     global $interface;
     global $configArray;
     global $user;
     $interface->assign('page_body_style', 'sidebar_left');
     $interface->assign('ils', $configArray['Catalog']['ils']);
     if ($this->requireLogin && !UserAccount::isLoggedIn()) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     //$interface->assign('userNoticeFile', 'MyResearch/listNotice.tpl');
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $this->db = new $class($configArray['Index']['url']);
     if ($configArray['System']['debugSolr']) {
         $this->db->debug = true;
     }
     // Connect to Database
     $this->catalog = new CatalogConnection($configArray['Catalog']['driver']);
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit'])) {
         if ($this->catalog && isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
             $result = $this->catalog->patronLogin($_POST['cat_username'], $_POST['cat_password']);
             if ($result && !PEAR_Singleton::isError($result)) {
                 $user->cat_username = $_POST['cat_username'];
                 $user->cat_password = $_POST['cat_password'];
                 $user->update();
                 UserAccount::updateSession($user);
                 $interface->assign('user', $user);
             } else {
                 $interface->assign('loginError', 'Invalid Patron Login');
             }
         }
     }
     //Determine whether or not materials request functionality should be enabled
     $interface->assign('enableMaterialsRequest', MaterialsRequest::enableMaterialsRequest());
     //Check to see if we have any acs or single use eContent in the catalog
     //to enable the holds and wishlist appropriately
     if (isset($configArray['EContent']['hasProtectedEContent'])) {
         $interface->assign('hasProtectedEContent', $configArray['EContent']['hasProtectedEContent']);
     } else {
         $interface->assign('hasProtectedEContent', false);
     }
     global $library;
     if (isset($library)) {
         $interface->assign('showFavorites', $library->showFavorites);
         $interface->assign('showRatings', $library->showRatings);
         $interface->assign('showComments', $library->showComments);
     } else {
         $interface->assign('showFavorites', 1);
         $interface->assign('showRatings', 1);
         $interface->assign('showComments', 1);
     }
     //This code is also in Search/History since that page displays in the My Account menu as well.
     //It is also in MyList.php and Admin.php
     if ($user !== false) {
         $interface->assign('user', $user);
         // Get My Profile
         if ($this->catalog->status) {
             if ($user->cat_username) {
                 $patron = $this->catalog->patronLogin($user->cat_username, $user->cat_password);
                 if (PEAR_Singleton::isError($patron)) {
                     PEAR_Singleton::raiseError($patron);
                 }
                 $profile = $this->catalog->getMyProfile($patron);
                 //global $logger;
                 //$logger->log("Patron profile phone number in MyResearch = " . $profile['phone'], PEAR_LOG_INFO);
                 if (!PEAR_Singleton::isError($profile)) {
                     $interface->assign('profile', $profile);
                 }
             }
         }
         //Figure out if we should show a link to classic opac to pay holds.
         $ecommerceLink = $configArray['Site']['ecommerceLink'];
         $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
         if (strlen($ecommerceLink) > 0 && isset($homeLibrary) && $homeLibrary->showEcommerceLink == 1) {
             $interface->assign('showEcommerceLink', true);
             $interface->assign('minimumFineAmount', $homeLibrary->minimumFineAmount);
             if ($homeLibrary->payFinesLink == 'default') {
                 $interface->assign('ecommerceLink', $ecommerceLink);
             } else {
                 $interface->assign('ecommerceLink', $homeLibrary->payFinesLink);
             }
             $interface->assign('payFinesLinkText', $homeLibrary->payFinesLinkText);
         } else {
             $interface->assign('showEcommerceLink', false);
             $interface->assign('minimumFineAmount', 0);
         }
         //Load a list of lists
         $lists = array();
         if ($user->disableRecommendations == 0) {
             $lists[] = array('name' => 'Recommended For You', 'url' => '/MyResearch/SuggestedTitles', 'id' => 'suggestions');
         }
         $tmpList = new User_list();
         $tmpList->user_id = $user->id;
         $tmpList->orderBy("title ASC");
         $tmpList->find();
         if ($tmpList->N > 0) {
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:MyResearch.php


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