function manage(){ global $template, $user, $phpEx, $phpbb_root_path, $phpbb_admin_path; $this->page_title = 'PBF_ACP_MANAGE_TITLE'; $this->tpl_name = 'acp_phpBBFolk_manage'; $tags = request_var('tag', ''); $template->assign_vars(array( 'S_TAG_SEARCH_ACTION' => $this->u_action, 'S_SHOW_RESULTS' => false, 'SEARCH_TAGS' => $tags ) ); if(isset($_POST['search']) || $tags != '') { if($tags == '') { $message = $user->lang['PBF_NO_SEARCH_CRIT'] . '<br /><br />'; //sprintf($user->lang['RETURN_SEARCH'], '<a href="' . $meta_info . '">', '</a>'); trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); } else { $topics = search_tags($tags); $template->assign_vars(array( 'S_SHOW_RESULTS' => true, ) ); $row_count = 0; foreach($topics as $row){ //echo append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']).'<br>'; $template->assign_block_vars('topicrow', array( 'TOPIC_TITLE' => $row['topic_title'], 'TOPIC_TAGS' => $this->get_tag_list($row['topic_id'], $tags), 'U_TOPIC_LINK' => append_sid($phpbb_root_path."viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), 'S_ROW_COUNT' => $row_count++, ) ); }//end of foreach } } }//end of function
$meta_info = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $forum_id . '&t=' . $topic_id . '#phpbb_topic_tagging_input'); $message = $user->lang['PTT_ADD_TAGS_NO_TAGS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>'); } trigger_error($message); break; case 'search': default: $search_tag = utf8_normalize_nfc(request_var('tag', '', true)); if ($search_tag == '') { $template->assign_vars(array('S_TAG_SEARCH_ACTION' => append_sid("{$phpbb_root_path}phpbb_topic_tagging.{$phpEx}", 'mode=search'), 'S_SEARCH_STRING' => $search_tag)); page_header($user->lang['PTT_TAGS_RESULT_TITLE']); $template->set_filenames(array('body' => 'phpbb_topic_tagging_search.html')); page_footer(); } else { $start = request_var('start', 0); $result_set = search_tags($search_tag, $start); $topics_count = get_num_rows($search_tag); $s_type_switch = 0; if ($topics_count > 0) { foreach ($result_set as $row) { $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; // This will allow the style designer to output a different header // or even separate the list of announcements from sticky and normal topics $s_type_switch_test = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0; // Replies $replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies']; if ($row['topic_status'] == ITEM_MOVED) { $topic_id = $row['topic_moved_id']; $unread_topic = false; } else {
/** * Prints the tag search results * * @param string $query text that tag names will be matched against * @param int $page current page * @param int $perpage nr of users displayed per page * @param $return if true return html string */ function print_tag_search_results($query, $page, $perpage, $return = false) { global $CFG, $USER; $count = sizeof(search_tags($query, false)); $tags = array_values(search_tags($query, true, $page * $perpage, $perpage)); $baseurl = $CFG->wwwroot . '/tag/search.php?query=' . $query; $output = ''; // link "Add $query to my interests" $addtaglink = ''; if (!is_item_tagged_with('user', $USER->id, $query)) { $addtaglink = '<a href="' . $CFG->wwwroot . '/user/tag.php?action=addinterest&sesskey=' . sesskey() . '&name=' . $query . '">'; $addtaglink .= get_string('addtagtomyinterests', 'tag', $query) . '</a>'; } if ($tags) { // there are results to display!! $output .= print_heading(get_string('searchresultsfor', 'tag', $query) . " : {$count}", '', 3, 'main', true); //print a link "Add $query to my interests" if (!empty($addtaglink)) { $output .= print_box($addtaglink, 'box', 'tag-management-box', true); } $nr_of_lis_per_ul = 6; $nr_of_uls = ceil(sizeof($tags) / $nr_of_lis_per_ul); $output .= '<ul id="tag-search-results">'; for ($i = 0; $i < $nr_of_uls; $i++) { $output .= '<li>'; foreach (array_slice($tags, $i * $nr_of_lis_per_ul, $nr_of_lis_per_ul) as $tag) { $tag_link = ' <a href="' . $CFG->wwwroot . '/tag/index.php?id=' . $tag->id . '">' . tag_display_name($tag) . '</a>'; $output .= '•' . $tag_link . '<br/>'; } $output .= '</li>'; } $output .= '</ul>'; $output .= '<div> </div>'; // <-- small layout hack in order to look good in Firefox $output .= print_paging_bar($count, $page, $perpage, $baseurl . '&', 'page', false, true); } else { //no results were found!! $output .= print_heading(get_string('noresultsfor', 'tag', $query), '', 3, 'main', true); //print a link "Add $query to my interests" if (!empty($addtaglink)) { $output .= print_box($addtaglink, 'box', 'tag-management-box', true); } } if ($return) { return $output; } else { echo $output; } }