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


PHP Resource::getTags方法代码示例

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


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

示例1: assignTagList

 /**
  * Assign a tag list to the interface based on the current unique ID.
  *
  * @return void
  * @access protected
  */
 protected function assignTagList()
 {
     global $interface;
     // Retrieve tags associated with the record
     $resource = new Resource();
     $resource->record_id = $this->getUniqueID();
     $resource->source = 'VuFind';
     $tags = $resource->getTags();
     $interface->assign('tagList', is_array($tags) ? $tags : array());
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:16,代码来源:IndexRecord.php

示例2: getRecordTags

 /**
  * Get all tags for a record.
  *
  * @return void
  * @access public
  */
 public function getRecordTags()
 {
     include_once 'services/MyResearch/lib/Resource.php';
     $tagList = array();
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     if ($resource->find(true)) {
         $tags = $resource->getTags();
         foreach ($tags as $tag) {
             $tagList[] = array('tag' => $tag->tag, 'cnt' => $tag->cnt);
         }
     }
     // If we don't have any tags, provide a user-appropriate message:
     if (empty($tagList)) {
         $msg = translate('No Tags') . ', ' . translate('Be the first to tag this record') . '!';
         return $this->output($msg, JSON::STATUS_ERROR);
     } else {
         return $this->output($tagList, JSON::STATUS_OK);
     }
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:26,代码来源:JSON.php

示例3: GetTags

 function GetTags()
 {
     require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php';
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     $resource->source = $_GET['source'];
     $tags = array();
     if ($resource->find(true)) {
         $tagList = $resource->getTags();
         foreach ($tagList as $tag) {
             $tags[] = array('count' => $tag->cnt, 'tag' => $tag->tag);
         }
         $return = array('tags' => $tags);
     } else {
         $return = array('error' => "Could not find record");
     }
     return json_encode(array('result' => $return));
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:18,代码来源:AJAX.php

示例4: getItem

 /**
  * Get information about a particular item and return it as JSON
  */
 function getItem()
 {
     global $timer;
     global $configArray;
     $itemData = array();
     //Load basic information
     $this->id = $_GET['id'];
     $itemData['id'] = $this->id;
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $url = $configArray['Index']['url'];
     $this->db = new $class($url);
     if ($configArray['System']['debugSolr']) {
         $this->db->debug = true;
     }
     // Retrieve Full Marc Record
     if (!($record = $this->db->getRecord($this->id))) {
         return array('error', 'Record does not exist');
     }
     $this->record = $record;
     if ($record['recordtype'] == 'econtentRecord') {
         require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
         $eContentRecord = new EContentRecord();
         $eContentRecord->id = substr($record['id'], strlen('econtentRecord'));
         if (!$eContentRecord->find(true)) {
             $itemData['error'] = 'Cannot load eContent Record for id ' . $record['id'];
         } else {
             $itemData['isbn'] = $eContentRecord->getIsbn();
             $itemData['issn'] = $eContentRecord->getissn();
             $itemData['upc'] = $eContentRecord->getUpc();
             $itemData['issn'] = '';
             $itemData['title'] = $record['title'];
             $itemData['author'] = $eContentRecord->author;
             $itemData['publisher'] = $eContentRecord->publisher;
             $itemData['allIsbn'] = $eContentRecord->getPropertyArray('isbn');
             $itemData['allUpc'] = $eContentRecord->getPropertyArray('upc');
             $itemData['allIssn'] = $eContentRecord->getPropertyArray('issn');
             $itemData['format'] = $eContentRecord->format();
             $itemData['formatCategory'] = $eContentRecord->format_category();
             $itemData['language'] = $eContentRecord->language;
             $itemData['cover'] = $configArray['Site']['coverUrl'] . "/bookcover.php?id={$itemData['id']}&isbn={$itemData['isbn']}&issn={$itemData['issn']}&upc={$itemData['upc']}&category={$itemData['formatCategory']}&format={$itemData['format'][0]}&size=medium";
             $itemData['description'] = $eContentRecord->description;
             require_once ROOT_DIR . '/sys/eContent/EContentRating.php';
             $eContentRating = new EContentRating();
             $eContentRating->recordId = $eContentRecord->id;
             $itemData['ratingData'] = $eContentRating->getRatingData(false, false);
             // Retrieve tags associated with the record
             $limit = 5;
             $resource = new Resource();
             $resource->record_id = $eContentRecord->id;
             $resource->source = 'eContent';
             if ($tags = $resource->getTags()) {
                 array_slice($tags, 0, $limit);
             }
             $itemData['tagList'] = $tags;
             $timer->logTime('Got tag list');
             $itemData['userComments'] = $resource->getComments();
             require_once ROOT_DIR . '/Drivers/EContentDriver.php';
             $driver = new EContentDriver();
             $itemData['holdings'] = $driver->getHolding($eContentRecord->id);
         }
     } else {
         $this->recordDriver = RecordDriverFactory::initRecordDriver($record);
         $timer->logTime('Initialized the Record Driver');
         // Process MARC Data
         require_once ROOT_DIR . '/sys/MarcLoader.php';
         $marcRecord = MarcLoader::loadMarcRecordFromRecord($record);
         if ($marcRecord) {
             $this->marcRecord = $marcRecord;
         } else {
             $itemData['error'] = 'Cannot Process MARC Record';
         }
         $timer->logTime('Processed the marc record');
         // Get ISBN for cover and review use
         if ($isbnFields = $this->marcRecord->getFields('020')) {
             //Use the first good ISBN we find.
             /** @var File_MARC_Data_Field[] $isbnFields */
             foreach ($isbnFields as $isbnField) {
                 if ($isbnField = $isbnField->getSubfield('a')) {
                     $this->isbn = trim($isbnField->getData());
                     if ($pos = strpos($this->isbn, ' ')) {
                         $this->isbn = substr($this->isbn, 0, $pos);
                     }
                     if (strlen($this->isbn) < 10) {
                         $this->isbn = str_pad($this->isbn, 10, "0", STR_PAD_LEFT);
                     }
                     $itemData['isbn'] = $this->isbn;
                     break;
                 }
             }
         }
         /** @var File_MARC_Data_Field $upcField */
         if ($upcField = $this->marcRecord->getField('024')) {
             if ($upcSubfield = $upcField->getSubfield('a')) {
                 $this->upc = trim($upcSubfield->getData());
                 $itemData['upc'] = $this->upc;
             }
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:ItemAPI.php

示例5: Resource


//.........这里部分代码省略.........
     }
     if (isset($record['lexile_score']) && $record['lexile_score'] > -1) {
         $lexileScore = $record['lexile_score'];
         if (isset($record['lexile_code'])) {
             $lexileScore = $record['lexile_code'] . $lexileScore;
         }
         $interface->assign('lexileScore', $lexileScore . 'L');
     }
     //Do actions needed if this is the main action.
     //$interface->caching = 1;
     $interface->assign('id', $this->id);
     if (substr($this->id, 0, 1) == '.') {
         $interface->assign('shortId', substr($this->id, 1));
     } else {
         $interface->assign('shortId', $this->id);
     }
     $interface->assign('addHeader', '<link rel="alternate" type="application/rdf+xml" title="RDF Representation" href="' . $configArray['Site']['path'] . '/Record/' . urlencode($this->id) . '/RDF" />');
     // Define Default Tab
     $tab = isset($_GET['action']) ? $_GET['action'] : 'Description';
     $interface->assign('tab', $tab);
     if (isset($_REQUEST['detail'])) {
         $detail = strip_tags($_REQUEST['detail']);
         $interface->assign('defaultDetailsTab', $detail);
     }
     // Define External Content Provider
     if ($this->marcRecord->getField('020')) {
         if (isset($configArray['Content']['reviews'])) {
             $interface->assign('hasReviews', true);
         }
         if (isset($configArray['Content']['excerpts'])) {
             $interface->assign('hasExcerpt', true);
         }
     }
     // Retrieve User Search History
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     // Retrieve tags associated with the record
     $limit = 5;
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     $resource->source = 'VuFind';
     $resource->find(true);
     $tags = $resource->getTags($limit);
     $interface->assign('tagList', $tags);
     $timer->logTime('Got tag list');
     $this->cacheId = 'Record|' . $_GET['id'] . '|' . get_class($this);
     // Find Similar Records
     /** @var Memcache $memCache */
     global $memCache;
     $similar = $memCache->get('similar_titles_' . $this->id);
     if ($similar == false) {
         $similar = $this->db->getMoreLikeThis($this->id);
         // Send the similar items to the template; if there is only one, we need
         // to force it to be an array or things will not display correctly.
         if (isset($similar) && count($similar['response']['docs']) > 0) {
             $similar = $similar['response']['docs'];
         } else {
             $similar = array();
             $timer->logTime("Did not find any similar records");
         }
         $memCache->set('similar_titles_' . $this->id, $similar, 0, $configArray['Caching']['similar_titles']);
     }
     $this->similarTitles = $similar;
     $interface->assign('similarRecords', $similar);
     $timer->logTime('Loaded similar titles');
     // Find Other Editions
     if ($configArray['Content']['showOtherEditionsPopup'] == false) {
         $editions = OtherEditionHandler::getEditions($this->id, $this->isbn, isset($this->record['issn']) ? $this->record['issn'] : null);
         if (!PEAR_Singleton::isError($editions)) {
             $interface->assign('editions', $editions);
         } else {
             $timer->logTime("Did not find any other editions");
         }
         $timer->logTime('Got Other editions');
     }
     $interface->assign('showStrands', isset($configArray['Strands']['APID']) && strlen($configArray['Strands']['APID']) > 0);
     // Send down text for inclusion in breadcrumbs
     $interface->assign('breadcrumbText', $this->recordDriver->getBreadcrumb());
     // Send down OpenURL for COinS use:
     $interface->assign('openURL', $this->recordDriver->getOpenURL());
     // Send down legal export formats (if any):
     $interface->assign('exportFormats', $this->recordDriver->getExportFormats());
     // Set AddThis User
     $interface->assign('addThis', isset($configArray['AddThis']['key']) ? $configArray['AddThis']['key'] : false);
     // Set Proxy URL
     if (isset($configArray['EZproxy']['host'])) {
         $interface->assign('proxy', $configArray['EZproxy']['host']);
     }
     //setup 5 star ratings
     global $user;
     $ratingData = $resource->getRatingData($user);
     $interface->assign('ratingData', $ratingData);
     $timer->logTime('Got 5 star data');
     //Get Next/Previous Links
     $searchSource = isset($_REQUEST['searchSource']) ? $_REQUEST['searchSource'] : 'local';
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init($searchSource);
     $searchObject->getNextPrevLinks();
     //Load Staff Details
     $interface->assign('staffDetails', $this->recordDriver->getStaffView());
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:Record.php

示例6: launch


//.........这里部分代码省略.........
         //Determine the cover to use
         $bookCoverUrl = $configArray['Site']['coverUrl'] . "/bookcover.php?id={$eContentRecord->id}&amp;econtent=true&amp;issn={$eContentRecord->getIssn()}&amp;isn={$eContentRecord->getIsbn()}&amp;size=large&amp;upc={$eContentRecord->getUpc()}&amp;category=" . urlencode($eContentRecord->format_category()) . "&amp;format=" . urlencode($eContentRecord->getFirstFormat());
         $interface->assign('bookCoverUrl', $bookCoverUrl);
         if (isset($_REQUEST['detail'])) {
             $detail = strip_tags($_REQUEST['detail']);
             $interface->assign('defaultDetailsTab', $detail);
         }
         // Find Similar Records
         $similar = $this->db->getMoreLikeThis('econtentRecord' . $eContentRecord->id);
         $timer->logTime('Got More Like This');
         // Find Other Editions
         if ($configArray['Content']['showOtherEditionsPopup'] == false) {
             $editions = OtherEditionHandler::getEditions($eContentRecord->solrId(), $eContentRecord->getIsbn(), null);
             if (!PEAR_Singleton::isError($editions)) {
                 $interface->assign('editions', $editions);
             }
             $timer->logTime('Got Other editions');
         }
         //Load the citations
         $this->loadCitation($eContentRecord);
         // Retrieve User Search History
         $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
         //Get Next/Previous Links
         $searchSource = isset($_REQUEST['searchSource']) ? $_REQUEST['searchSource'] : 'local';
         $searchObject = SearchObjectFactory::initSearchObject();
         $searchObject->init($searchSource);
         $searchObject->getNextPrevLinks();
         // Retrieve tags associated with the record
         $limit = 5;
         $resource = new Resource();
         $resource->record_id = $_GET['id'];
         $resource->source = 'eContent';
         $resource->find(true);
         $tags = $resource->getTags($limit);
         $interface->assign('tagList', $tags);
         $timer->logTime('Got tag list');
         //Load notes if any
         $marcRecord = MarcLoader::loadEContentMarcRecord($eContentRecord);
         if ($marcRecord) {
             $tableOfContents = array();
             $marcFields505 = $marcRecord->getFields('505');
             if ($marcFields505) {
                 $tableOfContents = $this->processTableOfContentsFields($marcFields505);
             }
             $notes = array();
             $marcFields500 = $marcRecord->getFields('500');
             $marcFields504 = $marcRecord->getFields('504');
             $marcFields511 = $marcRecord->getFields('511');
             $marcFields518 = $marcRecord->getFields('518');
             $marcFields520 = $marcRecord->getFields('520');
             if ($marcFields500 || $marcFields504 || $marcFields505 || $marcFields511 || $marcFields518 || $marcFields520) {
                 $allFields = array_merge($marcFields500, $marcFields504, $marcFields511, $marcFields518, $marcFields520);
                 $notes = $this->processNoteFields($allFields);
             }
             if (isset($library) && $library->showTableOfContentsTab == 0 || count($tableOfContents) == 0) {
                 $notes = array_merge($notes, $tableOfContents);
             } else {
                 $interface->assign('tableOfContents', $tableOfContents);
             }
             if (isset($library) && strlen($library->notesTabName) > 0) {
                 $interface->assign('notesTabName', $library->notesTabName);
             } else {
                 $interface->assign('notesTabName', 'Notes');
             }
             $additionalNotesFields = array('310' => 'Current Publication Frequency', '321' => 'Former Publication Frequency', '351' => 'Organization & arrangement of materials', '362' => 'Dates of publication and/or sequential designation', '501' => '"With"', '502' => 'Dissertation', '506' => 'Restrictions on Access', '507' => 'Scale for Graphic Material', '508' => 'Creation/Production Credits', '510' => 'Citation/References', '511' => 'Participant or Performer', '513' => 'Type of Report an Period Covered', '515' => 'Numbering Peculiarities', '518' => 'Date/Time and Place of Event', '521' => 'Target Audience', '522' => 'Geographic Coverage', '525' => 'Supplement', '526' => 'Study Program Information', '530' => 'Additional Physical Form', '533' => 'Reproduction', '534' => 'Original Version', '536' => 'Funding Information', '538' => 'System Details', '545' => 'Biographical or Historical Data', '546' => 'Language', '547' => 'Former Title Complexity', '550' => 'Issuing Body', '555' => 'Cumulative Index/Finding Aids', '556' => 'Information About Documentation', '561' => 'Ownership and Custodial History', '563' => 'Binding Information', '580' => 'Linking Entry Complexity', '581' => 'Publications About Described Materials', '586' => 'Awards', '590' => 'Local note', '599' => 'Differentiable Local note');
             foreach ($additionalNotesFields as $tag => $label) {
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:67,代码来源:Home.php

示例7: launch

 /**
  * Process parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     // Send basic information to the template.
     $interface->assign('record', $this->record);
     $interface->setPageTitle($this->record['Title'][0]);
     // Assign the ID of the last search so the user can return to it.
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     // Retrieve tags associated with the record
     $resource = new Resource();
     $resource->record_id = $_REQUEST['id'];
     $resource->source = 'Summon';
     $tags = $resource->getTags();
     $interface->assign('tagList', is_array($tags) ? $tags : array());
     // Display Page
     $interface->setTemplate('record.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:24,代码来源:Record.php

示例8: __construct

 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $configArray;
     global $interface;
     parent::__construct();
     // Assign the ID of the last search so the user can return to it.
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     $this->id = $_REQUEST['id'];
     $interface->assign('id', $this->id);
     $this->cacheId = 'WCRecord|' . $this->id . '|' . get_class($this);
     // Define Default Tab
     $tab = isset($_GET['action']) && $_GET['action'] != 'Record' ? $_GET['action'] : 'Holdings';
     $interface->assign('tab', $tab);
     // Fetch Record
     $this->worldcat = new Worldcat();
     $record = $this->worldcat->getRecord($this->id);
     if (PEAR::isError($record)) {
         PEAR::raiseError($record);
     }
     // Process MARCXML Data
     $marc = new File_MARCXML($record, File_MARC::SOURCE_STRING);
     if ($this->record = $marc->next()) {
         $interface->assign('marc', $this->record);
     } else {
         PEAR::raiseError('Cannot Process MARC Record');
     }
     // Save best available ISBN value:
     $this->isbn = $this->_getBestISBN();
     // Define External Content Provider
     if ($this->isbn) {
         $interface->assign('isbn', $this->isbn);
         if (isset($configArray['Content']['reviews'])) {
             $interface->assign('hasReviews', true);
         }
         if (isset($configArray['Content']['excerpts'])) {
             $interface->assign('hasExcerpt', true);
         }
     }
     // Retrieve tags associated with the record
     $resource = new Resource();
     $resource->record_id = $this->id;
     $resource->source = 'WorldCat';
     $tags = $resource->getTags();
     $interface->assign('tagList', is_array($tags) ? $tags : array());
     // Find Similar Records
     $similar = $this->worldcat->getMoreLikeThis($this->record);
     $interface->assign('similarRecords', $similar['record']);
     // Find Other Editions
     $editions = $this->_getEditions();
     if (!PEAR::isError($editions)) {
         $interface->assign('editions', $editions);
     }
     // Define CoINs Identifier
     $coinsID = isset($configArray['OpenURL']['rfr_id']) ? $configArray['OpenURL']['rfr_id'] : $configArray['COinS']['identifier'];
     if (empty($coinsID)) {
         $coinsID = 'vufind.svn.sourceforge.net';
     }
     $interface->assign('coinsID', $coinsID);
     // Set Proxy URL
     $interface->assign('proxy', isset($configArray['EZproxy']['host']) ? $configArray['EZproxy']['host'] : false);
     $interface->setPageTitle($this->_getBestTitle());
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:67,代码来源:Record.php


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