本文整理匯總了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;
}
示例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;
}