示例#1
0
 /**
  * Display support topics from all contributions or of a specific type.
  *
  * @param string $type	Contribution type's string identifier
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display_topics($type)
 {
     $type_id = $this->get_type_id($type);
     if ($type_id === false) {
         return $this->helper->error('NO_PAGE', 404);
     }
     if ($type == 'all') {
         // Mark all topics read
         if ($this->request->variable('mark', '') == 'topics') {
             $this->tracking->track(TITANIA_ALL_SUPPORT, self::ALL_SUPPORT);
         }
         // Mark all topics read
         $this->template->assign_var('U_MARK_TOPICS', $this->helper->route('phpbb.titania.support', array('type' => 'all', 'mark' => 'topics')));
     }
     $this->display->assign_global_vars();
     $u_all_support = $this->helper->route('phpbb.titania.support', array('type' => 'all'));
     $this->template->assign_var('U_ALL_SUPPORT', $u_all_support);
     // Generate the main breadcrumbs
     $this->display->generate_breadcrumbs(array('ALL_SUPPORT' => $u_all_support));
     // Links to the support topic lists
     foreach ($this->types->get_all() as $id => $class) {
         $this->template->assign_block_vars('support_types', array('U_SUPPORT' => $this->helper->route('phpbb.titania.support', array('type' => $class->url)), 'TYPE_SUPPORT' => $class->langs));
     }
     $data = \topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id));
     // Canonical URL
     $data['sort']->set_url($this->helper->route('phpbb.titania.support', array('type' => $type)));
     $this->template->assign_var('U_CANONICAL', $data['sort']->build_canonical());
     return $this->helper->render('all_support.html', 'CUSTOMISATION_DATABASE');
 }
示例#2
0
 public function display_list()
 {
     $this->user->add_lang_ext('phpbb/titania', 'faq', false, true);
     /**
      * From phpBB faq.php
      */
     // Pull the array data from the lang pack
     $switch_column = $found_switch = false;
     $help_blocks = array();
     foreach ($this->user->help as $help_ary) {
         if ($help_ary[0] == '--') {
             if ($help_ary[1] == '--') {
                 $switch_column = true;
                 $found_switch = true;
                 continue;
             }
             $this->template->assign_block_vars('faq_block', array('BLOCK_TITLE' => $help_ary[1], 'SWITCH_COLUMN' => $switch_column));
             if ($switch_column) {
                 $switch_column = false;
             }
             continue;
         }
         $this->template->assign_block_vars('faq_block.faq_row', array('FAQ_QUESTION' => $help_ary[0], 'FAQ_ANSWER' => $help_ary[1]));
     }
     // Lets build a page ...
     $this->template->assign_vars(array('L_FAQ_TITLE' => $this->user->lang['FAQ_EXPLAIN'], 'L_BACK_TO_TOP' => $this->user->lang['BACK_TO_TOP'], 'SWITCH_COLUMN_MANUALLY' => !$found_switch));
     $this->display->assign_global_vars();
     return $this->helper->render('faq_body.html', 'FAQ_EXPLAIN');
 }
示例#3
0
 /**
  * Assign navigation tabs to the template.
  *
  * @param string $page		Current active page.
  * @return null
  */
 protected function generate_navigation($page)
 {
     $nav_ary = $this->get_navigation_options();
     // Display nav menu
     $this->display->generate_nav($nav_ary, $page, 'attention');
     // Generate the main breadcrumbs
     $this->display->generate_breadcrumbs(array($this->user->lang['MANAGE'] => $this->helper->route('phpbb.titania.manage')));
     if ($page) {
         $this->display->generate_breadcrumbs(array($nav_ary[$page]['title'] => $nav_ary[$page]['url']));
     }
 }
