本文整理汇总了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;
}