예제 #1
0
 /**
  * Assign navigation tabs.
  *
  * @param string $page	Current active page.
  * @return null
  */
 protected function generate_navigation($page)
 {
     // Count the number of FAQ items to display
     $flags = count::get_flags($this->access->get_level());
     $faq_count = count::from_db($this->contrib->contrib_faq_count, $flags);
     $is_disabled = in_array($this->contrib->contrib_status, array(TITANIA_CONTRIB_CLEANED, TITANIA_CONTRIB_DISABLED));
     /**
      * Menu Array
      *
      * 'filename' => array(
      *	'title'		=> 'nav menu title',
      * 	'url'		=> $page_url,
      *	'auth'		=> ($can_see_page) ? true : false, // Not required, always true if missing
      * ),
      */
     $nav_ary = array('details' => array('title' => 'CONTRIB_DETAILS', 'url' => $this->contrib->get_url()), 'faq' => array('title' => 'CONTRIB_FAQ', 'url' => $this->contrib->get_url('faq'), 'auth' => !$this->access->is_public() || $faq_count, 'count' => $faq_count), 'support' => array('title' => 'CONTRIB_SUPPORT', 'url' => $this->contrib->get_url('support'), 'auth' => $this->ext_config->support_in_titania || $this->access->get_level() < access::PUBLIC_LEVEL), 'demo' => array('title' => 'CONTRIB_DEMO', 'url' => '', 'auth' => !empty($this->contrib->contrib_demo)), 'manage' => array('title' => 'CONTRIB_MANAGE', 'url' => $this->contrib->get_url('manage'), 'auth' => $this->is_author && $this->auth->acl_get('u_titania_post_edit_own') && !$is_disabled || $this->auth->acl_get('u_titania_mod_contrib_mod') || $this->contrib->type->acl_get('moderate')));
     if ($this->contrib->contrib_demo) {
         $demo_menu = array();
         $allowed_branches = $this->contrib->type->get_allowed_branches(true);
         krsort($allowed_branches);
         $is_external = $this->contrib->contrib_status != TITANIA_CONTRIB_APPROVED || !$this->contrib->options['demo'];
         foreach ($allowed_branches as $branch => $name) {
             $demo_url = $this->contrib->get_demo_url($branch, !$is_external);
             if ($demo_url) {
                 $demo_menu[] = array('url' => $demo_url, 'title' => $name, 'external' => $is_external);
             }
         }
         if (sizeof($demo_menu) == 1) {
             $nav_ary['demo']['url'] = $demo_menu[0]['url'];
             $nav_ary['demo']['external'] = $demo_menu[0]['external'];
         } else {
             if (!empty($demo_menu)) {
                 $nav_ary['demo']['sub_menu'] = $demo_menu;
             } else {
                 unset($nav_ary['demo']);
             }
         }
     }
     $this->display->generate_nav($nav_ary, $page, 'details');
 }
예제 #2
0
 /**
  * Assign variables to the template
  */
 public function assign_details()
 {
     if (!sizeof($this->styles)) {
         return false;
     }
     // Get siblings
     $prev = $this->sibling($this->default_style, 'prev');
     $next = $this->sibling($this->default_style, 'next');
     $this->template->assign_vars(array('U_PREV' => $prev['url'], 'PREV_ID' => $prev['id'], 'U_NEXT' => $next['url'], 'NEXT_ID' => $next['id']));
     $category = '';
     $style = new \titania_contribution();
     $style->set_type(TITANIA_TYPE_STYLE);
     $style->options = array('demo' => true);
     foreach ($this->styles as $id => $data) {
         $style->__set_array(array('contrib_id' => $id, 'contrib_name_clean' => $data['contrib_name_clean'], 'contrib_demo' => $data['contrib_demo']));
         $preview_img = false;
         if (isset($data['thumb_id'])) {
             $parameters = array('id' => $data['thumb_id']);
             if ($data['thumbnail']) {
                 $parameters += array('mode' => 'view', 'thumb' => 1);
             }
             $preview_img = $this->controller_helper->route('phpbb.titania.download', $parameters);
         }
         $authors = $this->get_author_profile(array('username_clean' => $data['username_clean'], 'username' => $data['username'], 'user_id' => $data['contrib_user_id'], 'user_colour' => $data['user_colour']));
         $authors .= $data['coauthors'];
         $data['category_name'] = $this->user->lang($data['category_name']);
         $phpbb_version = $data['phpbb_versions']['branch'][0] . '.' . $data['phpbb_versions']['branch'][1] . '.' . $data['phpbb_versions']['revision'];
         $current_phpbb_version = $data['phpbb_versions']['branch'][0] . '.' . $data['phpbb_versions']['branch'][1] . '.' . $this->ext_config->phpbb_versions[$data['phpbb_versions']['branch']]['latest_revision'];
         $vars = array('AUTHORS' => $authors, 'CATEGORY' => $category != $data['category_name'] ? $data['category_name'] : false, 'ID' => $id, 'IFRAME' => $style->get_demo_url($this->phpbb_branch), 'LICENSE' => $data['revision_license'] ? $data['revision_license'] : $this->user->lang['UNKNOWN'], 'NAME' => $data['contrib_name'], 'PHPBB_VERSION' => $phpbb_version, 'PREVIEW' => $preview_img, 'S_OUTDATED' => phpbb_version_compare($phpbb_version, $current_phpbb_version, '<'), 'U_DEMO' => $style->get_demo_url($this->phpbb_branch, true), 'U_DOWNLOAD' => $this->controller_helper->route('phpbb.titania.download', array('id' => $data['attachment_id'])), 'U_VIEW' => $style->get_url());
         if ($this->default_style == $id) {
             $this->template->assign_vars($vars);
         }
         $category = $data['category_name'];
         $this->template->assign_block_vars('stylerow', $vars);
         unset($this->styles[$id], $vars, $this->coauthors[$id]);
     }
 }