示例#4
0
 /**
  * Perform search and output results.
  *
  * @param string $sort_url		Base sort url.
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function show_results($sort_url)
 {
     // Setup the sort tool
     $this->sort->set_defaults($this->config['posts_per_page'])->request();
     // Do the search
     $results = $this->query_index();
     // Grab the users
     \users_overlord::load_users($results['user_ids']);
     $this->display->assign_global_vars();
     $this->assign_doc_vars($results['documents']);
     $this->assign_result_vars($this->sort->total);
     $parameters = array();
     $expected_parameters = array('versions' => array(array(''), false), 'c' => array(array(0), false), 'sc' => array(false, false), 'keywords' => array('', true), 'sf' => array('', false), 'author' => array('', true), 'u' => array(0, false), 'type' => array(0, false), 'contrib' => array(0, false));
     foreach ($expected_parameters as $name => $properties) {
         if ($this->request->is_set($name)) {
             list($default_value, $multibyte) = $properties;
             $value = $this->request->variable($name, $default_value, $multibyte);
             // Clean up URL by not including default values.
             if ($value !== $default_value) {
                 $parameters[$name] = $value;
             }
         }
     }
     $this->sort->build_pagination($sort_url, $parameters);
     return $this->helper->render('search_results.html', $this->user->lang['SEARCH']);
 }
示例#5
0
 /**
  * Get contribution template row.
  *
  * @param array $row
  * @return array
  */
 protected function get_contribution_tpl_row($row)
 {
     $folder_img = $folder_alt = '';
     $contrib = $this->get_contrib($row);
     $this->display->topic_folder_img($folder_img, $folder_alt, 0, $this->tracking->is_unread(TITANIA_CONTRIB, $contrib->contrib_id, $contrib->contrib_last_update));
     return array('FOLDER_STYLE' => $folder_img, 'SUBSCRIPTION_AUTHOR_FULL' => \users_overlord::get_user($row['contrib_user_id'], '_full'), 'SUBSCRIPTION_CONTRIB_TYPE' => $contrib->type->lang, 'SUBSCRIPTION_DOWNLOADS' => $row['contrib_downloads'], 'SUBSCRIPTION_ID' => $row['contrib_id'], 'SUBSCRIPTION_TARGET' => $this->user->lang['SUBSCRIPTION_CONTRIB'], 'SUBSCRIPTION_TIME' => $this->user->format_date($row['contrib_last_update']), 'SUBSCRIPTION_TITLE' => $row['contrib_name'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'SUBSCRIPTION_VIEWS' => $row['contrib_views'], 'U_VIEW_SUBSCRIPTION' => $this->get_real_url($contrib->get_url()), 'S_CONTRIB' => true);
 }
示例#6
0
 /**
  * Display new contribution page.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function create()
 {
     if (!$this->is_owner && !$this->auth->acl_get('u_titania_contrib_submit')) {
         return $this->helper->needs_auth();
     }
     $this->user->add_lang_ext('phpbb/titania', 'contributions');
     $contrib = new \titania_contribution();
     $contrib->contrib_user_id = $this->user->data['user_id'];
     $contrib->author = $this->author;
     $contrib->get_options();
     // Set some main vars up
     $message = $this->setup_message($contrib);
     $submit = $this->request->is_set_post('submit');
     $preview = $this->request->is_set_post('preview');
     $error = array();
     $settings = array('type' => $this->request->variable('contrib_type', 0), 'permalink' => $this->request->variable('permalink', '', true), 'categories' => $this->request->variable('contrib_category', array(0)), 'coauthors' => array('active' => $this->request->variable('active_coauthors', '', true), 'nonactive' => $this->request->variable('nonactive_coauthors', '', true)), 'custom' => $this->request->variable('custom_fields', array('' => ''), true));
     if ($preview || $submit) {
         $contrib->post_data($message);
         $contrib->__set_array(array('contrib_type' => $settings['type'], 'contrib_name_clean' => $settings['permalink'], 'contrib_visible' => 1));
     }
     if ($preview) {
         $message->preview();
     } else {
         if ($submit) {
             $authors = $contrib->get_authors_from_usernames(array('active_coauthors' => $settings['coauthors']['active'], 'nonactive_coauthors' => $settings['coauthors']['nonactive']));
             $authors['author'] = array($this->user->data['username'] => $this->user->data['user_id']);
             $error = $contrib->validate($settings['categories'], $authors, $settings['custom']);
             if (($form_key_error = $message->validate_form_key()) !== false) {
                 $error[] = $form_key_error;
             }
             if (empty($error)) {
                 $contrib->set_type($contrib->contrib_type);
                 $contrib->set_custom_fields($settings['custom']);
                 $contrib->contrib_categories = implode(',', $settings['categories']);
                 $contrib->contrib_creation_time = time();
                 $contrib->submit();
                 $contrib->set_coauthors($authors['active_coauthors'], $authors['nonactive_coauthors'], true);
                 // Create relations
                 $contrib->put_contrib_in_categories($settings['categories']);
                 if ($this->ext_config->support_in_titania) {
                     $active_authors = array_merge($authors['author'], $authors['active_coauthors']);
                     foreach ($active_authors as $author) {
                         $this->subscriptions->subscribe(TITANIA_SUPPORT, $contrib->contrib_id, $author);
                     }
                 }
                 redirect($contrib->get_url('revision'));
             }
         }
     }
     // Generate some stuff
     $this->display->generate_type_select($contrib->contrib_type);
     $this->display->generate_category_select($settings['categories']);
     $contrib->assign_details();
     $message->display();
     foreach ($this->types->get_all() as $type) {
         $this->display->generate_custom_fields($type->contribution_fields, $settings['custom'], $type->id);
     }
     $this->template->assign_vars(array('S_POST_ACTION' => $this->author->get_url('create'), 'S_CREATE' => true, 'S_CAN_EDIT_CONTRIB' => $this->auth->acl_get('u_titania_contrib_submit'), 'CONTRIB_PERMALINK' => $settings['permalink'], 'ERROR_MSG' => !empty($error) ? implode('<br />', $error) : false, 'ACTIVE_COAUTHORS' => $settings['coauthors']['active'], 'NONACTIVE_COAUTHORS' => $settings['coauthors']['nonactive']));
     return $this->helper->render('contributions/contribution_manage.html', 'NEW_CONTRIBUTION');
 }
示例#7
0
 /**
  * Display queue stats.
  *
  * @param string $contrib_type	Contribution type URL value.
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display_stats($contrib_type)
 {
     $this->user->add_lang_ext('phpbb/titania', array('queue_stats', 'contributions'));
     $this->set_type($contrib_type);
     if (!$this->stats_supported()) {
         return $this->helper->error('NO_QUEUE_STATS');
     }
     $this->stats->set_queue_type($this->type->id);
     if (!$this->generate_stats()) {
         return $this->helper->error('NO_QUEUE_STATS');
     }
     $this->generate_history();
     $this->display->assign_global_vars();
     $page_title = $this->user->lang['QUEUE_STATS'] . ' - ' . $this->type->langs;
     $this->display->generate_breadcrumbs(array($page_title => $this->helper->route('phpbb.titania.queue_stats', array('contrib_type' => $this->type->url))));
     return $this->helper->render('queue_stats_body.html', $page_title);
 }
示例#8
0
 /**
  * Assign breadcrumbs to the template.
  *
  * @return null
  */
 protected function generate_breadcrumbs()
 {
     $category = new \titania_category();
     // Parents
     foreach (array_reverse($this->cache->get_category_parents($this->id)) as $row) {
         $category->__set_array($this->categories[$row['category_id']]);
         $this->display->generate_breadcrumbs(array($category->get_name() => $category->get_url()));
     }
     // Self
     $this->display->generate_breadcrumbs(array($this->category->get_name() => $this->category->get_url()));
 }
示例#9
0
 /**
  * Assign breadcrumbs to template.
  *
  * @return null
  */
 protected function generate_breadcrumbs()
 {
     // Search for a category with the same name as the contrib type.  This is a bit ugly, but there really isn't any better option
     $categories = $this->cache->get_categories();
     $category = new \titania_category();
     foreach ($categories as $category_id => $category_row) {
         $category->__set_array($category_row);
         $name = $category->get_name();
         if ($name == $this->contrib->type->lang || $name == $this->contrib->type->langs) {
             // Generate the main breadcrumbs
             $this->display->generate_breadcrumbs(array($name => $category->get_url()));
         }
     }
 }
示例#10
0
 /**
  * Generate topic status
  */
 public function topic_folder_img(&$folder_img, &$folder_alt)
 {
     $this->display->topic_folder_img($folder_img, $folder_alt, $this->get_postcount(), $this->unread, $this->topic_posted, $this->topic_sticky, $this->topic_locked);
 }