本文整理汇总了PHP中Search_Type_Factory_Interface类的典型用法代码示例。如果您正苦于以下问题:PHP Search_Type_Factory_Interface类的具体用法?PHP Search_Type_Factory_Interface怎么用?PHP Search_Type_Factory_Interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Search_Type_Factory_Interface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
/*
If you wonder why this method uses straight SQL and not trklib, it's because
trklib performs no meaningful work when extracting the data and strips all
required semantics.
*/
$data = array('title' => $typeFactory->sortable(tr('Unknown')), 'language' => $typeFactory->identifier('unknown'));
$item = $this->trklib->get_tracker_item($objectId);
if (empty($item)) {
return false;
}
$itemObject = Tracker_Item::fromInfo($item);
if (empty($itemObject) || !$itemObject->getDefinition()) {
// ignore corrupted items, e.g. where trackerId == 0
return false;
}
$permNeeded = $itemObject->getViewPermission();
$specialUsers = $itemObject->getSpecialPermissionUsers($objectId, 'Modify');
$definition = Tracker_Definition::get($item['trackerId']);
if (!$definition) {
return $data;
}
foreach (self::getIndexableHandlers($definition, $item) as $handler) {
$data = array_merge($data, $handler->getDocumentPart($typeFactory));
}
$ownerGroup = $itemObject->getOwnerGroup();
$data = array_merge($data, array('title' => $typeFactory->sortable($this->trklib->get_isMain_value($item['trackerId'], $objectId)), 'modification_date' => $typeFactory->timestamp($item['lastModif']), 'creation_date' => $typeFactory->timestamp($item['created']), 'contributors' => $typeFactory->multivalue(array_unique(array($item['createdBy'], $item['lastModifBy']))), 'tracker_status' => $typeFactory->identifier($item['status']), 'tracker_id' => $typeFactory->identifier($item['trackerId']), 'view_permission' => $typeFactory->identifier($permNeeded), '_extra_users' => $specialUsers, '_permission_accessor' => $itemObject->getPerms(), '_extra_groups' => $ownerGroup ? array($ownerGroup) : null));
return $data;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:30,代码来源:TrackerItemSource.php
示例2: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
if (isset($data['relations']) || isset($data['relation_types'])) {
return array();
}
$relations = array();
$types = array();
$from = $this->relationlib->get_relations_from($objectType, $objectId);
foreach ($from as $rel) {
$relations[] = Search_Query_Relation::token($rel['relation'], $rel['type'], $rel['itemId']);
$types[] = $rel['relation'];
}
$to = $this->relationlib->get_relations_to($objectType, $objectId);
foreach ($to as $rel) {
$relations[] = Search_Query_Relation::token($rel['relation'] . '.invert', $rel['type'], $rel['itemId']);
$types[] = $rel['relation'] . '.invert';
}
//take the type array and get a count of each indiv. type
$type_count = array_count_values($types);
$rel_count = array();
foreach ($type_count as $key => $val) {
//instead of returning an assoc. array, format to "relation:count" format for input in index
$rel_count[] = $key . ":" . $val;
}
return array('relations' => $typeFactory->multivalue($relations), 'relation_types' => $typeFactory->multivalue(array_unique($types)), 'relation_count' => $typeFactory->multivalue($rel_count));
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:26,代码来源:RelationSource.php
示例3: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$lib = TikiLib::lib('categ');
$item = $lib->get_category($objectId);
$data = array('title' => $typeFactory->sortable($item['name']), 'description' => $typeFactory->plaintext($item['description']), 'searchable' => $typeFactory->identifier('n'), 'view_permission' => $typeFactory->identifier('tiki_p_view_category'));
return $data;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:7,代码来源:CategorySource.php
示例4: getDocumentPart
function getDocumentPart($baseKey, Search_Type_Factory_Interface $typeFactory)
{
$items = $this->getItemIds();
$list = $this->getItemLabels($items);
$listtext = implode(' ', $list);
return array($baseKey => $typeFactory->multivalue($items), "{$baseKey}_text" => $typeFactory->plaintext($listtext));
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:7,代码来源:ItemsList.php
示例5: getDocumentPart
function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
{
$baseKey = $this->getBaseKey();
$data = $this->getFieldData();
$listtext = implode(' ', $data['value']);
return array($baseKey => $typeFactory->multivalue($data['value']), "{$baseKey}_text" => $typeFactory->plaintext($listtext));
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:7,代码来源:UserGroups.php
示例6: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
/*
If you wonder why this method uses straight SQL and not trklib, it's because
trklib performs no meaningful work when extracting the data and strips all
required semantics.
*/
$data = array('title' => $typeFactory->sortable(tr('Unknown')), 'language' => $typeFactory->identifier('unknown'));
$item = $this->trklib->get_tracker_item($objectId);
if ($item['status'] == 'c') {
$permNeeded = 'tiki_p_view_trackers_closed';
} elseif ($item['status'] == 'p') {
$permNeeded = 'tiki_p_view_trackers_pending';
} else {
$permNeeded = 'tiki_p_view_trackers';
}
$definition = Tracker_Definition::get($item['trackerId']);
if (!$definition) {
return $data;
}
foreach ($this->getIndexableHandlers($definition, $item) as $baseKey => $handler) {
$data = array_merge($data, $handler->getDocumentPart($baseKey, $typeFactory));
}
$data = array_merge($data, array('title' => $typeFactory->sortable($this->trklib->get_isMain_value($item['trackerId'], $objectId)), 'modification_date' => $typeFactory->timestamp($item['lastModif']), 'contributors' => $typeFactory->multivalue(array_unique(array($item['createdBy'], $item['lastModifBy']))), 'tracker_status' => $typeFactory->identifier($item['status']), 'tracker_id' => $typeFactory->identifier($item['trackerId']), 'parent_object_type' => $typeFactory->identifier('tracker'), 'parent_object_id' => $typeFactory->identifier($item['trackerId']), 'parent_view_permission' => $typeFactory->identifier($permNeeded)));
return $data;
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:26,代码来源:TrackerItemSource.php
示例7: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
$geolib = TikiLib::lib('geo');
$coordinates = $geolib->get_coordinates_string($objectType, $objectId);
$alreadyLocated = isset($data['geo_located']) && $date['geo_located'] == 'y';
return array('geo_located' => $typeFactory->identifier($coordinates || $alreadyLocated ? 'y' : 'n'), 'geo_location' => $typeFactory->identifier($coordinates));
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:7,代码来源:Geolocation.php
示例8: getDocumentPart
function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
{
$item = $this->getValue();
$baseKey = $this->getBaseKey();
$out = array($baseKey => $typeFactory->numeric($item));
return $out;
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:7,代码来源:Numeric.php
示例9: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
if (isset($data['allowed_groups'])) {
return array();
}
$groups = array();
if (isset($data['view_permission'])) {
$viewPermission = is_object($data['view_permission']) ? $data['view_permission']->getValue() : $data['view_permission'];
if (isset($data['_permission_accessor'])) {
$accessor = $data['_permission_accessor'];
} else {
$accessor = $this->perms->getAccessor(array('type' => $objectType, 'object' => $objectId));
}
$groups = array_merge($groups, $this->getAllowedGroups($accessor, $viewPermission));
}
if (isset($data['parent_view_permission'], $data['parent_object_id'], $data['parent_object_type'])) {
$viewPermission = is_object($data['parent_view_permission']) ? $data['parent_view_permission']->getValue() : $data['parent_view_permission'];
$accessor = $this->perms->getAccessor(array('type' => $data['parent_object_type']->getValue(), 'object' => $data['parent_object_id']->getValue()));
$groups = array_merge($groups, $this->getAllowedGroups($accessor, $viewPermission));
}
// Used for comments - must see the parent view permission in addition to a global permission to view comments
if (isset($data['global_view_permission'])) {
$globalPermission = $data['global_view_permission'];
$globalPermission = $globalPermission->getValue();
$groups = $this->getGroupExpansion($groups);
$groups = $this->filterWithGlobalPermission($groups, $globalPermission);
}
if (!empty($data['_extra_groups'])) {
$groups = array_merge($groups, $data['_extra_groups']);
}
return array('allowed_groups' => $typeFactory->multivalue(array_unique($groups)));
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:32,代码来源:PermissionSource.php
示例10: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
if (isset($data['categories']) || isset($data['deep_categories']) || $objectType === 'category') {
return array();
}
$categories = $this->categlib->get_object_categories($objectType, $objectId, -1, false);
// For forum posts, and
if (isset($data['parent_object_id'], $data['parent_object_type'])) {
$objectType = is_object($data['parent_object_type']) ? $data['parent_object_type']->getValue() : $data['parent_object_type'];
$objectId = is_object($data['parent_object_id']) ? $data['parent_object_id']->getValue() : $data['parent_object_id'];
$parentCategories = $this->categlib->get_object_categories($objectType, $objectId, -1, false);
$categories = array_unique(array_merge($categories, $parentCategories));
}
if (empty($categories)) {
$categories[] = 'orphan';
$deepcategories = $categories;
} else {
$deepcategories = $this->getWithParent($categories);
}
$out = array('categories' => $typeFactory->multivalue($categories), 'deep_categories' => $typeFactory->multivalue($deepcategories));
foreach ($this->categlib->getCustomFacets() as $rootId) {
$filtered = array_filter($categories, function ($category) use($rootId) {
return $this->categlib->get_category_parent($category) == $rootId;
});
$deepfiltered = array_filter($deepcategories, function ($category) use($rootId) {
return $category != $rootId && $this->hasParent($category, $rootId);
});
$out["categories_under_{$rootId}"] = $typeFactory->multivalue($filtered);
$out["deep_categories_under_{$rootId}"] = $typeFactory->multivalue($deepfiltered);
}
return $out;
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:32,代码来源:CategorySource.php
示例11: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
if (isset($data['url'])) {
return false;
}
$url = smarty_modifier_sefurl($objectId, $objectType);
return array('url' => $typeFactory->identifier($url));
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:8,代码来源:UrlSource.php
示例12: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
// Unless specified by content source explicitly, everything is searchable
if (isset($data['searchable'])) {
return [];
}
return array('searchable' => $typeFactory->identifier('y'));
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:8,代码来源:SearchableSource.php
示例13: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
if ($objectType === 'wiki page') {
$objectType = 'wiki';
}
$visits = $this->statslib->object_hits($objectId, $objectType);
return array('visits' => $typeFactory->sortable($visits));
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:8,代码来源:VisitsSource.php
示例14: getDocumentPart
function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
{
$possibilities = $this->getPossibilities();
$value = $this->getValue();
$label = isset($possibilities[$value]) ? $possibilities[$value] : '';
$baseKey = $this->getBaseKey();
return array($baseKey => $typeFactory->identifier($value), "{$baseKey}_text" => $typeFactory->sortable($label));
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:8,代码来源:CountrySelector.php
示例15: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
$ratings = $this->ratinglib->obtain_ratings($objectType, $objectId, $this->recalculate);
$data = array();
foreach ($ratings as $id => $value) {
$data["adv_rating_{$id}"] = $typeFactory->sortable($value);
}
return $data;
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:9,代码来源:AdvancedRatingSource.php
示例16: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
if ($objectType == 'forum post') {
$forumId = $this->commentslib->get_comment_forum_id($objectId);
$comment_count = $this->commentslib->count_comments_threads("forum:{$forumId}", $objectId);
} else {
$comment_count = $this->commentslib->count_comments("{$objectType}:{$objectId}");
}
return array('comment_count' => $typeFactory->sortable($comment_count));
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:10,代码来源:CommentSource.php
示例17: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$lib = TikiLib::lib('filegal');
$item = $lib->get_file_gallery_info($objectId);
$data = array('title' => $typeFactory->sortable($item['name']), 'creation_date' => $typeFactory->timestamp($item['created']), 'modification_date' => $typeFactory->timestamp($item['lastModif']), 'description' => $typeFactory->plaintext($item['description']), 'language' => $typeFactory->identifier('unknown'), 'gallery_id' => $typeFactory->identifier($item['parentId']), 'searchable' => $typeFactory->identifier('n'), 'view_permission' => $typeFactory->identifier('tiki_p_view_file_gallery'));
return $data;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:7,代码来源:FileGallerySource.php
示例18: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
$title = empty($data['title']) ? null : $data['title']->getValue();
$title = empty($title) ? '0' : $title;
$substr = $this->substr;
$strtoupper = $this->strtoupper;
$first = $substr($title, 0, 1);
$first = TikiLib::take_away_accent($first);
$letter = $strtoupper($first);
return array('title_initial' => $typeFactory->identifier($letter));
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:11,代码来源:TitleInitialSource.php
示例19: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
$tags = $this->freetaglib->get_tags_on_object($objectId, $objectType);
$textual = array();
$ids = array();
foreach ($tags['data'] as $entry) {
$textual[] = $entry['tag'];
$ids[] = $entry['tagId'];
}
return array('freetags' => $typeFactory->multivalue($ids), 'freetags_text' => $typeFactory->plaintext(implode(' ', $textual)));
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:11,代码来源:FreeTagSource.php
示例20: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
$data = '';
if ($objectType == 'forum post') {
$forumId = $this->commentslib->get_comment_forum_id($objectId);
$comment_count = $this->commentslib->count_comments_threads("forum:{$forumId}", $objectId);
} else {
$comment_count = $this->commentslib->count_comments("{$objectType}:{$objectId}");
$data = implode(' ', $this->table->fetchColumn('data', array('object' => $objectId, 'objectType' => $objectType)));
}
return array('comment_count' => $typeFactory->numeric($comment_count), 'comment_data' => $typeFactory->plaintext($data));
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:12,代码来源:CommentSource.php
注:本文中的Search_Type_Factory_Interface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论