Exemple #1
0
 /**
  * Assign template variables for a given FAQ item.
  *
  * @param array $data	Item data.
  * @param array $auth	Array in form of array(edit => (bool), delete => (bool), move => (bool))
  *	specifying user's permissions.
  * @return null
  */
 protected function assign_item_row_vars($data, $auth)
 {
     $this->faq->__set_array($data);
     // @todo probably should setup an edit time or something for better read tracking in case it was edited
     $folder_img = $folder_alt = '';
     $unread = $this->tracking->get_track(TITANIA_FAQ, $data['faq_id'], true) === 0;
     $this->display->topic_folder_img($folder_img, $folder_alt, 0, $unread);
     $this->template->assign_block_vars('faqlist', array('U_FAQ' => $this->faq->get_url(), 'SUBJECT' => $data['faq_subject'], 'VIEWS' => $data['faq_views'], 'FOLDER_STYLE' => $folder_img, 'FOLDER_IMG' => $this->user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => $this->user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => $this->user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => $this->user->img($folder_img, '', false, '', 'height'), 'U_MOVE_UP' => $auth['move'] ? $this->faq->get_url('move_up') : false, 'U_MOVE_DOWN' => $auth['move'] ? $this->faq->get_url('move_down') : false, 'U_EDIT' => $auth['edit'] ? $this->faq->get_url('edit') : false, 'U_DELETE' => $auth['delete'] ? $this->faq->get_url('delete') : false, 'S_ACCESS_TEAMS' => $this->access->is_team($data['faq_access']), 'S_ACCESS_AUTHORS' => $this->access->is_author($data['faq_access'])));
 }
 /**
  * Get topic template row.
  *
  * @param array $row
  * @return array
  */
 protected function get_topic_tpl_row($row)
 {
     $topic = new \titania_topic();
     $topic->__set_array($row);
     $additional_unread_fields = array(array('type' => TITANIA_SUPPORT, 'id' => 0), array('type' => TITANIA_SUPPORT, 'parent_match' => true), array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true));
     $topic->additional_unread_fields = array_merge($topic->additional_unread_fields, $additional_unread_fields);
     $subscription_target = '';
     $type_lang = array(TITANIA_QUEUE_DISCUSSION => 'SUBSCRIPTION_QUEUE_VALIDATION', TITANIA_QUEUE => 'SUBSCRIPTION_QUEUE', TITANIA_SUPPORT => 'SUBSCRIPTION_SUPPORT_TOPIC');
     if (isset($type_lang[$row['topic_type']])) {
         $subscription_target = $this->user->lang($type_lang[$row['topic_type']]);
     }
     // Tracking check
     $last_read_mark = $this->tracking->get_track(TITANIA_TOPIC, $topic->topic_id, true);
     $last_read_mark = max($last_read_mark, $this->tracking->find_last_read_mark($topic->additional_unread_fields, $topic->topic_type, $topic->parent_id));
     $topic->unread = $topic->topic_last_post_time > $last_read_mark;
     // Get the folder image
     $topic->topic_folder_img($folder_img, $folder_alt);
     return array('FOLDER_STYLE' => $folder_img, 'LAST_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'SUBSCRIPTION_AUTHOR_FULL' => \users_overlord::get_user($row['topic_first_post_user_id'], '_full'), 'SUBSCRIPTION_ID' => $row['topic_id'], 'SUBSCRIPTION_LAST_AUTHOR_FULL' => \users_overlord::get_user($row['topic_last_post_user_id'], '_full'), 'SUBSCRIPTION_LAST_TIME' => $this->user->format_date($row['topic_last_post_time']), 'SUBSCRIPTION_TIME' => $this->user->format_date($row['topic_time']), 'SUBSCRIPTION_TARGET' => $subscription_target, 'SUBSCRIPTION_TITLE' => censor_text($row['topic_subject']), 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'U_VIEW_SUBSCRIPTION' => $this->get_real_url($topic->get_url()), 'U_VIEW_LAST_POST' => $this->get_real_url($topic->get_url(false, array('p' => $topic->topic_last_post_id, '#' => 'p' . $topic->topic_last_post_id))), 'S_ACCESS_TEAMS' => $row['topic_access'] == access::TEAM_LEVEL || $row['topic_type'] == TITANIA_QUEUE, 'S_ACCESS_AUTHORS' => $row['topic_access'] == access::AUTHOR_LEVEL, 'S_TOPIC' => true);
 }
