本文整理汇总了PHP中Search_Type_Factory_Interface类的典型用法代码示例。如果您正苦于以下问题:PHP Search_Type_Factory_Interface类的具体用法?PHP Search_Type_Factory_Interface怎么用?PHP Search_Type_Factory_Interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Search_Type_Factory_Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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));
}
示例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;
}
示例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));
}
示例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));
}
示例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;
}
示例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));
}
示例8: getDocumentPart
function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
{
$item = $this->getValue();
$baseKey = $this->getBaseKey();
$out = array($baseKey => $typeFactory->numeric($item));
return $out;
}
示例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)));
}
示例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;
}
示例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));
}
示例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'));
}
示例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));
}
示例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));
}
示例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;
}