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


PHP Resource::find方法代码示例

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


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

示例1: launch

 function launch()
 {
     global $interface;
     global $configArray;
     $rating = $_REQUEST['rating'];
     $interface->assign('rating', $rating);
     $id = $_REQUEST['id'];
     // Check if user is logged in
     if (!$this->user) {
         // Needed for "back to record" link in view-alt.tpl:
         $interface->assign('id', $id);
         //Display the login form
         $login = $interface->fetch('Record/ajax-rate-login.tpl');
         header('Content-type: text/plain');
         header('Cache-Control: no-cache, must-revalidate');
         // HTTP/1.1
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         echo json_encode(array('result' => 'true', 'loginForm' => $login));
         exit;
     }
     if (isset($_GET['submit'])) {
         global $user;
         //Save the rating
         $resource = new Resource();
         $resource->record_id = $id;
         $resource->source = 'VuFind';
         if (!$resource->find(true)) {
             $resource->insert();
         }
         $resource->addRating($rating, $user);
         return json_encode(array('result' => 'true', 'rating' => $rating));
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:33,代码来源:Rate.php

示例2: clearUserRating

 function clearUserRating()
 {
     global $user;
     $source = $_REQUEST['source'];
     $recordId = $_REQUEST['recordId'];
     $result = array('result' => false);
     if ($source == 'VuFind') {
         require_once ROOT_DIR . '/Drivers/marmot_inc/UserRating.php';
         $resource = new Resource();
         $resource->record_id = $recordId;
         $resource->source = 'VuFind';
         if ($resource->find(true)) {
             $rating = new UserRating();
             $rating->userid = $user->id;
             $rating->resourceid = $resource->id;
             if ($rating->find(true)) {
                 if ($rating->delete()) {
                     $result = array('result' => true, 'message' => 'deleted user rating for resource ' . $rating->resourceid);
                 }
             }
         }
     } else {
         require_once ROOT_DIR . '/sys/eContent/EContentRating.php';
         $econtentRating = new EContentRating();
         $econtentRating->userId = $user->id;
         $econtentRating->recordId = $recordId;
         if ($econtentRating->find(true)) {
             if ($econtentRating->delete()) {
                 $result = array('result' => true);
             }
         }
     }
     return json_encode($result);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:34,代码来源:AJAX.php

示例3: launch

 public function launch()
 {
     global $interface;
     global $user;
     //Load user ratings
     require_once ROOT_DIR . '/Drivers/marmot_inc/UserRating.php';
     $rating = new UserRating();
     $resource = new Resource();
     $rating->joinAdd($resource);
     $rating->userid = $user->id;
     $rating->find();
     $ratings = array();
     while ($rating->fetch()) {
         if ($rating->deleted == 0) {
             $ratings[] = array('id' => $rating->id, 'title' => $rating->title, 'author' => $rating->author, 'format' => $rating->format, 'rating' => $rating->rating, 'resourceId' => $rating->resourceid, 'fullId' => $rating->record_id, 'shortId' => $rating->shortId, 'link' => '/Record/' . $rating->record_id . '/Home', 'dateRated' => $rating->dateRated, 'ratingData' => array('user' => $rating->rating), 'source' => 'VuFind');
         }
     }
     //Load econtent ratings
     require_once ROOT_DIR . '/sys/eContent/EContentRating.php';
     $eContentRating = new EContentRating();
     $econtentRecord = new EContentRecord();
     $eContentRating->joinAdd($econtentRecord);
     $eContentRating->userId = $user->id;
     $eContentRating->find();
     while ($eContentRating->fetch()) {
         if ($eContentRating->status == 'active') {
             $resource = new Resource();
             $resource->record_id = $eContentRating->id;
             $resource->source = 'eContent';
             $resource->find(true);
             $ratings[] = array('id' => $eContentRating->id, 'title' => $eContentRating->title, 'author' => $eContentRating->author, 'format' => $resource->format_category, 'rating' => $eContentRating->rating, 'fullId' => $eContentRating->id, 'shortId' => $eContentRating->id, 'link' => '/EcontentRecord/' . $eContentRating->id . '/Home', 'dateRated' => $eContentRating->dateRated, 'ratingData' => array('user' => $eContentRating->rating), 'source' => 'eContent');
         }
     }
     asort($ratings);
     //Load titles the user is not interested in
     $notInterested = array();
     $notInterestedObj = new NotInterested();
     $resource = new Resource();
     $notInterestedObj->joinAdd($resource);
     $notInterestedObj->userId = $user->id;
     $notInterestedObj->deleted = 0;
     $notInterestedObj->selectAdd('user_not_interested.id as user_not_interested_id');
     $notInterestedObj->find();
     while ($notInterestedObj->fetch()) {
         if ($notInterestedObj->source == 'VuFind') {
             $link = '/Record/' . $notInterestedObj->record_id;
         } else {
             $link = '/EcontentRecord/' . $notInterestedObj->record_id;
         }
         if ($notInterestedObj->deleted == 0) {
             $notInterested[] = array('id' => $notInterestedObj->user_not_interested_id, 'title' => $notInterestedObj->title, 'author' => $notInterestedObj->author, 'dateMarked' => $notInterestedObj->dateMarked, 'link' => $link);
         }
     }
     $interface->assign('ratings', $ratings);
     $interface->assign('notInterested', $notInterested);
     $interface->setPageTitle('My Ratings');
     $interface->setTemplate('myRatings.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:59,代码来源:MyRatings.php

示例4: getRecord

 /**
  * Retrieves a document specified by the ID.
  *
  * @param string $id The document to retrieve from the MetaLib API/cache
  *
  * @throws object    PEAR Error
  * @return string    The requested resource
  * @access public
  */
 public function getRecord($id)
 {
     if ($this->debug) {
         echo "<pre>Get Record: {$id}</pre>\n";
     }
     list($queryId, $index) = explode('_', $id);
     $result = $this->getCachedResults($queryId);
     if ($result === false) {
         // Check from database, this could be in a favorite list
         $resource = new Resource();
         $resource->record_id = $id;
         $resource->source = 'MetaLib';
         if ($resource->find(true) && $resource->data !== null) {
             $data = unserialize($resource->data);
             if ($data !== null) {
                 return $data;
             }
         }
         PEAR::raiseError(new PEAR_Error('Record not found'));
     }
     if ($index < 1 || $index > count($result['documents'])) {
         PEAR::raiseError(new PEAR_Error('Invalid record id'));
     }
     $result['documents'] = array_slice($result['documents'], $index - 1, 1);
     return $result['documents'][0];
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:35,代码来源:MetaLib.php

示例5: MarkNotInterested

 function MarkNotInterested()
 {
     global $user;
     $recordId = $_REQUEST['recordId'];
     $source = $_REQUEST['source'];
     require_once ROOT_DIR . '/sys/NotInterested.php';
     $notInterested = new NotInterested();
     $notInterested->userId = $user->id;
     require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php';
     $resource = new Resource();
     $resource->source = $source;
     $resource->record_id = $recordId;
     if ($resource->find(true)) {
         $notInterested->resourceId = $resource->id;
         if (!$notInterested->find(true)) {
             $notInterested->dateMarked = time();
             $notInterested->insert();
             $result = array('result' => true);
         } else {
             $result = array('result' => false, 'message' => "This record was already marked as something you aren't interested in.");
         }
     } else {
         $result = array('result' => false, 'message' => 'Unable to find the resource specified.');
     }
     return json_encode($result);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:26,代码来源:AJAX.php

示例6: returnRecordInReadingHistory

 public function returnRecordInReadingHistory($eContentRecord, $user)
 {
     //Get the resource for the record
     $resource = new Resource();
     $resource->record_id = $eContentRecord->id;
     $resource->source = 'eContent';
     if ($resource->find(true)) {
         //Check to see if there is an existing entry
         require_once ROOT_DIR . '/sys/ReadingHistoryEntry.php';
         $readingHistoryEntry = new ReadingHistoryEntry();
         $readingHistoryEntry->userId = $user->id;
         $readingHistoryEntry->resourceId = $resource->id;
         if ($readingHistoryEntry->find(true)) {
             $readingHistoryEntry->lastCheckoutDate = date('Y-m-d');
             $ret = $readingHistoryEntry->update();
         }
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:18,代码来源:EContentDriver.php

示例7: remove_photos

 public function remove_photos($resourceId, $photoId)
 {
     $resource = Resource::find($resourceId);
     $resource->photos()->detach($photoId);
     return Redirect::to('resources/' . $resourceId)->with('success', "Successfully removed photos from {$resource->name}");
 }
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:6,代码来源:ResourcesController.php

示例8: getOtherEditions

 function getOtherEditions()
 {
     global $interface;
     global $analytics;
     $id = $_REQUEST['id'];
     $isEContent = $_REQUEST['isEContent'];
     if ($isEContent == 'true') {
         require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
         $econtentRecord = new EContentRecord();
         $econtentRecord->id = $id;
         if ($econtentRecord->find(true)) {
             $otherEditions = OtherEditionHandler::getEditions($econtentRecord->id, $econtentRecord->getIsbn(), $econtentRecord->getIssn(), 10);
         } else {
             $error = "Sorry we couldn't find that record in the catalog.";
         }
     } else {
         $resource = new Resource();
         $resource->record_id = $id;
         $resource->source = 'VuFind';
         $solrId = $id;
         if ($resource->find(true)) {
             $otherEditions = OtherEditionHandler::getEditions($solrId, $resource->isbn, null, 10);
         } else {
             $error = "Sorry we couldn't find that record in the catalog.";
         }
     }
     if (isset($otherEditions)) {
         //Get resource for each edition
         $editionResources = array();
         if (is_array($otherEditions)) {
             foreach ($otherEditions as $edition) {
                 /** @var Resource $editionResource */
                 $editionResource = new Resource();
                 if (preg_match('/econtentRecord(\\d+)/', $edition['id'], $matches)) {
                     $editionResource->source = 'eContent';
                     $editionResource->record_id = trim($matches[1]);
                 } else {
                     $editionResource->record_id = $edition['id'];
                     $editionResource->source = 'VuFind';
                 }
                 if ($editionResource->find(true)) {
                     $editionResources[] = $editionResource;
                 } else {
                     $logger = new Logger();
                     $logger->log("Could not find resource {$editionResource->source} {$editionResource->record_id} - {$edition['id']}", PEAR_LOG_DEBUG);
                 }
             }
             $analytics->addEvent('Enrichment', 'Other Editions', count($otherEditions));
         } else {
             $analytics->addEvent('Enrichment', 'Other Editions Error');
         }
         $interface->assign('otherEditions', $editionResources);
         $interface->assign('popupTitle', 'Other Editions');
         $interface->assign('popupTemplate', 'Resource/otherEditions.tpl');
         echo $interface->fetch('popup-wrapper.tpl');
     } elseif (isset($error)) {
         $analytics->addEvent('Enrichment', 'Other Editions Error', $error);
         echo $error;
     } else {
         echo "There are no other editions for this title currently in the catalog.";
         $analytics->addEvent('Enrichment', 'Other Editions', 0, 'No Other ISBNs');
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:63,代码来源:AJAX.php

示例9: addTitlesToList

 /**
  * Add titles to a user list.
  *
  * Parameters:
  * <ul>
  * <li>username - The barcode of the user.  Can be truncated to the last 7 or 9 digits.</li>
  * <li>password - The pin number for the user. </li>
  * <li>listId   - The id of the list to add items to.</li>
  * <li>recordIds - The id of the record(s) to add to the list.</li>
  * <li>tags   - A comma separated string of tags to apply to the titles within the list. (optional)</li>
  * <li>notes  - descriptive text to apply to the titles.  Can be viewed while on the list.  (optional)</li>
  * </ul>
  *
  * Note: You may also provide the parameters to addTitlesToList and titles will be added to the list
  * after the list is created.
  *
  * Returns:
  * <ul>
  * <li>success - true if the account is valid and the titles could be added to the list, false if the username or password were incorrect or the list could not be created.</li>
  * <li>listId - the id of the list that titles were added to.</li>
  * <li>numAdded - the number of titles that were added to the list.</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/ListAPI?method=createList&username=23025003575917&password=1234&title=Test+List&description=Test&public=0
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{"success":true,"listId":"1688"}}
  * </code>
  */
 function addTitlesToList()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     if (!isset($_REQUEST['listId'])) {
         return array('success' => false, 'message' => 'You must provide the listId to add titles to.');
     }
     $recordIds = array();
     if (!isset($_REQUEST['recordIds'])) {
         return array('success' => false, 'message' => 'You must provide one or more records to add tot he list.');
     } else {
         if (!is_array($_REQUEST['recordIds'])) {
             $recordIds[] = $_REQUEST['recordIds'];
         } else {
             $recordIds = $_REQUEST['recordIds'];
         }
     }
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $list = new User_list();
         $list->id = $_REQUEST['listId'];
         $list->user_id = $user->id;
         if (!$list->find(true)) {
             return array('success' => false, 'message' => 'Unable to find the list to add titles to.');
         } else {
             $recordIds = $_REQUEST['recordIds'];
             $numAdded = 0;
             foreach ($recordIds as $id) {
                 $source = 'VuFind';
                 if (preg_match('/econtentRecord\\d+/i', $id)) {
                     $id = substr($id, 14);
                     $source = 'eContent';
                 }
                 $resource = new Resource();
                 $resource->record_id = $id;
                 $resource->source = $source;
                 if (!$resource->find(true)) {
                     $resource->insert();
                 }
                 if (isset($_REQUEST['tags'])) {
                     preg_match_all('/"[^"]*"|[^,]+/', $_REQUEST['tags'], $tagArray);
                     $tags = $tagArray[0];
                 } else {
                     $tags = array();
                 }
                 if (isset($_REQUEST['notes'])) {
                     $notes = $_REQUEST['notes'];
                 } else {
                     $notes = '';
                 }
                 if ($user->addResource($resource, $list, $tags, $notes)) {
                     $numAdded++;
                 }
             }
             return array('success' => true, 'listId' => $list->id, 'numAdded' => $numAdded);
         }
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:94,代码来源:ListAPI.php

示例10: saveRecord

 function saveRecord()
 {
     if ($this->user) {
         $list = new User_list();
         if ($_GET['list'] != '') {
             $list->id = $_GET['list'];
             $list->find(true);
         } else {
             $list->user_id = $this->user->id;
             $list->title = "My Favorites";
             $list->insert();
         }
         $resource = new Resource();
         $resource->record_id = $_GET['id'];
         if (isset($_GET['service'])) {
             $resource->source = $_GET['service'];
         } else {
             $resource->source = $_GET['source'];
         }
         if (!$resource->find(true)) {
             PEAR_Singleton::raiseError(new PEAR_Error('Unable find a resource for that title.'));
         }
         preg_match_all('/"[^"]*"|[^,]+/', $_GET['mytags'], $tagArray);
         $this->user->addResource($resource, $list, $tagArray[0], $_GET['notes']);
     } else {
         return false;
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:28,代码来源:Save.php

示例11: launch

 function launch()
 {
     global $interface;
     global $timer;
     global $configArray;
     global $user;
     // Load Supplemental Information
     Record_UserComments::loadComments();
     $timer->logTime('Loaded Comments');
     Record_Cite::loadCitation();
     $timer->logTime('Loaded Citations');
     if (isset($_REQUEST['id'])) {
         $recordId = $_REQUEST['id'];
     }
     if (isset($_REQUEST['strandsReqId']) && isset($configArray['Strands']['APID'])) {
         $url = "http://bizsolutions.strands.com/api2/event/clickedrecommendation.sbs?apid={$configArray['Strands']['APID']}&item={$recordId}&user={$user->id}&rrq={$_REQUEST['strandsReqId']}&tpl={$_REQUEST['strandsTpl']}";
         $response = file_get_contents($url);
     }
     if (isset($_REQUEST['searchId'])) {
         $_SESSION['searchId'] = $_REQUEST['searchId'];
         $interface->assign('searchId', $_SESSION['searchId']);
     } else {
         if (isset($_SESSION['searchId'])) {
             $interface->assign('searchId', $_SESSION['searchId']);
         }
     }
     //Load the Editorial Reviews
     //Populate an array of editorialReviewIds that match up with the recordId
     $editorialReview = new EditorialReview();
     $editorialReviewResults = array();
     $editorialReview->recordId = $recordId;
     $editorialReview->find();
     $editorialReviewResults['reviews'] = array('tabName' => 'Reviews', 'reviews' => array());
     if ($editorialReview->N > 0) {
         $ctr = 0;
         while ($editorialReview->fetch()) {
             $reviewKey = preg_replace('/\\W/', '_', strtolower($editorialReview->tabName));
             if (!array_key_exists($reviewKey, $editorialReviewResults)) {
                 $editorialReviewResults[$reviewKey] = array('tabName' => $editorialReview->tabName, 'reviews' => array());
             }
             $editorialReviewResults[$reviewKey]['reviews'][$ctr++] = get_object_vars($editorialReview);
         }
     }
     $interface->assign('editorialReviews', $editorialReviewResults);
     $interface->assign('recordId', $recordId);
     //Enable and disable functionality based on library settings
     global $library;
     global $locationSingleton;
     $location = $locationSingleton->getActiveLocation();
     if (isset($library)) {
         $interface->assign('showTextThis', $library->showTextThis);
         $interface->assign('showEmailThis', $library->showEmailThis);
         $interface->assign('showFavorites', $library->showFavorites);
         $interface->assign('linkToAmazon', $library->linkToAmazon);
         $interface->assign('enablePurchaseLinks', $library->linkToAmazon);
         $interface->assign('enablePospectorIntegration', $library->enablePospectorIntegration);
         if ($location != null) {
             $interface->assign('showAmazonReviews', $location->showAmazonReviews == 1 && $library->showAmazonReviews == 1 ? 1 : 0);
             $interface->assign('showStandardReviews', $location->showStandardReviews == 1 && $library->showStandardReviews == 1 ? 1 : 0);
             $interface->assign('showHoldButton', $location->showHoldButton == 1 && $library->showHoldButton == 1 ? 1 : 0);
         } else {
             $interface->assign('showAmazonReviews', $library->showAmazonReviews);
             $interface->assign('showStandardReviews', $library->showStandardReviews);
             $interface->assign('showHoldButton', $library->showHoldButton);
         }
         $interface->assign('showTagging', $library->showTagging);
         $interface->assign('showRatings', $library->showRatings);
         $interface->assign('showComments', $library->showComments);
         $interface->assign('tabbedDetails', $library->tabbedDetails);
         $interface->assign('showSeriesAsTab', $library->showSeriesAsTab);
         $interface->assign('showOtherEditionsPopup', 0);
         $interface->assign('show856LinksAsTab', $library->show856LinksAsTab);
         $interface->assign('showProspectorTitlesAsTab', $library->showProspectorTitlesAsTab);
     } else {
         $interface->assign('showTextThis', 1);
         $interface->assign('showEmailThis', 1);
         $interface->assign('showFavorites', 1);
         $interface->assign('linkToAmazon', 1);
         $interface->assign('enablePospectorIntegration', isset($configArray['Content']['Prospector']) && $configArray['Content']['Prospector'] == true ? 1 : 0);
         $interface->assign('enablePurchaseLinks', 1);
         if ($location != null) {
             $interface->assign('showAmazonReviews', $location->showAmazonReviews);
             $interface->assign('showStandardReviews', $location->showStandardReviews);
             $interface->assign('showHoldButton', $location->showHoldButton);
         } else {
             $interface->assign('showAmazonReviews', 1);
             $interface->assign('showStandardReviews', 1);
             $interface->assign('showHoldButton', 1);
         }
         $interface->assign('showTagging', 1);
         $interface->assign('showRatings', 1);
         $interface->assign('showComments', 1);
         $interface->assign('tabbedDetails', !isset($configArray['Content']['tabbedDetails']) || $configArray['Content']['tabbedDetails'] == false ? 0 : 1);
         $interface->assign('showSeriesAsTab', 0);
         $interface->assign('showOtherEditionsPopup', 0);
         $interface->assign('show856LinksAsTab', 1);
         $interface->assign('showProspectorTitlesAsTab', 0);
     }
     if (!isset($this->isbn)) {
         $interface->assign('showOtherEditionsPopup', false);
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:Home.php

示例12: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     global $timer;
     // Get My Transactions
     $oneOrMoreRenewableItems = false;
     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.");
             $libraryHoursMessage = Location::getLibraryHoursMessage($patronResult['homeLocationId']);
             $interface->assign('libraryHoursMessage', $libraryHoursMessage);
             // Define sorting options
             $sortOptions = array('title' => 'Title', 'author' => 'Author', 'dueDate' => 'Due Date', 'format' => 'Format', 'renewed' => 'Times Renewed', 'holdQueueLength' => 'Wish List');
             $interface->assign('sortOptions', $sortOptions);
             $selectedSortOption = isset($_REQUEST['accountSort']) ? $_REQUEST['accountSort'] : 'dueDate';
             $interface->assign('defaultSortOption', $selectedSortOption);
             $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
             $recordsPerPage = isset($_REQUEST['pagesize']) && is_numeric($_REQUEST['pagesize']) ? $_REQUEST['pagesize'] : 25;
             $interface->assign('recordsPerPage', $recordsPerPage);
             if (isset($_GET['exportToExcel'])) {
                 $recordsPerPage = -1;
                 $page = 1;
             }
             $result = $this->catalog->getMyTransactions($page, $recordsPerPage, $selectedSortOption);
             $timer->logTime("Loaded transactions from catalog.");
             if (!PEAR_Singleton::isError($result)) {
                 $link = $_SERVER['REQUEST_URI'];
                 if (preg_match('/[&?]page=/', $link)) {
                     $link = preg_replace("/page=\\d+/", "page=%d", $link);
                 } else {
                     if (strpos($link, "?") > 0) {
                         $link .= "&page=%d";
                     } else {
                         $link .= "?page=%d";
                     }
                 }
                 if ($recordsPerPage != '-1') {
                     $options = array('totalItems' => $result['numTransactions'], 'fileName' => $link, 'perPage' => $recordsPerPage, 'append' => false);
                     $pager = new VuFindPager($options);
                     $interface->assign('pageLinks', $pager->getLinks());
                 }
                 $interface->assign('showNotInterested', false);
                 foreach ($result['transactions'] as $i => $data) {
                     //Get Rating
                     $resource = new Resource();
                     $resource->source = 'VuFind';
                     $resource->record_id = $data['id'];
                     $resource->find(true);
                     $data['ratingData'] = $resource->getRatingData($user);
                     $result['transactions'][$i] = $data;
                     $itemBarcode = isset($data['barcode']) ? $data['barcode'] : null;
                     $itemId = isset($data['itemid']) ? $data['itemid'] : null;
                     if ($itemBarcode != null && isset($_SESSION['renew_message'][$itemBarcode])) {
                         $renewMessage = $_SESSION['renew_message'][$itemBarcode]['message'];
                         $renewResult = $_SESSION['renew_message'][$itemBarcode]['result'];
                         $data['renewMessage'] = $renewMessage;
                         $data['renewResult'] = $renewResult;
                         $result['transactions'][$i] = $data;
                         unset($_SESSION['renew_message'][$itemBarcode]);
                         //$logger->log("Found renewal message in session for $itemBarcode", PEAR_LOG_INFO);
                     } else {
                         if ($itemId != null && isset($_SESSION['renew_message'][$itemId])) {
                             $renewMessage = $_SESSION['renew_message'][$itemId]['message'];
                             $renewResult = $_SESSION['renew_message'][$itemId]['result'];
                             $data['renewMessage'] = $renewMessage;
                             $data['renewResult'] = $renewResult;
                             $result['transactions'][$i] = $data;
                             unset($_SESSION['renew_message'][$itemId]);
                             //$logger->log("Found renewal message in session for $itemBarcode", PEAR_LOG_INFO);
                         } else {
                             $renewMessage = null;
                             $renewResult = null;
                         }
                     }
                 }
                 $interface->assign('transList', $result['transactions']);
                 unset($_SESSION['renew_message']);
             }
         }
     }
     //Determine which columns to show
     $ils = $configArray['Catalog']['ils'];
     $showOut = $ils == 'Horizon';
     $showRenewed = $ils == 'Horizon' || $ils == 'Millennium';
     $showWaitList = $ils == 'Horizon';
     $interface->assign('showOut', $showOut);
     $interface->assign('showRenewed', $showRenewed);
     $interface->assign('showWaitList', $showWaitList);
     if (isset($_GET['exportToExcel'])) {
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:CheckedOut.php

示例13: launch


//.........这里部分代码省略.........
             } else {
                 // Otherwise use the last record on this page
                 $endRecord = $currentPage * $itemsPerPage;
             }
         }
     }
     //////////Get the Page View Data with paging and sorting
     if (isset($_GET['reportSort'])) {
         $sortValue = $_GET['reportSort'];
     }
     //Create values for how to sort the table.
     $sortList = $this->getSortList();
     if (!isset($sortValue)) {
         $sortValue = 'UrlASC';
     }
     $sortList[$sortValue]["selected"] = true;
     $baseQueryLinks .= $sortList[$sortValue]['sql'];
     //append on a limit to return a result
     if (!isset($_REQUEST['exportToExcel'])) {
         $baseQueryLinks .= "LIMIT " . ($startRecord - 1) . ", " . $itemsPerPage . " ";
     }
     $resPurchases = mysql_query($baseQueryLinks);
     $resultsPurchases = array();
     if ($resPurchases > 0) {
         //Build an array based on the data to dump out to the grid
         $i = 0;
         while ($r = mysql_fetch_array($resPurchases)) {
             $recordId = $r['recordId'];
             $fullId = $r['recordId'];
             if (preg_match('/econtentRecord(\\d+)/', $recordId, $matches)) {
                 require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
                 $econtentRecord = new EContentRecord();
                 $econtentRecord->id = $matches[1];
                 $econtentRecord->find(true);
                 $recordId = $econtentRecord->ilsId;
                 $title = $econtentRecord->title;
             } else {
                 $resource = new Resource();
                 $resource->record_id = $recordId;
                 $resource->source = 'VuFind';
                 $resource->find(true);
                 $title = $resource->title;
             }
             $tmp = array('recordId' => $recordId, 'recordUrl' => '/Record/' . $fullId, 'title' => $title, 'timesFollowed' => $r['timesFollowed'], 'linkHost' => $r['linkHost'], 'linkUrl' => $r['linkUrl']);
             $resultsPurchases[$i++] = $tmp;
         }
     }
     $interface->assign('resultLinks', $resultsPurchases);
     //////////Paging Array
     $summary = array('page' => $currentPage, 'perPage' => $itemsPerPage, 'resultTotal' => $totalResultCount, 'startRecord' => $startRecord, 'endRecord' => $endRecord);
     $interface->assign('recordCount', $summary['resultTotal']);
     $interface->assign('recordStart', $summary['startRecord']);
     $interface->assign('recordEnd', $summary['endRecord']);
     // Process Paging using VuFind Pager object
     if (strrpos($_SERVER["REQUEST_URI"], "page=")) {
         //replace the page variable with a new one
         $link = str_replace("page=" . $currentPage, "page=%d", $_SERVER["REQUEST_URI"]);
     } else {
         if (strrpos($_SERVER["REQUEST_URI"], "?")) {
             $link = $_SERVER["REQUEST_URI"] . "&page=%d";
         } else {
             $link = $_SERVER["REQUEST_URI"] . "?page=%d";
         }
     }
     $options = array('totalItems' => $summary['resultTotal'], 'fileName' => $link, 'perPage' => $summary['perPage']);
     $pager = new VuFindPager($options);
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:67,代码来源:ReportExternalLinks.php

示例14: save

 function save($source = 'eContent')
 {
     global $user;
     // Fail if we don't know what record we're working with:
     if (!isset($_GET['id'])) {
         return false;
     }
     // Create a resource entry for the current ID if necessary (or find the
     // existing one):
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     $resource->source = $source;
     if (!$resource->find(true)) {
         $resource->insert();
     }
     // Parse apart the tags and save them in association with the resource:
     preg_match_all('/"[^"]*"|[^,]+/', $_REQUEST['tag'], $words);
     foreach ($words[0] as $tag) {
         $tag = trim(strtolower(str_replace('"', '', $tag)));
         $resource->addTag($tag, $user);
     }
     // Done -- report success:
     return true;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:24,代码来源:AddTag.php

示例15: saveRecord

 function saveRecord()
 {
     if ($this->user) {
         $list = new User_list();
         if ($_GET['list'] != '') {
             $list->id = $_GET['list'];
         } else {
             $list->user_id = $this->user->id;
             $list->title = "My Favorites";
             $list->insert();
         }
         $resource = new Resource();
         $resource->record_id = $_GET['id'];
         $resource->service = $_GET['service'];
         if (!$resource->find(true)) {
             $resource->insert();
         }
         preg_match_all('/"[^"]*"|[^,]+/', $_GET['mytags'], $tagArray);
         $this->user->addResource($resource, $list, $tagArray[0], $_GET['notes']);
     } else {
         return false;
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:23,代码来源:SaveToList.php


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