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


PHP PEAR_Singleton::raiseError方法代码示例

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


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

示例1: saveChanges

 private function saveChanges($user)
 {
     global $interface;
     $resource = new Resource();
     $resource->id = $_REQUEST['resourceId'];
     if ($resource->find(true)) {
         $interface->assign('resource', $resource);
     } else {
         PEAR_Singleton::raiseError(new PEAR_Error("Could not find resource {$_REQUEST['resourceId']}"));
     }
     // Loop through the list of lists on the edit screen:
     foreach ($_POST['lists'] as $listId) {
         // Create a list object for the current list:
         $list = new User_list();
         if ($listId != '') {
             $list->id = $listId;
             $list->find(true);
         } else {
             PEAR_Singleton::raiseError(new PEAR_Error('List ID Missing'));
         }
         // Extract tags from the user input:
         preg_match_all('/"[^"]*"|[^ ]+/', $_POST['tags' . $listId], $tagArray);
         // Save extracted tags and notes:
         $user->addResource($resource, $list, $tagArray[0], $_POST['notes' . $listId]);
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:26,代码来源:Edit.php

示例2: launch

 function launch()
 {
     global $interface;
     global $configArray;
     // Sanitize the topic name to include only alphanumeric characters
     // or underscores.
     $safe_topic = preg_replace('/[^\\w]/', '', $_GET['topic']);
     // Construct three possible template names -- the help screen in the current
     // selected language, help in the site's default language, and help in English
     // (most likely to exist).  The code will attempt to display most appropriate
     // help screen that actually exists.
     $tpl_user = 'Help/' . $interface->getLanguage() . "/{$safe_topic}.tpl";
     $tpl_site = "Help/{$configArray['Site']['language']}/{$safe_topic}.tpl";
     $tpl_en = 'Help/en/' . $safe_topic . '.tpl';
     // Best case -- help is available in the user's chosen language
     if ($interface->template_exists($tpl_user)) {
         $interface->setTemplate($tpl_user);
         // Compromise -- help is available in the site's default language
     } else {
         if ($interface->template_exists($tpl_site)) {
             $interface->setTemplate($tpl_site);
             $interface->assign('warning', true);
             // Last resort -- help is available in English
         } else {
             if ($interface->template_exists($tpl_en)) {
                 $interface->setTemplate($tpl_en);
                 $interface->assign('warning', true);
                 // Error -- help isn't available at all!
             } else {
                 PEAR_Singleton::raiseError(new PEAR_Error('Unknown Help Page'));
             }
         }
     }
     $interface->display('Help/help.tpl');
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:35,代码来源:Home.php

示例3: getLightbox

 function getLightbox()
 {
     global $configArray;
     global $interface;
     // Assign our followup
     $interface->assign('followupModule', $_GET['followupModule']);
     $interface->assign('followupAction', $_GET['followupAction']);
     $interface->assign('followupId', $_GET['followupId']);
     // Sanitize incoming parameters
     $module = preg_replace('/[^\\w]/', '', $_GET['submodule']);
     $action = preg_replace('/[^\\w]/', '', $_GET['subaction']);
     // Call Action
     $path = 'services/' . $module . '/' . $action . '.php';
     if (is_readable($path)) {
         require_once $path;
         if (class_exists($action)) {
             $service = new $action();
             $page = $service->launch();
             $interface->assign('page', $page);
         } else {
             PEAR_Singleton::raiseError(new PEAR_Error('Unknown Action'));
         }
     } else {
         PEAR_Singleton::raiseError(new PEAR_Error("Cannot Load Action '{$action}' for Module '{$module}'"));
     }
     return $interface->fetch('AJAX/lightbox.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:27,代码来源:Home.php

示例4: launch

 function launch()
 {
     global $interface;
     global $finesIndexEngine;
     global $configArray;
     $ils = $configArray['Catalog']['ils'];
     $interface->assign('showDate', $ils == 'Koha' || $ils == 'Horizon');
     $interface->assign('showReason', $ils != 'Koha');
     $interface->assign('showOutstanding', $ils == 'Koha');
     // Get My Fines
     if ($patron = $this->catalogLogin()) {
         if (PEAR_Singleton::isError($patron)) {
             PEAR_Singleton::raiseError($patron);
         }
         if ($this->catalog->checkFunction('getMyFines')) {
             $result = $this->catalog->getMyFines($patron, true);
             if (!PEAR_Singleton::isError($result)) {
                 $interface->assign('fines', $result);
             } else {
                 PEAR_Singleton::raiseError($result);
             }
         } else {
             $interface->assign('finesData', translate('This catalog does not support listing fines.'));
         }
     }
     $interface->assign('sidebar', 'MyAccount/account-sidebar.tpl');
     $interface->setTemplate('fines.tpl');
     $interface->setPageTitle('My Fines');
     $interface->display('layout.tpl');
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:30,代码来源:Fines.php

示例5: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     global $timer;
     // Get My Transactions
     if ($this->catalog->status) {
         if ($user->cat_username) {
             $patron = $this->catalog->patronLogin($user->cat_username, $user->cat_password);
             $timer->logTime("Logged in patron to get checked out items.");
             if (PEAR_Singleton::isError($patron)) {
                 PEAR_Singleton::raiseError($patron);
             }
             $patronResult = $this->catalog->getMyProfile($patron);
             if (!PEAR_Singleton::isError($patronResult)) {
                 $interface->assign('profile', $patronResult);
             }
             $timer->logTime("Got patron profile to get checked out items.");
             // Define sorting options
             $sortOptions = array('title' => 'Title', 'author' => 'Author', 'dueDate' => 'Due Date', 'format' => 'Format');
             $interface->assign('sortOptions', $sortOptions);
             $selectedSortOption = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'dueDate';
             $interface->assign('defaultSortOption', $selectedSortOption);
             $interface->assign('showNotInterested', false);
             require_once ROOT_DIR . '/Drivers/EContentDriver.php';
             $driver = new EContentDriver();
             if (isset($_REQUEST['multiAction']) && $_REQUEST['multiAction'] == 'suspendSelected') {
                 $ids = array();
                 foreach ($_REQUEST['unavailableHold'] as $id => $selected) {
                     $ids[] = $id;
                 }
                 $suspendDate = $_REQUEST['suspendDate'];
                 $dateToReactivate = strtotime($suspendDate);
                 $suspendResult = $driver->suspendHolds($ids, $dateToReactivate);
                 //Redirect back to the EContentHolds page
                 header("Location: " . $configArray['Site']['path'] . "/MyResearch/EContentHolds?section=unavailable");
             }
             $result = $driver->getMyHolds($user);
             $interface->assign('holds', $result['holds']);
             $timer->logTime("Loaded econtent from catalog.");
         }
     }
     $hasSeparateTemplates = $interface->template_exists('MyResearch/eContentAvailableHolds.tpl');
     if ($hasSeparateTemplates) {
         $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : 'available';
         $interface->assign('section', $section);
         if ($section == 'available') {
             $interface->setPageTitle('Available eContent');
             $interface->setTemplate('eContentAvailableHolds.tpl');
         } else {
             $interface->setPageTitle('eContent On Hold');
             $interface->setTemplate('eContentUnavailableHolds.tpl');
         }
     } else {
         $interface->setTemplate('eContentHolds.tpl');
         $interface->setPageTitle('On Hold eContent');
     }
     $interface->display('layout.tpl');
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:60,代码来源:EContentHolds.php

示例6: launch

 function launch($msg = null)
 {
     global $interface;
     global $configArray;
     global $user;
     if (!($user = UserAccount::isLoggedIn())) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     // Save Data
     if (isset($_REQUEST['tagId'])) {
         //Remove the tag for the user.
         $resource = new Resource();
         if (isset($_REQUEST['resourceId'])) {
             $resource = $resource->staticGet('record_id', $_REQUEST['resourceId']);
             $resource->removeTag($_REQUEST['tagId'], $user, false);
             header('Location: ' . $configArray['Site']['path'] . '/Record/' . $_REQUEST['resourceId']);
             exit;
         } else {
             $resource->removeTag($_REQUEST['tagId'], $user, true);
             header('Location: ' . $configArray['Site']['path'] . '/MyResearch/Favorites');
             exit;
         }
     } else {
         //No id provided to delete raise an error?
         PEAR_Singleton::raiseError(new PEAR_Error('Tag Id Missing'));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:29,代码来源:RemoveTag.php

示例7: launch

 /**
  * Process parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     // Retrieve the record from the index
     if (!($record = $this->db->getRecord($_GET['id']))) {
         PEAR_Singleton::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     // Send basic information to the template.
     $interface->setPageTitle(isset($record['heading']) ? $record['heading'] : 'Heading unavailable.');
     $interface->assign('record', $record);
     // Load MARC data
     require_once ROOT_DIR . '/sys/MarcLoader.php';
     $marcRecord = MarcLoader::loadMarcRecordFromRecord($record);
     if (!$marcRecord) {
         PEAR_Singleton::raiseError(new PEAR_Error('Cannot Process MARC Record'));
     }
     $xml = trim($marcRecord->toXML());
     // Transform MARCXML
     $style = new DOMDocument();
     $style->load('services/Record/xsl/record-marc.xsl');
     $xsl = new XSLTProcessor();
     $xsl->importStyleSheet($style);
     $doc = new DOMDocument();
     if ($doc->loadXML($xml)) {
         $html = $xsl->transformToXML($doc);
         $interface->assign('details', $html);
     }
     // Assign the ID of the last search so the user can return to it.
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     // Display Page
     $interface->setTemplate('record.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:39,代码来源:Record.php

示例8: launch

 function launch()
 {
     global $interface;
     $id = $_GET['id'];
     $interface->assign('id', $id);
     $this->eContentRecord = new EContentRecord();
     $this->eContentRecord->id = $_GET['id'];
     $this->eContentRecord->find(true);
     $recordDriver = new EcontentRecordDriver();
     $recordDriver->setDataObject($this->eContentRecord);
     $interface->assign('sourceUrl', $this->eContentRecord->sourceUrl);
     $interface->assign('source', $this->eContentRecord->source);
     $interface->setPageTitle(translate('Copies') . ': ' . $recordDriver->getBreadcrumb());
     $driver = new EContentDriver();
     $holdings = $driver->getHolding($id);
     $showEContentNotes = false;
     foreach ($holdings as $holding) {
         if (strlen($holding->notes) > 0) {
             $showEContentNotes = true;
         }
     }
     $interface->assign('showEContentNotes', $showEContentNotes);
     $interface->assign('holdings', $holdings);
     //Load status summary
     $result = $driver->getStatusSummary($id, $holdings);
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result);
     }
     $holdingData->holdingsSummary = $result;
     $interface->assign('subTemplate', 'view-holdings.tpl');
     $interface->setTemplate('view-alt.tpl');
     // Display Page
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:34,代码来源:Copies.php

示例9: launch

 function launch()
 {
     global $configArray;
     global $interface;
     //Grab the tracking data
     $recordId = $_REQUEST['id'];
     $ipAddress = $_SERVER['REMOTE_ADDR'];
     $field856Index = isset($_REQUEST['index']) ? $_REQUEST['index'] : null;
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $url = $configArray['Index']['url'];
     $this->db = new $class($url);
     // Process MARC Data
     require_once ROOT_DIR . '/sys/MarcLoader.php';
     $marcRecord = MarcLoader::loadMarcRecordByILSId($recordId);
     if ($marcRecord) {
         $this->marcRecord = $marcRecord;
     } else {
         PEAR_Singleton::raiseError(new PEAR_Error("Failed to load the MAC record for this title."));
     }
     /** @var File_MARC_Data_Field[] $linkFields */
     $linkFields = $marcRecord->getFields('856');
     if ($linkFields) {
         $cur856Index = 0;
         foreach ($linkFields as $marcField) {
             $cur856Index++;
             if ($cur856Index == $field856Index) {
                 //Get the link
                 if ($marcField->getSubfield('u')) {
                     $link = $marcField->getSubfield('u')->getData();
                     $externalLink = $link;
                 }
             }
         }
     }
     $linkParts = parse_url($externalLink);
     //Insert into the purchaseLinkTracking table
     require_once ROOT_DIR . '/sys/BotChecker.php';
     if (!BotChecker::isRequestFromBot()) {
         require_once ROOT_DIR . '/sys/ExternalLinkTracking.php';
         $externalLinkTracking = new ExternalLinkTracking();
         $externalLinkTracking->ipAddress = $ipAddress;
         $externalLinkTracking->recordId = $recordId;
         $externalLinkTracking->linkUrl = $externalLink;
         $externalLinkTracking->linkHost = $linkParts['host'];
         $result = $externalLinkTracking->insert();
     }
     //redirects them to the link they clicked
     if ($externalLink != "") {
         header("Location:" . $externalLink);
     } else {
         PEAR_Singleton::raiseError(new PEAR_Error("Failed to load link for this record."));
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:54,代码来源:Link.php

示例10: __construct

 public function __construct($record)
 {
     // Call the parent's constructor...
     parent::__construct($record);
     // Also process the MARC record:
     require_once ROOT_DIR . '/sys/MarcLoader.php';
     $this->marcRecord = MarcLoader::loadMarcRecordFromRecord($record);
     if (!$this->marcRecord) {
         PEAR_Singleton::raiseError(new PEAR_Error('Cannot Process MARC Record for record ' . $record['id']));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:11,代码来源:MarcRecord.php

示例11: launch

 function launch()
 {
     global $interface;
     $interface->caching = false;
     // Retrieve User Search History
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     // Initialise from the current search globals
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init();
     // TODO : Stats
     $result = $searchObject->processSearch();
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result->getMessage());
     }
     $interface->assign('sortList', $searchObject->getSortList());
     $interface->assign('lookfor', $searchObject->displayQuery());
     $interface->assign('searchType', $searchObject->getSearchType());
     $interface->assign('searchIndex', $searchObject->getSearchIndex());
     $interface->assign('qtime', round($searchObject->getQuerySpeed(), 2));
     $summary = $searchObject->getResultSummary();
     // Post processing, remember that the REAL results here with regards to
     //   numbers and pagination are the author facet, not the document
     //   results from the solr index. So access '$summary' with care.
     $page = $summary['page'];
     $limit = $summary['perPage'];
     // The search object will have returned an array of author facets that
     // is offset to display the current page of results but which has more
     // than a single page worth of content.  This allows a user to dig deeper
     // and deeper into the result set even though we have no way of finding
     // out the exact count of results without risking a memory overflow or
     // long delay.  We need to use the current page information to adjust the
     // known total count accordingly, and we need to use the page size to
     // crop off extra results when displaying the list to the user.
     // See VUFIND-127 in JIRA for more details.
     $authors = $result['facet_counts']['facet_fields']['authorStr'];
     $cnt = ($page - 1) * $limit + count($authors);
     $interface->assign('recordSet', array_slice($authors, 0, $limit));
     $interface->assign('recordCount', $cnt);
     $interface->assign('recordStart', ($page - 1) * $limit + 1);
     if ($cnt < $limit || $page * $limit > $cnt) {
         $interface->assign('recordEnd', $cnt);
     } else {
         $interface->assign('recordEnd', $page * $limit);
     }
     $link = $searchObject->renderLinkPageTemplate();
     $options = array('totalItems' => $cnt, 'fileName' => $link);
     $pager = new VuFindPager($options);
     $interface->assign('pageLinks', $pager->getLinks());
     $interface->setPageTitle('Author Browse');
     $interface->setTemplate('list.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:52,代码来源:Search.php

示例12: init

 public function init($lt)
 {
     global $configArray;
     // Set defaults if nothing set in config file.
     self::$path = isset($configArray['Session']['file_save_path']) ? $configArray['Session']['file_save_path'] : '/tmp/vufind_sessions';
     // Die if the session directory does not exist and cannot be created.
     if (!file_exists(self::$path) || !is_dir(self::$path)) {
         if (!@mkdir(self::$path)) {
             PEAR_Singleton::raiseError(new PEAR_Error("Cannot access session save path: " . self::$path));
         }
     }
     // Call standard session initialization from this point.
     parent::init($lt);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:14,代码来源:FileSession.php

示例13: launch

 function launch()
 {
     global $configArray;
     global $interface;
     $libraryName = $configArray['Site']['title'];
     //Grab the tracking data
     $store = urldecode(strip_tags($_GET['store']));
     $recordId = $_REQUEST['id'];
     $ipAddress = $_SERVER['REMOTE_ADDR'];
     // Retrieve Full Marc Record
     $eContentRecord = new EContentRecord();
     $eContentRecord->id = $recordId;
     if (!$eContentRecord->find(true)) {
         PEAR_Singleton::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     $title = str_replace("/", "", $eContentRecord->title);
     if ($eContentRecord->purchaseUrl == null) {
         switch ($store) {
             case "Tattered Cover":
                 $purchaseLinkUrl = "http://www.tatteredcover.com/search/apachesolr_search/" . urlencode($title) . "?source=" . urlencode($libraryName);
                 break;
             case "Barnes and Noble":
                 $purchaseLinkUrl = "http://www.barnesandnoble.com/s/?title=" . urlencode($title) . "&source=" . urlencode($libraryName);
                 break;
             case "Amazon":
                 $purchaseLinkUrl = "http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=" . urlencode($title) . "&source=" . urlencode($libraryName);
                 break;
         }
     } else {
         // Process MARC Data
         $purchaseLinkUrl = $eContentRecord->purchaseUrl;
     }
     //Do not track purchases from Bots
     require_once ROOT_DIR . '/sys/BotChecker.php';
     if (!BotChecker::isRequestFromBot()) {
         require_once ROOT_DIR . '/sys/PurchaseLinkTracking.php';
         $tracking = new PurchaseLinkTracking();
         $tracking->ipAddress = $ipAddress;
         $tracking->recordId = 'econtentRecord' . $recordId;
         $tracking->store = $store;
         $insertResult = $tracking->insert();
     }
     //redirects them to the link they clicked
     if ($purchaseLinkUrl != "") {
         header("Location:" . $purchaseLinkUrl);
     } else {
         PEAR_Singleton::raiseError(new PEAR_Error("Failed to load link for this title."));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:49,代码来源:Purchase.php

示例14: init

 public function init($lt, $rememberMeLifetime)
 {
     global $configArray;
     // Set defaults if nothing set in config file.
     $host = isset($configArray['Session']['memcache_host']) ? $configArray['Session']['memcache_host'] : 'localhost';
     $port = isset($configArray['Session']['memcache_port']) ? $configArray['Session']['memcache_port'] : 11211;
     $timeout = isset($configArray['Session']['memcache_connection_timeout']) ? $configArray['Session']['memcache_connection_timeout'] : 1;
     // Connect to Memcache:
     self::$connection = new Memcache();
     if (!@self::$connection->connect($host, $port, $timeout)) {
         PEAR_Singleton::raiseError(new PEAR_Error("Could not connect to Memcache (host = {$host}, port = {$port})."));
     }
     // Call standard session initialization from this point.
     parent::init($lt, $rememberMeLifetime);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:15,代码来源:MemcacheSession.php

示例15: sendRequest

 /**
  * Send an NCIP request.
  *
  * @access  private
  * @param   string  $xml            XML request document
  * @return  object                  SimpleXMLElement parsed from response
  */
 private function sendRequest($xml)
 {
     // Make the NCIP request:
     $client = new Proxy_Request(null, array('useBrackets' => false));
     $client->setMethod(HTTP_REQUEST_METHOD_POST);
     $client->setURL($this->config['Catalog']['url']);
     $client->addPostData('NCIP', $xml);
     $result = $client->sendRequest();
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result);
     }
     // Process the NCIP response:
     $response = $client->getResponseBody();
     if ($result = @simplexml_load_string($response)) {
         return $result;
     } else {
         PEAR_Singleton::raiseError(new PEAR_Error("Problem parsing XML"));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:26,代码来源:XCNCIP.php


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