/** * Calculates the template data for the topic * * @param int $topic_id the id of the topic * @param boolean $is_edit_first_post whether it is a first post edit or not * @return array the page data */ private function get_template_data_for_topic($topic_id, $is_edit_first_post) { $page_data = array(); $page_data['RH_TOPICTAGS_SHOW_FIELD'] = true; // do we got some preview-data? $tags = array(); if ($this->request->is_set_post('rh_topictags')) { // use data from post-request $tags = $this->get_tags_from_post_request(); } else { if ($is_edit_first_post) { // use data from db $tags = $this->tags_manager->get_assigned_tags($topic_id); } } $page_data['RH_TOPICTAGS'] = base64_encode(rawurlencode(json_encode($tags))); $page_data['RH_TOPICTAGS_ALLOWED_TAGS_REGEX'] = $this->config[prefixes::CONFIG . '_allowed_tags_regex']; $page_data['RH_TOPICTAGS_CONVERT_SPACE_TO_MINUS'] = $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false'; $page_data['S_RH_TOPICTAGS_WHITELIST_ENABLED'] = $this->config[prefixes::CONFIG . '_whitelist_enabled']; if ($this->config[prefixes::CONFIG . '_whitelist_enabled']) { $page_data['S_RH_TOPICTAGS_WHITELIST_ENABLED'] = true; $tags = $this->tags_manager->get_whitelist_tags(); for ($i = 0, $size = sizeof($tags); $i < $size; $i++) { $this->template->assign_block_vars('rh_topictags_whitelist', array('LINK' => '#', 'NAME' => $tags[$i])); } } else { $page_data['RH_TOPICTAGS_ALLOWED_TAGS_EXP'] = $this->config[prefixes::CONFIG . '_allowed_tags_exp_for_users']; } $page_data['S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT'] = true; $page_data['S_RH_TOPICTAGS_INCLUDE_CSS'] = true; return $page_data; }