Exemple #3
0
 /**
  * Assign details
  *
  * A little different from those in other classes, this one only returns the info ready for output
  */
 public function assign_details()
 {
     // Tracking check
     $last_read_mark = $this->tracking->get_track(TITANIA_TOPIC, $this->topic_id, true);
     $last_read_mark = max($last_read_mark, $this->tracking->find_last_read_mark($this->additional_unread_fields, $this->topic_type, $this->parent_id));
     $this->unread = $this->topic_last_post_time > $last_read_mark ? true : false;
     $folder_img = $folder_alt = '';
     $this->topic_folder_img($folder_img, $folder_alt);
     // To find out if we have any posts that need approval
     $approved = count::from_db($this->topic_posts, count::get_flags(access::PUBLIC_LEVEL, false, false));
     $total = count::from_db($this->topic_posts, count::get_flags(access::PUBLIC_LEVEL, false, true));
     $u_new_post = '';
     if ($this->unread) {
         $u_new_post = $this->get_url(false, array('view' => 'unread', '#' => 'unread'));
     }
     $details = array('TOPIC_ID' => $this->topic_id, 'TOPIC_TYPE' => $this->topic_type, 'TOPIC_ACCESS' => $this->topic_access, 'TOPIC_STATUS' => $this->topic_status, 'TOPIC_STICKY' => $this->topic_sticky, 'TOPIC_LOCKED' => $this->topic_locked, 'POSTS_APPROVED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') && $total > $approved ? false : true, 'TOPIC_APPROVED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->topic_approved : true, 'TOPIC_REPORTED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->topic_reported : false, 'TOPIC_ASSIGNED' => $this->topic_assigned, 'TOPIC_REPLIES' => $this->get_postcount() - 1, 'TOPIC_VIEWS' => $this->topic_views, 'TOPIC_SUBJECT' => censor_text($this->topic_subject), 'TOPIC_FIRST_POST_ID' => $this->topic_first_post_id, 'TOPIC_FIRST_POST_USER_ID' => $this->topic_first_post_user_id, 'TOPIC_FIRST_POST_USER_COLOUR' => $this->topic_first_post_user_colour, 'TOPIC_FIRST_POST_USER_FULL' => get_username_string('full', $this->topic_first_post_user_id, $this->topic_first_post_username, $this->topic_first_post_user_colour, false, phpbb::append_sid('memberlist', 'mode=viewprofile')), 'TOPIC_FIRST_POST_TIME' => phpbb::$user->format_date($this->topic_first_post_time), 'TOPIC_LAST_POST_ID' => $this->topic_last_post_id, 'TOPIC_LAST_POST_USER_ID' => $this->topic_last_post_user_id, 'TOPIC_LAST_POST_USER_COLOUR' => $this->topic_last_post_user_colour, 'TOPIC_LAST_POST_USER_FULL' => get_username_string('full', $this->topic_last_post_user_id, $this->topic_last_post_username, $this->topic_last_post_user_colour, false, phpbb::append_sid('memberlist', 'mode=viewprofile')), 'TOPIC_LAST_POST_TIME' => phpbb::$user->format_date($this->topic_last_post_time), 'TOPIC_LAST_POST_SUBJECT' => censor_text($this->topic_last_post_subject), 'U_NEWEST_POST' => $u_new_post, 'U_VIEW_TOPIC' => $this->get_url(), 'U_VIEW_LAST_POST' => $this->get_url(false, array('p' => $this->topic_last_post_id, '#' => 'p' . $this->topic_last_post_id)), 'S_UNREAD_TOPIC' => $this->unread ? true : false, 'S_ACCESS_TEAMS' => $this->topic_access == access::TEAM_LEVEL ? true : false, 'S_ACCESS_AUTHORS' => $this->topic_access == access::AUTHOR_LEVEL ? true : false, 'FOLDER_STYLE' => $folder_img, 'FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => phpbb::$user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => phpbb::$user->img($folder_img, '', false, '', 'height'));
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $details, $this);
     return $details;
 }