當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tags::getResources方法代碼示例

本文整理匯總了PHP中Tags::getResources方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tags::getResources方法的具體用法?PHP Tags::getResources怎麽用?PHP Tags::getResources使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tags的用法示例。


在下文中一共展示了Tags::getResources方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processTagSearch

 /**
  * Process a search for a particular tag.
  *
  * @access  private
  * @param   string  $lookfor    The tag to search for
  * @return  array   A revised searchTerms array to get matching Solr records
  *                  (empty if no tag matches found).
  */
 private function processTagSearch($lookfor)
 {
     // Include the app database objects
     require_once ROOT_DIR . '/services/MyResearch/lib/Tags.php';
     require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php';
     // Find our tag in the database
     $tag = new Tags();
     $tag->tag = $lookfor;
     $newSearch = array();
     if ($tag->find(true)) {
         // Grab the list of records tagged with this tag
         $resourceList = $tag->getResources();
         if (count($resourceList)) {
             $newSearch[0] = array('join' => 'OR', 'group' => array());
             foreach ($resourceList as $resource) {
                 $id = $resource->record_id;
                 if ($resource->source == 'eContent') {
                     $id = 'econtentRecord' . $id;
                 }
                 $newSearch[0]['group'][] = array('field' => 'id', 'lookfor' => $id, 'bool' => 'OR');
             }
         }
     }
     return $newSearch;
 }
開發者ID:bryandease,項目名稱:VuFind-Plus,代碼行數:33,代碼來源:Solr.php

示例2: _processTagSearch

 /**
  * Process a search for a particular tag.
  *
  * @param string $lookfor The tag to search for
  *
  * @return array          A revised searchTerms array to get matching Solr
  * records (empty if no tag matches found).
  * @access private
  */
 private function _processTagSearch($lookfor)
 {
     // Include the app database objects
     include_once 'services/MyResearch/lib/Tags.php';
     include_once 'services/MyResearch/lib/Resource.php';
     // Find our tag in the database
     $tag = new Tags();
     $tag->tag = $lookfor;
     $tagList = array();
     if ($tag->find(true)) {
         // Grab the list of records tagged with this tag
         $resourceList = array();
         $resourceList = $tag->getResources();
         if (count($resourceList)) {
             foreach ($resourceList as $resource) {
                 $tagList[] = $resource->record_id;
             }
         }
     }
     return $tagList;
 }
開發者ID:bharatm,項目名稱:NDL-VuFind,代碼行數:30,代碼來源:Solr.php


注:本文中的Tags::getResources方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。