[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_checkin/src/View/Checkin/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_checkin
   6   *
   7   * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Checkin\Administrator\View\Checkin;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\MVC\View\GenericDataException;
  16  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  17  use Joomla\CMS\Toolbar\ToolbarHelper;
  18  
  19  // phpcs:disable PSR1.Files.SideEffects
  20  \defined('_JEXEC') or die;
  21  // phpcs:enable PSR1.Files.SideEffects
  22  
  23  /**
  24   * HTML View class for the Checkin component
  25   *
  26   * @since  1.0
  27   */
  28  class HtmlView extends BaseHtmlView
  29  {
  30      /**
  31       * An array of items
  32       *
  33       * @var  array
  34       */
  35      protected $items;
  36  
  37      /**
  38       * The pagination object
  39       *
  40       * @var  \Joomla\CMS\Pagination\Pagination
  41       */
  42      protected $pagination;
  43  
  44      /**
  45       * The model state
  46       *
  47       * @var  \Joomla\CMS\Object\CMSObject
  48       */
  49      protected $state;
  50  
  51      /**
  52       * Form object for search filters
  53       *
  54       * @var    \Joomla\CMS\Form\Form
  55       *
  56       * @since  4.0.0
  57       */
  58      public $filterForm;
  59  
  60      /**
  61       * The active search filters
  62       *
  63       * @var    array
  64       *
  65       * @since  4.0.0
  66       */
  67      public $activeFilters;
  68  
  69      /**
  70       * Is this view an Empty State
  71       *
  72       * @var   boolean
  73       *
  74       * @since 4.0.0
  75       */
  76      private $isEmptyState = false;
  77  
  78      /**
  79       * Execute and display a template script.
  80       *
  81       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  82       *
  83       * @return  void
  84       */
  85      public function display($tpl = null)
  86      {
  87          $this->items         = $this->get('Items');
  88          $this->pagination    = $this->get('Pagination');
  89          $this->state         = $this->get('State');
  90          $this->total         = $this->get('Total');
  91          $this->filterForm    = $this->get('FilterForm');
  92          $this->activeFilters = $this->get('ActiveFilters');
  93  
  94          if (!\count($this->items)) {
  95              $this->isEmptyState = true;
  96              $this->setLayout('emptystate');
  97          }
  98  
  99          // Check for errors.
 100          if (\count($errors = $this->get('Errors'))) {
 101              throw new GenericDataException(implode("\n", $errors), 500);
 102          }
 103  
 104          $this->addToolbar();
 105  
 106          parent::display($tpl);
 107      }
 108  
 109      /**
 110       * Add the page title and toolbar.
 111       *
 112       * @return  void
 113       *
 114       * @since   1.6
 115       */
 116      protected function addToolbar()
 117      {
 118          ToolbarHelper::title(Text::_('COM_CHECKIN_GLOBAL_CHECK_IN'), 'check-square');
 119  
 120          if (!$this->isEmptyState) {
 121              ToolbarHelper::custom('checkin', 'checkin', '', 'JTOOLBAR_CHECKIN', true);
 122          }
 123  
 124          if (Factory::getApplication()->getIdentity()->authorise('core.admin', 'com_checkin')) {
 125              ToolbarHelper::divider();
 126              ToolbarHelper::preferences('com_checkin');
 127              ToolbarHelper::divider();
 128          }
 129  
 130          ToolbarHelper::help('Maintenance:_Global_Check-in');
 131      }
 132  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer