本文整理汇总了PHP中Search_Type_Factory_Interface::multivalue方法的典型用法代码示例。如果您正苦于以下问题:PHP Search_Type_Factory_Interface::multivalue方法的具体用法?PHP Search_Type_Factory_Interface::multivalue怎么用?PHP Search_Type_Factory_Interface::multivalue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search_Type_Factory_Interface
的用法示例。
在下文中一共展示了Search_Type_Factory_Interface::multivalue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
global $prefs;
$commentslib = TikiLib::lib('comments');
$commentslib->extras_enabled(false);
$comment = $commentslib->get_comment($objectId);
$root_thread_id = $commentslib->find_root($comment['parentId']);
if ($comment['parentId']) {
$root = $commentslib->get_comment($root_thread_id);
if (!$comment['title']) {
$comment['title'] = $root['title'];
}
$root_author = array($root['userName']);
} else {
$root_author = array();
}
$lastModification = $comment['commentDate'];
$content = $comment['data'];
$snippet = TikiLib::lib('tiki')->get_snippet($content);
$author = array($comment['userName']);
$thread = $commentslib->get_comments($comment['objectType'] . ':' . $comment['object'], $objectId, 0, 0);
$forum_info = $commentslib->get_forum($comment['object']);
$forum_language = $forum_info['forumLanguage'] ? $forum_info['forumLanguage'] : 'unknown';
if ($prefs['unified_forum_deepindexing'] == 'y') {
foreach ($thread['data'] as $reply) {
$content .= "\n{$reply['data']}";
$lastModification = max($lastModification, $reply['commentDate']);
$author[] = $comment['userName'];
}
}
$commentslib->extras_enabled(true);
$data = array('title' => $typeFactory->sortable($comment['title']), 'language' => $typeFactory->identifier($forum_language), 'modification_date' => $typeFactory->timestamp($lastModification), 'contributors' => $typeFactory->multivalue(array_unique($author)), 'forum_id' => $typeFactory->identifier($comment['object']), 'forum_section' => $typeFactory->identifier($forum_info['section']), 'post_content' => $typeFactory->wikitext($content), 'post_snippet' => $typeFactory->plaintext($snippet), 'parent_thread_id' => $typeFactory->identifier($comment['parentId']), 'parent_object_type' => $typeFactory->identifier($comment['objectType']), 'parent_object_id' => $typeFactory->identifier($comment['object']), 'parent_view_permission' => $typeFactory->identifier('tiki_p_forum_read'), 'parent_contributors' => $typeFactory->multivalue(array_unique($root_author)), 'root_thread_id' => $typeFactory->identifier($root_thread_id));
return $data;
}
示例3: 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));
}
示例4: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
global $prefs;
$detail = $this->user->get_user_details($objectId, false);
$name = $objectId;
if (!empty($detail['preferences']['realName'])) {
$name = $detail['preferences']['realName'];
}
$content = '';
if ($prefs['feature_wiki_userpage'] == 'y' && !empty($prefs['feature_wiki_userpage_prefix'])) {
$page = $prefs['feature_wiki_userpage_prefix'] . $objectId;
if ($info = $this->tiki->get_page_info($page, true, true)) {
$content = $info['data'];
}
}
$loc = $this->geo->build_location_string($detail['preferences']);
$country = '';
if (isset($detail['preferences']['country'])) {
$country = $detail['preferences']['country'];
}
$gender = '';
if (isset($detail['preferences']['gender'])) {
$gender = $detail['preferences']['gender'];
}
$homePage = '';
if (isset($detail['preferences']['homePage'])) {
$homePage = $detail['preferences']['homePage'];
}
$realName = '';
if (isset($detail['preferences']['realName'])) {
$realName = $detail['preferences']['realName'];
}
if ($prefs['allowmsg_is_optional'] == 'y' && isset($detail['preferences']['allowMsgs'])) {
$allowMsgs = $detail['preferences']['allowMsgs'];
} else {
$allowMsgs = 'y';
}
if (isset($detail['preferences']['user_style'])) {
$user_style = $detail['preferences']['user_style'];
} else {
$user_style = isset($prefs['site_style']) ? $prefs['site_style'] : "";
}
$user_language = $this->tiki->get_language($objectId);
$langLib = TikiLib::lib('language');
$user_language_text = $langLib->format_language_list(array($user_language));
$userPage = $prefs['feature_wiki_userpage_prefix'] . $objectId;
if (!$this->tiki->page_exists($userPage)) {
$userPage = "";
}
$data = array('title' => $typeFactory->sortable($name), 'wiki_content' => $typeFactory->wikitext($content), 'user_country' => $typeFactory->sortable($country), 'user_gender' => $typeFactory->sortable($gender), 'user_homepage' => $typeFactory->sortable($homePage), 'user_realName' => $typeFactory->sortable($realName), 'user_allowmsgs' => $typeFactory->sortable($allowMsgs), 'user_language' => $typeFactory->multivalue($user_language), 'user_style' => $typeFactory->sortable($user_style), 'user_page' => $typeFactory->sortable($userPage), 'geo_located' => $typeFactory->identifier(empty($loc) ? 'n' : 'y'), 'geo_location' => $typeFactory->identifier($loc), 'searchable' => $typeFactory->identifier($this->userIsIndexed($detail) ? 'y' : 'n'), 'groups' => $typeFactory->multivalue($detail['groups']), '_extra_groups' => array('Registered'));
$data = array_merge($data, $this->getTrackerFieldsForUser($objectId, $typeFactory));
return $data;
}
示例5: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
{
$groups = array();
$followers = array();
foreach ($this->getUsers($data, $objectType, $objectId) as $user) {
$groups = array_merge($groups, $this->userlib->get_user_groups_inclusion($user));
$userfollowers = $this->getFollowers($user);
if (is_array($userfollowers)) {
$followers = array_merge($followers, $userfollowers);
}
}
unset($groups['Anonymous'], $groups['Registered']);
return array('user_groups' => $typeFactory->multivalue(array_keys($groups)), 'user_followers' => $typeFactory->multivalue(array_unique($followers)));
}
示例6: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$wikilib = TikiLib::lib('wiki');
$info = $this->tikilib->get_page_info($objectId, true, true);
if (!$info) {
return false;
}
$contributors = $wikilib->get_contributors($objectId, $info['user']);
if (!in_array($info['user'], $contributors)) {
$contributors[] = $info['user'];
}
$data = array('title' => $typeFactory->sortable($info['pageName']), 'language' => $typeFactory->identifier(empty($info['lang']) ? 'unknown' : $info['lang']), 'modification_date' => $typeFactory->timestamp($info['lastModif']), 'description' => $typeFactory->plaintext($info['description']), 'contributors' => $typeFactory->multivalue($contributors), 'wiki_content' => $typeFactory->wikitext($info['data']), 'view_permission' => $typeFactory->identifier('tiki_p_view'), 'url' => $typeFactory->identifier($wikilib->sefurl($info['pageName'])), 'hash' => $typeFactory->identifier(''));
if ($this->quantifylib) {
$data['wiki_uptodateness'] = $typeFactory->sortable($this->quantifylib->getCompleteness($info['page_id']));
}
if ($this->flaggedrevisionlib) {
$data['wiki_approval_state'] = $typeFactory->identifier('none');
}
$out = $data;
if ($this->flaggedrevisionlib && $this->flaggedrevisionlib->page_requires_approval($info['pageName'])) {
$out = array();
// Will provide two documents: one approved and one latest
$versionInfo = $this->flaggedrevisionlib->get_version_with($info['pageName'], 'moderation', 'OK');
if (!$versionInfo || $versionInfo['version'] != $info['version']) {
// No approved version or approved version differs, latest content marked as such
$out[] = array_merge($data, array('hash' => $typeFactory->identifier('latest'), 'title' => $typeFactory->sortable(tr('%0 (latest)', $info['pageName'])), 'view_permission' => $typeFactory->identifier('tiki_p_wiki_view_latest'), 'wiki_approval_state' => $typeFactory->identifier('pending'), 'url' => $typeFactory->identifier(str_replace('&', '&', $wikilib->sefurl($info['pageName'], true)) . 'latest')));
}
if ($versionInfo) {
// Approved version not latest, include approved version in index
// Also applies when versions are equal, data would be the same
$out[] = array_merge($data, array('wiki_content' => $typeFactory->wikitext($versionInfo['data']), 'wiki_approval_state' => $typeFactory->identifier('approved')));
}
}
return $out;
}
示例7: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$bloglib = TikiLib::lib('blog');
$post = $bloglib->get_post($objectId);
$data = array('title' => $typeFactory->sortable($post['title']), 'language' => $typeFactory->identifier('unknown'), 'modification_date' => $typeFactory->timestamp($post['created']), 'contributors' => $typeFactory->multivalue(array($post['user'])), 'blog_id' => $typeFactory->identifier($post['blogId']), 'blog_excerpt' => $typeFactory->wikitext($post['excerpt']), 'blog_content' => $typeFactory->wikitext($post['data']), 'parent_object_type' => $typeFactory->identifier('blog'), 'parent_object_id' => $typeFactory->identifier($post['blogId']), 'parent_view_permission' => $typeFactory->identifier('tiki_p_read_blog'));
return $data;
}
示例8: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$artlib = TikiLib::lib('art');
$article = $artlib->get_article($objectId, false);
if ($topic = $artlib->get_topic($article['topicId'])) {
$topic_name = $topic['name'];
} else {
$topic_name = '';
}
$rss_relations = TikiLib::lib('relation')->get_object_ids_with_relations_from('article', $objectId, 'tiki.rss.source');
$sitetitle = '';
$siteurl = '';
if ($rss_relations) {
$rssId = reset($rss_relations);
$rssModule = TikiLib::lib('rss')->get_rss_module($rssId);
if ($rssModule['sitetitle']) {
$sitetitle = $rssModule['sitetitle'];
}
if ($rssModule['siteurl']) {
$siteurl = $rssModule['siteurl'];
}
}
$data = array('title' => $typeFactory->sortable($article['title']), 'language' => $typeFactory->identifier($article['lang'] ? $article['lang'] : 'unknown'), 'modification_date' => $typeFactory->timestamp($article['publishDate']), 'contributors' => $typeFactory->multivalue(array($article['author'])), 'description' => $typeFactory->plaintext($article['heading']), 'sitetitle' => $typeFactory->plaintext($sitetitle), 'siteurl' => $typeFactory->plaintext($siteurl), 'topic_id' => $typeFactory->identifier($article['topicId']), 'topic_name' => $typeFactory->plaintext($topic_name), 'article_type' => $typeFactory->identifier($article['type']), 'article_content' => $typeFactory->wikitext($article['body']), 'article_topline' => $typeFactory->wikitext($article['topline']), 'article_subtitle' => $typeFactory->wikitext($article['subtitle']), 'article_author' => $typeFactory->plaintext($article['authorName']), 'view_permission' => $article['ispublished'] == 'y' ? $typeFactory->identifier('tiki_p_read_article') : $typeFactory->identifier('tiki_p_edit_article'), 'parent_object_type' => $typeFactory->identifier('topic'), 'parent_object_id' => $typeFactory->identifier($article['topicId']), 'parent_view_permission' => $typeFactory->identifier('tiki_p_read_topic'), 'published' => $article['ispublished'] == 'y' ? $typeFactory->identifier('y') : $typeFactory->identifier('n'));
return $data;
}
示例9: 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));
}
示例10: 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));
}
示例11: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$artlib = TikiLib::lib('art');
$article = $artlib->get_article($objectId, false);
$data = array('title' => $typeFactory->sortable($article['title']), 'language' => $typeFactory->identifier($article['lang'] ? $article['lang'] : 'unknown'), 'modification_date' => $typeFactory->timestamp($article['publishDate']), 'contributors' => $typeFactory->multivalue(array($article['author'])), 'description' => $typeFactory->plaintext($article['heading']), 'topic_id' => $typeFactory->identifier($article['topicId']), 'article_content' => $typeFactory->wikitext($article['body']), 'article_topline' => $typeFactory->wikitext($article['topline']), 'article_subtitle' => $typeFactory->wikitext($article['subtitle']), 'article_author' => $typeFactory->plaintext($article['authorName']), 'view_permission' => $typeFactory->identifier('tiki_p_read_article'), 'parent_object_type' => $typeFactory->identifier('topic'), 'parent_object_id' => $typeFactory->identifier($article['topicId']), 'parent_view_permission' => $typeFactory->identifier('tiki_p_read_topic'));
return $data;
}
示例12: 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)));
}
示例13: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$filegallib = Tikilib::lib('filegal');
$file = $filegallib->get_file_info($objectId, true, false);
$data = array('title' => $typeFactory->sortable(empty($file['name']) ? $file['filename'] : $file['name']), 'language' => $typeFactory->identifier('unknown'), 'creation_date' => $typeFactory->timestamp($file['created']), 'modification_date' => $typeFactory->timestamp($file['lastModif']), 'contributors' => $typeFactory->multivalue(array_unique(array($file['author'], $file['user'], $file['lastModifUser']))), 'description' => $typeFactory->plaintext($file['description']), 'filename' => $typeFactory->identifier($file['filename']), 'filetype' => $typeFactory->sortable(preg_replace('/^([\\w-]+)\\/([\\w-]+).*$/', '$1/$2', $file['filetype'])), 'filesize' => $typeFactory->plaintext($file['filesize']), 'gallery_id' => $typeFactory->identifier($file['galleryId']), 'file_comment' => $typeFactory->plaintext($file['comment']), 'file_content' => $typeFactory->plaintext($file['search_data']), 'parent_object_type' => $typeFactory->identifier('file gallery'), 'parent_object_id' => $typeFactory->identifier($file['galleryId']), 'parent_view_permission' => $typeFactory->identifier('tiki_p_download_files'));
return $data;
}
示例14: getData
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = 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);
}
return array('categories' => $typeFactory->multivalue($categories), 'deep_categories' => $typeFactory->multivalue($deepcategories));
}
示例15: getDocument
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
{
$commentslib = TikiLib::lib('comments');
$comment = $commentslib->get_comment($objectId);
$url = $commentslib->getHref($comment['objectType'], $comment['object'], $objectId);
$url = str_replace('&', '&', $url);
$data = array('title' => $typeFactory->sortable($comment['title']), 'language' => $typeFactory->identifier('unknown'), 'modification_date' => $typeFactory->timestamp($comment['commentDate']), 'contributors' => $typeFactory->multivalue(array($comment['userName'])), 'comment_content' => $typeFactory->wikitext($comment['data']), 'parent_thread_id' => $typeFactory->identifier($comment['parentId']), 'parent_object_type' => $typeFactory->identifier($comment['objectType']), 'parent_object_id' => $typeFactory->identifier($comment['object']), 'parent_view_permission' => $typeFactory->identifier($this->getParentPermissionForType($comment['objectType'])), 'global_view_permission' => $typeFactory->identifier('tiki_p_read_comments'), 'url' => $typeFactory->identifier($url));
return $data;
}