Source for file html.php

Documentation is available at html.php

  1. <?php
  2. /**
  3.  * @package     FrameworkOnFramework
  4.  * @subpackage  view
  5.  * @copyright   Copyright (C) 2010 - 2012 Akeeba Ltd. All rights reserved.
  6.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  7.  */
  8. // Protect from unauthorized access
  9. defined('_JEXEC'or die;
  10.  
  11. JLoader::import('joomla.application.component.view');
  12.  
  13. /**
  14.  * FrameworkOnFramework HTML output class. Together with PHP-based view tempalates
  15.  * it will render your data into an HTML representation.
  16.  *
  17.  * @package  FrameworkOnFramework
  18.  * @since    2.1
  19.  */
  20. class FOFViewHtml extends FOFViewRaw
  21. {
  22.     /**
  23.      * Class constructor
  24.      *
  25.      * @param   array  $config  Configuration parameters
  26.      */
  27.     public function __construct($config array())
  28.     {
  29.         // Make sure $config is an array
  30.         if (is_object($config))
  31.         {
  32.             $config = (array) $config;
  33.         }
  34.         elseif (!is_array($config))
  35.         {
  36.             $config array();
  37.         }
  38.  
  39.         parent::__construct($config);
  40.  
  41.         $this->config = $config;
  42.  
  43.         // Get the input
  44.         if (array_key_exists('input'$config))
  45.         {
  46.             if ($config['input'instanceof FOFInput)
  47.             {
  48.                 $this->input = $config['input'];
  49.             }
  50.             else
  51.             {
  52.                 $this->input = new FOFInput($config['input']);
  53.             }
  54.         }
  55.         else
  56.         {
  57.             $this->input = new FOFInput;
  58.         }
  59.  
  60.         $this->lists = new JObject;
  61.  
  62.         if (!FOFPlatform::getInstance()->isCli())
  63.         {
  64.             $platform FOFPlatform::getInstance();
  65.             $perms = (object) array(
  66.                     'create'     => $platform->authorise('core.create'$this->input->getCmd('option''com_foobar')),
  67.                     'edit'         => $platform->authorise('core.edit'$this->input->getCmd('option''com_foobar')),
  68.                     'editstate'     => $platform->authorise('core.edit.state'$this->input->getCmd('option''com_foobar')),
  69.                     'delete'     => $platform->authorise('core.delete'$this->input->getCmd('option''com_foobar')),
  70.             );
  71.             $this->assign('aclperms'$perms);
  72.             $this->perms = $perms;
  73.         }
  74.     }
  75.  
  76.     /**
  77.      * Renders the link bar (submenu) using Joomla!'s default
  78.      * JSubMenuHelper::addEntry method
  79.      *
  80.      * @return void 
  81.      */
  82.     protected function renderLinkbar()
  83.     {
  84.         // Do not render a submenu unless we are in the the admin area
  85.  
  86.         if (!FOFPlatform::getInstance()->isBackend(|| FOFPlatform::getInstance()->isCli())
  87.         {
  88.             return;
  89.         }
  90.  
  91.         $toolbar FOFToolbar::getAnInstance($this->input->getCmd('option''com_foobar')$this->config);
  92.         $links $toolbar->getLinks();
  93.  
  94.         if (!empty($links))
  95.         {
  96.             foreach ($links as $link)
  97.             {
  98.                 JSubMenuHelper::addEntry($link['name']$link['link']$link['active']);
  99.             }
  100.         }
  101.     }
  102.  
  103.     /**
  104.      * Runs before rendering the view template, echoing HTML to put before the
  105.      * view template's generated HTML
  106.      *
  107.      * @return void 
  108.      */
  109.     protected function preRender()
  110.     {
  111.         $view $this->input->getCmd('view''cpanel');
  112.         $task $this->getModel()->getState('task''browse');
  113.  
  114.         // Don't load the toolbar on CLI
  115.  
  116.         if (!FOFPlatform::getInstance()->isCli())
  117.         {
  118.             $toolbar FOFToolbar::getAnInstance($this->input->getCmd('option''com_foobar')$this->config);
  119.             $toolbar->perms $this->perms;
  120.             $toolbar->renderToolbar($view$task$this->input);
  121.         }
  122.  
  123.         $renderer $this->getRenderer();
  124.  
  125.         if (!($renderer instanceof FOFRenderAbstract))
  126.         {
  127.             $this->renderLinkbar();
  128.         }
  129.         else
  130.         {
  131.             $renderer->preRender($view$task$this->input$this->config);
  132.         }
  133.     }
  134.  
  135.     /**
  136.      * Runs after rendering the view template, echoing HTML to put after the
  137.      * view template's generated HTML
  138.      *
  139.      * @return  void 
  140.      */
  141.     protected function postRender()
  142.     {
  143.         $view $this->input->getCmd('view''cpanel');
  144.         $task $this->getModel()->getState('task''browse');
  145.  
  146.         $renderer $this->getRenderer();
  147.  
  148.         if ($renderer instanceof FOFRenderAbstract)
  149.         {
  150.             $renderer->postRender($view$task$this->input$this->config);
  151.         }
  152.     }
  153. }

Documentation generated on Tue, 19 Nov 2013 15:04:46 +0100 by phpDocumentor 1.4.3