Esempio n. 1
0
 /**
  * Extension front handler method. This is called automatically when your extension is accessed
  * through index.php?ext=example/foobar
  *
  * @param array $columns Columns to display
  *
  * @return null
  */
 public function handle($columns = array())
 {
     // Do not run portal if it's already active
     if ($this->portal_active) {
         return;
     }
     $this->controller_helper->run_initial_tasks();
     // Set portal active
     $this->portal_active = true;
     // Check if we should limit the columns to display
     $this->set_allowed_columns($columns);
     // Set default data
     $this->portal_modules = obtain_portal_modules();
     $display_online = false;
     /**
      * set up column_count array
      * with this we can hide unneeded parts of the portal
      */
     $this->module_count = array('total' => 0, 'top' => 0, 'left' => 0, 'center' => 0, 'right' => 0, 'bottom' => 0);
     /**
      * start assigning block vars
      */
     foreach ($this->portal_modules as $row) {
         if (!($module = $this->controller_helper->get_portal_module($row))) {
             continue;
         }
         // Load module language file
         $this->controller_helper->load_module_language($module);
         $template_module = $this->get_module_template($row, $module);
         if (empty($template_module)) {
             continue;
         }
         // Custom Blocks that have been defined in the ACP will return an array instead of just the name of the template file
         $this->controller_helper->assign_module_vars($row, $template_module);
         // Check if we need to show the online list
         $display_online = $this->controller_helper->check_online_list($row['module_classname'], $display_online);
         unset($template_module);
     }
     // Redirect to index if there are currently no active modules
     $this->check_redirect();
     // Assign specific vars
     $this->assign_template_vars();
     // Return if columns were specified. Columns are only specified if
     // portal columns are displayed on pages other than the portal itself.
     if ($this->allowed_columns !== 0) {
         $this->template->assign_var('S_PORTAL_ALL', true);
         return;
     }
     // And now to output the page.
     page_header($this->user->lang('PORTAL'), $display_online);
     // foobar_body.html is in ./ext/foobar/example/styles/prosilver/template/foobar_body.html
     $this->template->set_filenames(array('body' => 'portal/portal_body.html'));
     $this->make_jumpbox($this->config['board3_display_jumpbox']);
     page_footer();
 }