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


PHP ConnectionManager::connectToCatalog方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $configArray;
     global $user;
     global $interface;
     //$interface->caching = 1;
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Set up object for formatting dates and times:
     $this->dateFormat = new VuFindDate();
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit'])) {
         if (isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
             $username = $_POST['cat_username'];
             if (isset($_POST['login_target'])) {
                 $username = $_POST['login_target'] . '.' . $username;
             }
             $result = UserAccount::processCatalogLogin($username, $_POST['cat_password']);
             if ($result) {
                 $interface->assign('user', $user);
             } else {
                 $interface->assign('loginError', 'Invalid Patron Login');
             }
         }
     }
     // Retrieve the record from the index
     if (!($record = $this->db->getRecord($_REQUEST['id']))) {
         PEAR::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     $this->setRecord($_REQUEST['id'], $record);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:38,代码来源:Record.php

示例2: getPickUpLocations

 /**
  * Get a list of pickup locations for the given library
  *
  * @return void
  * @access public
  */
 public function getPickUpLocations()
 {
     if (isset($_REQUEST['id']) && isset($_REQUEST['pickupLib'])) {
         // check if user is logged in
         $user = UserAccount::isLoggedIn();
         if (!$user) {
             return $this->output(array('msg' => translate('You must be logged in first')), JSON::STATUS_NEED_AUTH);
         }
         $catalog = ConnectionManager::connectToCatalog();
         if ($catalog && $catalog->status) {
             if ($patron = UserAccount::catalogLogin()) {
                 if (!PEAR::isError($patron)) {
                     $results = $catalog->getUBPickupLocations(array('id' => $_REQUEST['id'], 'patron' => $patron, 'pickupLibrary' => $_REQUEST['pickupLib']));
                     if (!PEAR::isError($results)) {
                         foreach ($results as &$result) {
                             $result['name'] = translate(array('prefix' => 'location_', 'text' => $result['name']));
                         }
                         return $this->output(array('locations' => $results), JSON::STATUS_OK);
                     }
                 }
             }
         }
     }
     return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:31,代码来源:JSON_UBRequest.php

示例3: authenticate

 /**
  * Attempt to authenticate the current user.
  *
  * @return object User object if successful, PEAR_Error otherwise.
  * @access public
  */
 public function authenticate()
 {
     global $configArray;
     $username = $_POST['username'];
     $password = $_POST['password'];
     $loginTarget = isset($_POST['login_target']) ? $_POST['login_target'] : false;
     if ($loginTarget) {
         $username = "{$loginTarget}.{$username}";
     }
     if ($username == '' || $password == '') {
         $user = new PEAR_Error('authentication_error_blank');
     } else {
         // Connect to catalog:
         $catalog = ConnectionManager::connectToCatalog();
         if ($catalog && $catalog->status) {
             $patron = $catalog->patronLogin($username, $password);
             if ($patron && !PEAR::isError($patron)) {
                 // If the login command did not return an email address, try to fetch it from the profile information
                 if (empty($patron['email'])) {
                     $profile = $catalog->getMyProfile($patron);
                     $patron['email'] = $profile['email'];
                 }
                 $confirm = isset($_POST['confirm']);
                 if (!$confirm) {
                     list($ILSUserExists) = $this->checkIfILSUserExists($patron);
                     if (!$ILSUserExists) {
                         // First login with library card
                         // Check if account is connected to existing user(s)
                         $accounts = $this->checkIfLibraryCardIsConnectedToOtherUser($patron);
                         if (!empty($accounts)) {
                             $res = array();
                             foreach ($accounts as $account) {
                                 $tmp = array('email' => $account->email);
                                 if ($account->authMethod !== null) {
                                     $tmp['authMethod'] = translate("confirm_create_account_{$account->authMethod}");
                                 }
                                 $res[] = $tmp;
                             }
                             // Confirm if new user account should be created
                             return new PEAR_Error('confirm_create_account', ILSAuthentication::ERROR_CONFIRM_CREATE_ACCOUNT, null, null, json_encode($res));
                         }
                     }
                 }
                 $user = $this->_processILSUser($patron);
             } else {
                 $user = PEAR::isError($patron) ? $patron : new PEAR_Error('authentication_error_invalid');
             }
         } else {
             $user = new PEAR_Error('authentication_error_technical');
         }
     }
     return $user;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:59,代码来源:ILSAuthentication.php

示例4: __construct

 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $configArray;
     $this->useReservesIndex = isset($configArray['Reserves']['search_enabled']) && $configArray['Reserves']['search_enabled'];
     // connect to the ILS if not using course reserves Solr index
     if (!$this->useReservesIndex) {
         $catalog = ConnectionManager::connectToCatalog();
         if (!$catalog || !$catalog->status) {
             PEAR::raiseError(new PEAR_Error('Cannot Load Catalog Driver'));
         }
         $this->catalog = $catalog;
     }
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:18,代码来源:Reserves.php

示例5: __construct

 /**
  * Constructor
  *
  * @param bool $skipLogin Set to true to bypass the default login requirement.
  *
  * @access public
  */
 public function __construct($skipLogin = false)
 {
     global $interface;
     global $configArray;
     global $user;
     if (!$skipLogin && !UserAccount::isLoggedIn()) {
         include_once 'Login.php';
         Login::launch();
         exit;
     }
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Is Placing Holds allowed?
     $this->checkHolds = $this->catalog->checkFunction("Holds", null);
     // Is Cancelling Holds allowed?
     $this->cancelHolds = $this->catalog->checkFunction("cancelHolds", null);
     // Is Renewing Items allowed?
     $this->checkRenew = $this->catalog->checkFunction("Renewals", null);
     // Register Library Catalog Account
     if (isset($_POST['submit']) && !empty($_POST['submit']) && $this->catalog && isset($_POST['cat_username']) && isset($_POST['cat_password'])) {
         $username = $_POST['cat_username'];
         $password = $_POST['cat_password'];
         $loginTarget = isset($_POST['login_target']) ? $_POST['login_target'] : false;
         if ($loginTarget) {
             $username = "{$loginTarget}.{$username}";
         }
         if (UserAccount::processCatalogLogin($username, $password)) {
             $interface->assign('user', $user);
         } else {
             $interface->assign('loginError', 'Invalid Patron Login');
         }
     }
     // Assign Exporter Options
     $exportOptions = array();
     if ($configArray['BulkExport']['enabled']) {
         $options = explode(':', $configArray['BulkExport']['options']);
         foreach ($options as $option) {
             if ($configArray['Export'][$option] == true) {
                 $exportOptions[] = $option;
             }
         }
         $interface->assign('exportOptions', $exportOptions);
     }
     // Get Messages
     $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false;
     $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false;
     $this->showExport = isset($_GET['showExport']) ? $_GET['showExport'] : false;
     $this->followupUrl = false;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:58,代码来源:MyResearch.php

示例6: __construct

 /**
  * Constructor.
  *
  * @access public
  */
 public function __construct()
 {
     global $interface;
     global $configArray;
     global $user;
     parent::__construct();
     $this->user = UserAccount::isLoggedIn();
     // Setup Search Engine Connection
     $this->db = ConnectionManager::connectToIndex();
     // Connect to Database
     $this->catalog = ConnectionManager::connectToCatalog();
     // Assign Exporter Options
     $exportOptions = array();
     if ($configArray['BulkExport']['enabled']) {
         $options = explode(':', $configArray['BulkExport']['options']);
         foreach ($options as $option) {
             if ($configArray['Export'][$option] == true) {
                 $exportOptions[] = $option;
             }
         }
         $this->exportOptions = $exportOptions;
     }
     // Get Messages
     $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false;
     $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false;
     $this->showExport = isset($_GET['showExport']) ? $_GET['showExport'] : false;
     $this->origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : false;
     // Set FollowUp URL
     if (isset($_REQUEST['followup'])) {
         $this->followupUrl = $configArray['Site']['url'] . "/" . $_REQUEST['followupModule'];
         $this->followupUrl .= "/" . $_REQUEST['followupAction'];
     } else {
         if (isset($_REQUEST['listID']) && !empty($_REQUEST['listID'])) {
             $this->followupUrl = $configArray['Site']['url'] . "/MyResearch/MyList/" . urlencode($_REQUEST['listID']);
         } else {
             $this->followupUrl = $configArray['Site']['url'] . "/Cart/Home";
         }
     }
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:44,代码来源:Bulk.php

示例7: checkRequestIsValid

 /**
  * Check Request is Valid
  *
  * @return void
  * @access public
  */
 public function checkRequestIsValid()
 {
     if (isset($_REQUEST['id']) && isset($_REQUEST['data'])) {
         // check if user is logged in
         $user = UserAccount::isLoggedIn();
         if (!$user) {
             return $this->output(array('status' => false, 'msg' => translate('You must be logged in first')), JSON::STATUS_NEED_AUTH);
         }
         $catalog = ConnectionManager::connectToCatalog();
         if ($catalog && $catalog->status) {
             if ($patron = UserAccount::catalogLogin()) {
                 if (!PEAR::isError($patron)) {
                     $results = $catalog->checkCallSlipRequestIsValid($_REQUEST['id'], $_REQUEST['data'], $patron);
                     if (!PEAR::isError($results)) {
                         $msg = $results ? translate('call_slip_place_text') : translate('call_slip_error_blocked');
                         return $this->output(array('status' => $results, 'msg' => $msg), JSON::STATUS_OK);
                     }
                 }
             }
         }
     }
     return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:29,代码来源:JSON_CallSlip.php

示例8: __construct

 /**
  * Constructor
  *
  * @param object $catalog A catalog connection
  *
  * @access public
  */
 public function __construct($catalog = false)
 {
     global $configArray;
     $this->hideHoldings = isset($configArray['Record']['hide_holdings']) ? $configArray['Record']['hide_holdings'] : array();
     $this->catalog = $catalog == true ? $catalog : ConnectionManager::connectToCatalog();
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:13,代码来源:HoldLogic.php

示例9: send

 /**
  * Send due date reminders
  *
  * @return void
  */
 public function send()
 {
     global $configArray;
     global $interface;
     global $translator;
     $iso8601 = 'Y-m-d\\TH:i:s\\Z';
     ini_set('display_errors', true);
     $configArray = $mainConfig = readConfig();
     $datasourceConfig = getExtraConfigArray('datasources');
     $siteLocal = $configArray['Site']['local'];
     // Set up time zone. N.B. Don't use msg() or other functions requiring date before this.
     date_default_timezone_set($configArray['Site']['timezone']);
     $this->msg('Sending due date reminders');
     // Setup Local Database Connection
     ConnectionManager::connectToDatabase();
     // And index
     $db = ConnectionManager::connectToIndex();
     // Initialize Mailer
     $mailer = new VuFindMailer();
     // Find all scheduled alerts
     $sql = 'SELECT * FROM "user" WHERE "due_date_reminder" > 0 ORDER BY id';
     $user = new User();
     $user->query($sql);
     $this->msg('Processing ' . $user->N . ' users');
     $interface = false;
     $institution = false;
     $todayTime = new DateTime();
     $catalog = ConnectionManager::connectToCatalog();
     while ($user->fetch()) {
         if (!$user->email || trim($user->email) == '') {
             $this->msg('User ' . $user->username . ' does not have an email address, bypassing due date reminders');
             continue;
         }
         // Initialize settings and interface
         $userInstitution = reset(explode(':', $user->username, 2));
         if (!$institution || $institution != $userInstitution) {
             $institution = $userInstitution;
             if (!isset($datasourceConfig[$institution])) {
                 foreach ($datasourceConfig as $code => $values) {
                     if (isset($values['institution']) && strcasecmp($values['institution'], $institution) == 0) {
                         $institution = $code;
                         break;
                     }
                 }
             }
             if (!($configArray = $this->readInstitutionConfig($institution))) {
                 continue;
             }
             // Start Interface
             $interface = new UInterface($siteLocal);
             $validLanguages = array_keys($configArray['Languages']);
             $dateFormat = new VuFindDate();
         }
         $language = $user->language;
         if (!in_array($user->language, $validLanguages)) {
             $language = $configArray['Site']['language'];
         }
         $translator = new I18N_Translator(array($configArray['Site']['local'] . '/lang', $configArray['Site']['local'] . '/lang_local'), $language, $configArray['System']['debug']);
         $interface->setLanguage($language);
         // Go through accounts and check loans
         $account = new User_account();
         $account->user_id = $user->id;
         if (!$account->find(false)) {
             continue;
         }
         $remindLoans = array();
         while ($account->fetch()) {
             $patron = $catalog->patronLogin($account->cat_username, $account->cat_password);
             if ($patron === null || PEAR::isError($patron)) {
                 $this->msg('Catalog login failed for user ' . $user->id . ', account ' . $account->id . ' (' . $account->cat_username . '): ' . ($patron ? $patron->getMessage() : 'patron not found'));
                 continue;
             }
             $loans = $catalog->getMyTransactions($patron);
             if (PEAR::isError($loans)) {
                 $this->msg('Could not fetch loans for user ' . $user->id . ', account ' . $account->id . ' (' . $account->cat_username . ')');
                 continue;
             }
             foreach ($loans as $loan) {
                 $dueDate = new DateTime($loan['duedate']);
                 if ($todayTime >= $dueDate || $dueDate->diff($todayTime)->days <= $user->due_date_reminder) {
                     // Check that a reminder hasn't been sent already
                     $reminder = new Due_date_reminder();
                     $reminder->user_id = $user->id;
                     $reminder->loan_id = $loan['item_id'];
                     $reminder->due_date = $dueDate->format($iso8601);
                     if ($reminder->find(false)) {
                         // Reminder already sent
                         continue;
                     }
                     // Store also title for display in email
                     $title = isset($loan['title']) ? $loan['title'] : translate('Title not available');
                     if (isset($loan['id'])) {
                         $record = $db->getRecord($loan['id']);
                         if ($record && isset($record['title'])) {
                             $title = $record['title'];
//.........这里部分代码省略.........
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:101,代码来源:due_date_reminders.php

示例10: ini_set

 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
 * @link     http://vufind.org/wiki Wiki
 */
ini_set('memory_limit', '50M');
ini_set('max_execution_time', '3600');
/**
 * Set up util environment
 */
require_once 'util.inc.php';
require_once 'sys/ConnectionManager.php';
// Read Config file
$configArray = readConfig();
// Setup Solr Connection
$solr = ConnectionManager::connectToIndex('SolrReserves');
// Connect to ILS
$catalog = ConnectionManager::connectToCatalog();
// Records to index
$index = array();
// Get instructors
$instructors = $catalog->getInstructors();
// Get Courses
$courses = $catalog->getCourses();
// Get Departments
$departments = $catalog->getDepartments();
// Get all reserve records
$reserves = $catalog->findReserves('', '', '');
if (!empty($instructors) && !empty($courses) && !empty($departments) && !empty($reserves)) {
    // Delete existing records
    $solr->deleteAll();
    // Build the index
    $solr->buildIndex($instructors, $courses, $departments, $reserves);
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:31,代码来源:index_reserves.php

示例11: getItemStatuses

 /**
  * Get Item Statuses
  *
  * This is responsible for printing the holdings information for a
  * collection of records in JSON format.
  *
  * @return void
  * @access public
  * @author Chris Delis <cedelis@uillinois.edu>
  * @author Tuan Nguyen <tuan@yorku.ca>
  */
 public function getItemStatuses()
 {
     global $interface;
     global $configArray;
     $catalog = ConnectionManager::connectToCatalog();
     if (!$catalog || !$catalog->status) {
         return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR);
     }
     $results = $catalog->getStatuses($_GET['id']);
     if (PEAR::isError($results)) {
         return $this->output($results->getMessage(), JSON::STATUS_ERROR);
     } else {
         if (!is_array($results)) {
             // If getStatuses returned garbage, let's turn it into an empty array
             // to avoid triggering a notice in the foreach loop below.
             $results = array();
         }
     }
     // In order to detect IDs missing from the status response, create an
     // array with a key for every requested ID.  We will clear keys as we
     // encounter IDs in the response -- anything left will be problems that
     // need special handling.
     $missingIds = array_flip($_GET['id']);
     // Load messages for response:
     $messages = array('available' => $interface->fetch('AJAX/status-available.tpl'), 'unavailable' => $interface->fetch('AJAX/status-unavailable.tpl'), 'unknown' => $interface->fetch('AJAX/status-unknown.tpl'));
     // Load callnumber and location settings:
     $callnumberSetting = isset($configArray['Item_Status']['multiple_call_nos']) ? $configArray['Item_Status']['multiple_call_nos'] : 'msg';
     $locationSetting = isset($configArray['Item_Status']['multiple_locations']) ? $configArray['Item_Status']['multiple_locations'] : 'msg';
     $showFullStatus = isset($configArray['Item_Status']['show_full_status']) ? $configArray['Item_Status']['show_full_status'] : false;
     // Loop through all the status information that came back
     $statuses = array();
     $patron = null;
     foreach ($results as $record) {
         // Skip errors and empty records:
         if (!PEAR::isError($record) && count($record)) {
             // Filter out suppressed locations, and skip record if none remain:
             $record = $this->_filterSuppressedLocations($record);
             if (empty($record)) {
                 continue;
             }
             // Special case for Axiell holdings
             if (isset($record[0]['holdings'])) {
                 if ($patron === null) {
                     $patron = UserAccount::catalogLogin();
                 }
                 $current = array('id' => $record[0]['id'], 'full_status' => $this->getAxiellItemStatusFull($record, $catalog, $patron));
             } else {
                 if ($locationSetting == "group") {
                     $current = $this->_getItemStatusGroup($record, $messages, $callnumberSetting);
                 } else {
                     $current = $this->_getItemStatus($record, $messages, $locationSetting, $callnumberSetting);
                 }
                 // If a full status display has been requested, append the HTML:
                 if ($showFullStatus) {
                     $current['full_status'] = $this->_getItemStatusFull($record);
                 }
             }
             $statuses[] = $current;
             // The current ID is not missing -- remove it from the missing list.
             unset($missingIds[$current['id']]);
         }
     }
     // If any IDs were missing, send back appropriate dummy data, including a
     // "missing data" flag which can be used to completely suppress status info:
     foreach ($missingIds as $missingId => $junk) {
         $statuses[] = array('id' => $missingId, 'availability' => 'false', 'availability_message' => $messages['unavailable'], 'location' => translate('Unknown'), 'locationList' => false, 'reserve' => 'false', 'reserve_message' => translate('Not On Reserve'), 'callnumber' => '', 'missing_data' => true);
     }
     // Done
     return $this->output($statuses, JSON::STATUS_OK);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:81,代码来源:JSON.php

示例12: launch

 /**
  * Process incoming parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $configArray;
     global $interface;
     $catalog = ConnectionManager::connectToCatalog();
     if (!$catalog || !$catalog->status) {
         PEAR::raiseError(new PEAR_Error('Cannot Load Catalog Driver'));
     }
     // Read in search-specific configurations:
     $searchSettings = getExtraConfigArray('searches');
     if (isset($_GET['range'])) {
         // Initialise from the current search globals
         $searchObject = SearchObjectFactory::initSearchObject();
         $searchObject->init();
         // Are there "new item" filter queries specified in the config file?
         // If so, we should apply them as hidden filters so they do not show
         // up in the user-selected facet list.
         if (isset($searchSettings['NewItem']['filter'])) {
             $filter = is_array($searchSettings['NewItem']['filter']) ? $searchSettings['NewItem']['filter'] : array($searchSettings['NewItem']['filter']);
             foreach ($filter as $current) {
                 $searchObject->addHiddenFilter($current);
             }
         }
         // Must have atleast Action and Module set to continue
         $interface->setPageTitle('New Item Search Results');
         $interface->setTemplate('newitem-list.tpl');
         //Get view & load template
         $currentView = $searchObject->getView();
         $interface->assign('subpage', 'Search/list-' . $currentView . '.tpl');
         $interface->assign('viewList', $searchObject->getViewList());
         $interface->assign('sortList', $searchObject->getSortList());
         $interface->assign('limitList', $searchObject->getLimitList());
         $interface->assign('rssLink', $searchObject->getRSSUrl());
         $interface->assign('range', $_GET['range']);
         // This code was originally designed to page through the results
         // retrieved from the catalog in parallel with paging through the
         // Solr results.  The logical flaw in this approach is that if
         // we only retrieve one page of results from the catalog, we never
         // know the full extent of available results there!
         //
         // The code has now been changed to always pull in enough catalog
         // results to get a fixed number of pages worth of Solr results.  Note
         // that if the Solr index is out of sync with the ILS, we may see fewer
         // results than expected.
         $tmp = $searchObject->getResultSummary();
         $limit = $tmp['perPage'];
         if (isset($searchSettings['NewItem']['result_pages'])) {
             $resultPages = intval($searchSettings['NewItem']['result_pages']);
             if ($resultPages < 1) {
                 $resultPages = 10;
             }
         } else {
             $resultPages = 10;
         }
         if (isset($configArray['Site']['indexBasedNewItems']) && $configArray['Site']['indexBasedNewItems']) {
             // Build RSS Feed for Results (if requested)
             if ($searchObject->getView() == 'rss') {
                 // Throw the XML to screen
                 echo $searchObject->buildRSS();
                 // And we're done
                 exit;
             }
             // Process Search
             $result = $searchObject->processSearch(false, true);
             if (PEAR::isError($result)) {
                 PEAR::raiseError($result->getMessage());
             }
             // Store recommendations (facets, etc.)
             $interface->assign('topRecommendations', $searchObject->getRecommendationsTemplates('top'));
             $interface->assign('sideRecommendations', $searchObject->getRecommendationsTemplates('side'));
         } else {
             $newItems = $catalog->getNewItems(1, $limit * $resultPages, $_GET['range'], isset($_GET['department']) ? $_GET['department'] : null);
             // Special case -- if no new items were found, don't bother hitting
             // the index engine:
             if ($newItems['count'] > 0) {
                 // Query Index for BIB Data
                 $bibIDs = array();
                 for ($i = 0; $i < count($newItems['results']); $i++) {
                     $bibIDs[] = $newItems['results'][$i]['id'];
                 }
                 if (!$searchObject->setQueryIDs($bibIDs)) {
                     $interface->assign('infoMsg', 'too_many_new_items');
                 }
                 // Build RSS Feed for Results (if requested)
                 if ($searchObject->getView() == 'rss') {
                     // Throw the XML to screen
                     echo $searchObject->buildRSS();
                     // And we're done
                     exit;
                 }
                 // Process Search
                 $result = $searchObject->processSearch(false, true);
                 if (PEAR::isError($result)) {
                     PEAR::raiseError($result->getMessage());
//.........这里部分代码省略.........
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:101,代码来源:NewItem.php

示例13: UInterface


//.........这里部分代码省略.........
     } else {
         $base = false;
     }
     $this->assign('openUrlBase', empty($base) ? false : $base);
     // Other OpenURL settings:
     $this->assign('openUrlWindow', empty($configArray['OpenURL']['window_settings']) ? false : $configArray['OpenURL']['window_settings']);
     $this->assign('openUrlGraphic', empty($configArray['OpenURL']['graphic']) ? false : $configArray['OpenURL']['graphic']);
     $this->assign('openUrlGraphicWidth', empty($configArray['OpenURL']['graphic_width']) ? false : $configArray['OpenURL']['graphic_width']);
     $this->assign('openUrlGraphicHeight', empty($configArray['OpenURL']['graphic_height']) ? false : $configArray['OpenURL']['graphic_height']);
     if (isset($configArray['OpenURL']['embed']) && !empty($configArray['OpenURL']['embed'])) {
         include_once 'sys/Counter.php';
         $this->assign('openUrlEmbed', true);
         $this->assign('openUrlCounter', new Counter());
     }
     $this->assign('currentTab', 'Search');
     $this->assign('authMethod', $configArray['Authentication']['method']);
     if (isset($configArray['Authentication']['libraryCard']) && !$configArray['Authentication']['libraryCard']) {
         $this->assign('libraryCard', false);
     } else {
         $this->assign('libraryCard', true);
     }
     $this->assign('sidebarOnLeft', !isset($configArray['Site']['sidebarOnLeft']) ? false : $configArray['Site']['sidebarOnLeft']);
     $piwikUrl = isset($configArray['Piwik']['url']) ? $configArray['Piwik']['url'] : false;
     if ($piwikUrl && isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
         $piwikUrl = preg_replace('/^http:/', 'https:', $piwikUrl);
     }
     $this->assign('piwikUrl', $piwikUrl);
     $this->assign('piwikSiteId', !isset($configArray['Piwik']['site_id']) ? false : $configArray['Piwik']['site_id']);
     // Create prefilter list
     $prefilters = getExtraConfigArray('prefilters');
     if (isset($prefilters['Prefilters'])) {
         $filters = array();
         foreach ($prefilters['Prefilters'] as $key => $filter) {
             $filters[$key] = $filter;
         }
         $this->assign('prefilterList', $filters);
     }
     if (isset($_REQUEST['prefiltered'])) {
         $this->assign('activePrefilter', $_REQUEST['prefiltered']);
     }
     $metalib = getExtraConfigArray('MetaLib');
     if (!empty($metalib)) {
         $this->assign('metalibEnabled', isset($metalib['General']['enabled']) ? $metalib['General']['enabled'] : true);
     }
     $pci = getExtraConfigArray('PCI');
     if (!empty($pci)) {
         $this->assign('pciEnabled', isset($pci['General']['enabled']) ? $pci['General']['enabled'] : true);
     }
     $rssFeeds = getExtraConfigArray('rss');
     if (isset($rssFeeds)) {
         $this->assign('rssFeeds', $rssFeeds);
     }
     $catalog = ConnectionManager::connectToCatalog();
     $this->assign("offlineMode", $catalog->getOfflineMode());
     $hideLogin = isset($configArray['Authentication']['hideLogin']) ? $configArray['Authentication']['hideLogin'] : false;
     $this->assign("hideLogin", $hideLogin ? true : $catalog->loginIsHidden());
     if (isset($configArray['Site']['development']) && $configArray['Site']['development']) {
         $this->assign('developmentSite', true);
     }
     if (isset($configArray['Site']['dualResultsEnabled']) && $configArray['Site']['dualResultsEnabled']) {
         $this->assign('dualResultsEnabled', true);
     }
     // Resolve enabled context-help ids
     $contextHelp = array();
     if (isset($configArray['ContextHelp'])) {
         foreach ($configArray['ContextHelp'] as $key => $val) {
             if ((bool) $val) {
                 $contextHelp[] = $key;
             }
         }
     }
     $this->assign('contextHelp', $contextHelp);
     // Set Advanced Search start year and scale
     // The default values:
     $advSearchYearScale = array(0, 900, 1800, 1910);
     $yearScale = !isset($configArray['Site']['advSearchYearScale']) ? false : $configArray['Site']['advSearchYearScale'];
     if (isset($yearScale)) {
         $scaleArray = explode(',', $yearScale);
         $i = count($scaleArray);
         // Do we have more values or just the starting year
         if ($i > 1) {
             $j = 0;
             if ($i <= 4) {
                 while ($j < $i) {
                     $advSearchYearScale[$j] = (int) $scaleArray[$j];
                     $j++;
                 }
             } else {
                 while ($j < 4) {
                     $advSearchYearScale[$j] = (int) $scaleArray[$j];
                     $j++;
                 }
             }
         } else {
             // Only the starting year is set
             $advSearchYearScale[0] = (int) $yearScale;
         }
     }
     $this->assign('advSearchYearScale', $advSearchYearScale);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:101,代码来源:Interface.php

示例14: changePickUpLocation

 /**
  * Change pick up location of a hold
  *
  * @return void
  * @access public
  */
 public function changePickUpLocation()
 {
     if (isset($_REQUEST['reservationId'])) {
         // check if user is logged in
         $user = UserAccount::isLoggedIn();
         if (!$user) {
             return $this->output(array('msg' => translate('You must be logged in first')), JSON::STATUS_NEED_AUTH);
         }
         $catalog = ConnectionManager::connectToCatalog();
         if ($catalog && $catalog->status) {
             if ($patron = UserAccount::catalogLogin()) {
                 if (!PEAR::isError($patron)) {
                     $result = $catalog->changePickupLocation($patron, array('pickup' => $_REQUEST['pickup'], 'reservationId' => $_REQUEST['reservationId'], 'created' => $_REQUEST['created'], 'expires' => $_REQUEST['expires']));
                     if (!$result['success']) {
                         return $this->output(array($result['sysMessage']), JSON::STATUS_ERROR);
                     }
                     return $this->output(array($result), JSON::STATUS_OK);
                 } else {
                     return $this->output($patron->getMessage(), JSON::STATUS_ERROR);
                 }
             }
         }
     }
     return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:31,代码来源:JSON_Hold.php

示例15: saveAccount

 /**
  * Validate and save account information after editing
  *
  * @return boolean Success
  */
 protected function saveAccount()
 {
     global $interface;
     global $user;
     $username = $_POST['username'];
     $password = $_POST['password'];
     $loginTarget = isset($_POST['login_target']) ? $_POST['login_target'] : false;
     if ($loginTarget) {
         $username = "{$loginTarget}.{$username}";
     }
     $catalog = ConnectionManager::connectToCatalog();
     $result = $catalog->patronLogin($username, $password);
     if (!$result || PEAR::isError($result)) {
         $interface->assign('errorMsg', $result ? $result->getMessage() : 'authentication_error_failed');
         $this->editAccount(isset($_REQUEST['id']) ? $_REQUEST['id'] : null);
         return false;
     }
     $exists = false;
     $account = new User_account();
     $account->user_id = $user->id;
     if (isset($_REQUEST['id']) && $_REQUEST['id']) {
         $account->id = $_REQUEST['id'];
         $exists = $account->find(true);
     }
     // Check that the user name is not in use in another account
     if (!$exists || $account->cat_username != $username) {
         $otherAccount = new User_account();
         $otherAccount->user_id = $user->id;
         $otherAccount->cat_username = $username;
         if ($otherAccount->find()) {
             $interface->assign('errorMsg', 'Username already in use in another library card');
             $this->editAccount(isset($_REQUEST['id']) ? $_REQUEST['id'] : null);
             return false;
         }
     }
     if (!$exists) {
         $account->created = date('Y-m-d h:i:s');
     } else {
         if ($user->cat_username == $account->cat_username) {
             // Active account modified, update
             UserAccount::activateCatalogAccount($username, $password, $account->home_library);
         }
     }
     $account->account_name = isset($_REQUEST['account_name']) ? $_REQUEST['account_name'] : '-';
     $account->description = isset($_REQUEST['description']) ? $_REQUEST['description'] : '';
     $account->cat_username = $username;
     $account->cat_password = $password;
     if ($exists) {
         $account->update();
     } else {
         $account->insert();
         // If this is the first one, activate it
         if (count($user->getCatalogAccounts()) == 1) {
             UserAccount::activateCatalogAccount($username, $password, $account->home_library);
         }
     }
     return true;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:63,代码来源:Accounts.php


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