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)); }
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory) { $lib = TikiLib::lib('comments'); $item = $lib->get_forum($objectId); $data = array('title' => $typeFactory->sortable($item['name']), 'description' => $typeFactory->plaintext($item['description']), 'language' => $typeFactory->identifier($item['forumLanguage'] ?: 'unknown'), 'forum_section' => $typeFactory->identifier($item['section']), 'searchable' => $typeFactory->identifier('n'), 'view_permission' => $typeFactory->identifier('tiki_p_forum_read')); return $data; }
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; }
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']), '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; }
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; }
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; }
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; }
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory) { $lib = TikiLib::lib('trk'); $tracker = $lib->get_tracker($objectId); if (!$tracker) { return false; } $data = array('title' => $typeFactory->sortable($tracker['name']), 'modification_date' => $typeFactory->timestamp($tracker['lastModif']), 'creation_date' => $typeFactory->timestamp($tracker['created']), 'description' => $typeFactory->plaintext($tracker['description']), 'searchable' => $typeFactory->identifier('n'), 'view_permission' => $typeFactory->identifier('tiki_p_view_trackers')); return $data; }
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; }
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); $firstword = preg_replace('/^([^:\\s]+).*$/u', '$1', $title); return array('title_initial' => $typeFactory->identifier($letter), 'title_firstword' => $typeFactory->identifier($firstword)); }
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_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')); return $data; }
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory) { global $prefs; $event = $this->table->fetchRow(['eventType', 'eventDate', 'user', 'groups', 'targetType', 'targetObject'], ['eventId' => $objectId]); if ($event) { $target = null; if ($event['targetType'] && $event['targetObject']) { $target = "{$event['targetType']}:{$event['targetObject']}"; } return ['modification_date' => $typeFactory->timestamp($event['eventDate']), 'event_type' => $typeFactory->identifier($event['eventType']), 'user' => $typeFactory->identifier($event['user']), 'goal_groups' => $typeFactory->multivalue(json_decode($event['groups'], true)), 'target' => $typeFactory->identifier($target)]; } else { return false; } }
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; }
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory) { $lib = TikiLib::lib('trk'); $field = $lib->get_tracker_field($objectId); if (!$field) { return false; } $trackername = tr('unknown'); if ($definition = Tracker_Definition::get($field['trackerId'])) { $trackername = $definition->getConfiguration('name'); } $data = array('title' => $typeFactory->sortable($field['name']), 'description' => $typeFactory->plaintext($field['description']), 'tracker_id' => $typeFactory->identifier($field['trackerId']), 'tracker_name' => $typeFactory->sortable($trackername), 'searchable' => $typeFactory->identifier('n'), 'view_permission' => $typeFactory->identifier('tiki_p_view_trackers')); return $data; }
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; }
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; }
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)); }
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)); }
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')); }
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; }
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']); $data = array('title' => $typeFactory->sortable($name), 'wiki_content' => $typeFactory->wikitext($content), 'user_country' => $typeFactory->sortable($detail['preferences']['country']), 'geo_located' => $typeFactory->identifier(empty($loc) ? 'n' : 'y'), 'geo_location' => $typeFactory->identifier($loc), 'searchable' => $typeFactory->identifier($this->userIsIndexed($detail) ? 'y' : 'n'), '_extra_groups' => array('Registered')); $data = array_merge($data, $this->getTrackerFieldsForUser($objectId, $typeFactory)); return $data; }
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; }
/** * Return data array of last post for thread * * @param $threadId * @param Search_Type_Factory_Interface $typeFactory * @return array * @throws Exception */ function getForumLastPostData($threadId, Search_Type_Factory_Interface $typeFactory) { $commentslib = TikiLib::lib('comments'); $commentslib->extras_enabled(false); $comment = $commentslib->get_lastPost($threadId); $lastModification = isset($comment['commentDate']) ? $comment['commentDate'] : 0; $content = isset($comment['data']) ? $comment['data'] : ''; $snippet = TikiLib::lib('tiki')->get_snippet($content); $author = array(isset($comment['userName']) ? $comment['userName'] : ''); $commentslib->extras_enabled(true); $data = array('lastpost_title' => $typeFactory->sortable(isset($comment['title']) ? $comment['title'] : ''), 'lastpost_modification_date' => $typeFactory->timestamp($lastModification), 'lastpost_contributors' => $typeFactory->multivalue(array_unique($author)), 'lastpost_post_content' => $typeFactory->wikitext($content), 'lastpost_post_snippet' => $typeFactory->plaintext($snippet), 'lastpost_hits' => $typeFactory->numeric(isset($comment['hits']) ? $comment['hits'] : 0), 'lastpost_thread_id' => $typeFactory->identifier(isset($comment['thread_id']) ? $comment['thread_id'] : 0)); return $data; }
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory) { $sheetlib = TikiLib::lib('sheet'); $info = $sheetlib->get_sheet_info($objectId); $values = $this->db->table('tiki_sheet_values'); $contributors = $values->fetchColumn($values->expr('DISTINCT `user`'), array('sheetId' => $objectId)); $lastModif = $values->fetchOne($values->max('begin'), array('sheetId' => $objectId)); $loader = new TikiSheetDatabaseHandler($objectId); $writer = new TikiSheetCSVHandler('php://output'); $grid = new TikiSheet(); $grid->import($loader); $grid->export($writer); $text = $writer->output; $data = array('title' => $typeFactory->sortable($info['title']), 'description' => $typeFactory->sortable($info['description']), 'modification_date' => $typeFactory->timestamp($lastModif), 'contributors' => $typeFactory->multivalue($contributors), 'sheet_content' => $typeFactory->plaintext($text), 'view_permission' => $typeFactory->identifier('tiki_p_view_sheet')); return $data; }
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory) { $row = $this->db->table('users_groups')->fetchRow(['groupDesc'], array('groupName' => $objectId)); if (!$row) { return false; } $api = new TikiAddons_Api_Group(); $groupName = $objectId; $addongroup = false; $addonpendinggroup = false; $addonleadergroup = false; if ($ret = $api->getOrganicGroupName($objectId)) { $groupName = $ret; $addongroup = $api->isOrganicGroup($objectId); if ($addongroup == true && $api->getOrganicGroupPendingToken($objectId) == $objectId) { $addonpendinggroup = true; } if ($addongroup == true && $api->getOrganicGroupLeaderToken($objectId) == $objectId) { $addonleadergroup = true; } } $data = array('title' => $typeFactory->sortable($groupName), 'description' => $typeFactory->plaintext($row['groupDesc']), 'searchable' => $typeFactory->identifier('n'), 'view_permission' => $typeFactory->identifier('tiki_p_group_view'), 'addongroup' => $addongroup ? $typeFactory->identifier('y') : $typeFactory->identifier('n'), 'addonleadergroup' => $addonleadergroup ? $typeFactory->identifier('y') : $typeFactory->identifier('n'), 'addonpendinggroup' => $addonpendinggroup ? $typeFactory->identifier('y') : $typeFactory->identifier('n')); return $data; }
function getDocumentPart(Search_Type_Factory_Interface $typeFactory) { $baseKey = $this->getBaseKey(); return array($baseKey => $typeFactory->identifier($this->getValue())); }
function getDocumentPart(Search_Type_Factory_Interface $typeFactory) { return array('geo_located' => $typeFactory->identifier('y'), 'geo_feature' => $typeFactory->identifier($this->getValue()), 'geo_feature_field' => $typeFactory->identifier($this->getConfiguration('permName'))); }
function getDocumentPart(Search_Type_Factory_Interface $typeFactory) { if ($this->getOption('indexGeometry') && $this->getValue()) { TikiLib::lib('smarty')->loadPlugin('smarty_modifier_sefurl'); $urls = array(); foreach (explode(',', $this->getValue()) as $value) { $urls[] = smarty_modifier_sefurl($value, 'file'); } return array('geo_located' => $typeFactory->identifier('y'), 'geo_file' => $typeFactory->identifier(implode(',', $urls)), 'geo_file_format' => $typeFactory->identifier($this->getOption('indexGeometry'))); } else { return parent::getDocumentPart($typeFactory); } }
function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array()) { $identifier = "{$objectType}:{$objectId}"; return array('report_status' => $typeFactory->identifier(isset($this->data[$identifier]) ? $this->data[$identifier] : 'none')); }
function getDocumentPart(Search_Type_Factory_Interface $typeFactory) { $value = $this->getValue(); $label = $this->getValueLabel($value); $baseKey = $this->getBaseKey(); return array($baseKey => $typeFactory->identifier($value), "{$baseKey}_text" => $typeFactory->sortable($label)); }