[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_actionlogs/src/View/Actionlogs/ -> HtmlView.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.Administrator
   4   * @subpackage  com_actionlogs
   5   *
   6   * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\Component\Actionlogs\Administrator\View\Actionlogs;
  11  
  12  \defined('_JEXEC') or die;
  13  
  14  use Exception;
  15  use Joomla\CMS\Component\ComponentHelper;
  16  use Joomla\CMS\Form\Form;
  17  use Joomla\CMS\Language\Text;
  18  use Joomla\CMS\MVC\View\GenericDataException;
  19  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  20  use Joomla\CMS\Pagination\Pagination;
  21  use Joomla\CMS\Toolbar\Toolbar;
  22  use Joomla\CMS\Toolbar\ToolbarHelper;
  23  use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
  24  use Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel;
  25  
  26  /**
  27   * View class for a list of logs.
  28   *
  29   * @since  3.9.0
  30   */
  31  class HtmlView extends BaseHtmlView
  32  {
  33      /**
  34       * An array of items.
  35       *
  36       * @var    array
  37       * @since  3.9.0
  38       */
  39      protected $items;
  40  
  41      /**
  42       * The model state
  43       *
  44       * @var    array
  45       * @since  3.9.0
  46       */
  47      protected $state;
  48  
  49      /**
  50       * The pagination object
  51       *
  52       * @var    Pagination
  53       * @since  3.9.0
  54       */
  55      protected $pagination;
  56  
  57      /**
  58       * Form object for search filters
  59       *
  60       * @var    Form
  61       * @since  3.9.0
  62       */
  63      public $filterForm;
  64  
  65      /**
  66       * The active search filters
  67       *
  68       * @var    array
  69       * @since  3.9.0
  70       */
  71      public $activeFilters;
  72  
  73      /**
  74       * Setting if the IP column should be shown
  75       *
  76       * @var    boolean
  77       * @since  3.9.0
  78       */
  79      protected $showIpColumn = false;
  80  
  81      /**
  82       * Setting if the date should be displayed relative to the current date.
  83       *
  84       * @var    boolean
  85       * @since  4.1.0
  86       */
  87      protected $dateRelative = false;
  88  
  89      /**
  90       * Method to display the view.
  91       *
  92       * @param   string  $tpl  A template file to load. [optional]
  93       *
  94       * @return  void
  95       *
  96       * @since   3.9.0
  97       *
  98       * @throws  Exception
  99       */
 100  	public function display($tpl = null)
 101      {
 102          /** @var ActionlogsModel $model */
 103          $model               = $this->getModel();
 104          $this->items         = $model->getItems();
 105          $this->state         = $model->getState();
 106          $this->pagination    = $model->getPagination();
 107          $this->filterForm    = $model->getFilterForm();
 108          $this->activeFilters = $model->getActiveFilters();
 109          $params              = ComponentHelper::getParams('com_actionlogs');
 110          $this->showIpColumn  = (bool) $params->get('ip_logging', 0);
 111          $this->dateRelative  = (bool) $params->get('date_relative', 1);
 112  
 113          if (\count($errors = $model->getErrors()))
 114          {
 115              throw new GenericDataException(implode("\n", $errors), 500);
 116          }
 117  
 118          $this->addToolbar();
 119  
 120          // Load all actionlog plugins language files
 121          ActionlogsHelper::loadActionLogPluginsLanguage();
 122  
 123          parent::display($tpl);
 124      }
 125  
 126      /**
 127       * Add the page title and toolbar.
 128       *
 129       * @return  void
 130       *
 131       * @since   3.9.0
 132       */
 133  	protected function addToolbar()
 134      {
 135          ToolbarHelper::title(Text::_('COM_ACTIONLOGS_MANAGER_USERLOGS'), 'icon-list-2');
 136  
 137          ToolbarHelper::custom('actionlogs.exportSelectedLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_CSV', true);
 138          ToolbarHelper::custom('actionlogs.exportLogs', 'download', '', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', false);
 139          ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'actionlogs.delete');
 140          $bar = Toolbar::getInstance('toolbar');
 141          $bar->appendButton('Confirm', 'COM_ACTIONLOGS_PURGE_CONFIRM', 'delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge', false);
 142          ToolbarHelper::preferences('com_actionlogs');
 143          ToolbarHelper::help('User_Actions_Log');
 144      }
 145  }


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