예제 #1
0
 /**
  * Set template var options for page link location menus
  *
  * @param int $page_id Page identifier
  * @param array $current Currently selected link locations (from the form data)
  * @return null
  * @access protected
  */
 protected function create_page_link_options($page_id = 0, $current = array())
 {
     // Get all page links assigned to the page (if it's being edited)
     if ($page_id && empty($current)) {
         $page_links = $this->page_operator->get_page_links(array($page_id));
         foreach ($page_links as $page_link) {
             $current[] = $page_link['page_link_id'];
         }
     }
     // Get all link location names and identifiers
     $link_locations = $this->page_operator->get_link_locations();
     // Set the options list template vars
     foreach ($link_locations as $link) {
         $this->template->assign_block_vars('page_link_options', array('VALUE' => $link['page_link_id'], 'LABEL' => $this->user->lang($link['page_link_location']), 'S_SELECTED' => in_array($link['page_link_id'], $current)));
     }
 }
예제 #2
0
파일: listener.php 프로젝트: R3gi/pages
 /**
  * Display links to pages in the specified page link locations
  *
  * @return null
  * @access public
  */
 public function show_page_links()
 {
     // Get all page link data
     $rowset = $this->page_operator->get_page_links();
     // Get custom page link icons
     $pages_icons = $this->page_operator->get_page_icons();
     foreach ($rowset as $row) {
         // Skip page if it should not be displayed (admins always have access to a page)
         if (!$row['page_display'] && !$this->auth->acl_get('a_') || !$row['page_display_to_guests'] && $this->user->data['user_id'] == ANONYMOUS) {
             continue;
         }
         // Assign any available custom icons for the current link in the user's style
         $custom_icon = '';
         foreach ($pages_icons as $icon_path => $ext_name) {
             if (strpos($icon_path, $this->user->style['style_path'] . '/theme/images/pages_' . $row['page_route'] . '.gif') !== false) {
                 $custom_icon = 'pages_' . $row['page_route'] . '.gif';
                 break;
             }
         }
         // Assign template var data
         $this->template->assign_block_vars($row['page_link_event_name'] . '_links', array('U_LINK_URL' => $this->helper->route('phpbb_pages_main_controller', array('route' => $row['page_route'])), 'LINK_ROUTE' => $row['page_route'], 'LINK_TITLE' => $row['page_title'], 'ICON_LINK' => $custom_icon));
         $this->template->assign_var('S_' . strtoupper($row['page_link_event_name']), true);
     }
 }