view.html.php
103 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | /** |
| 15 | * VikAppointments media translations view. |
| 16 | * |
| 17 | * @since 1.7.2 |
| 18 | */ |
| 19 | class VikAppointmentsViewlangmedia extends JViewVAP |
| 20 | { |
| 21 | /** |
| 22 | * VikAppointments view display method. |
| 23 | * |
| 24 | * @return void |
| 25 | */ |
| 26 | function display($tpl = null) |
| 27 | { |
| 28 | $app = JFactory::getApplication(); |
| 29 | $input = $app->input; |
| 30 | $dbo = JFactory::getDbo(); |
| 31 | |
| 32 | // set the toolbar |
| 33 | $this->addToolBar(); |
| 34 | |
| 35 | $filters = array(); |
| 36 | $filters['image'] = $input->get('image', '', 'string'); |
| 37 | |
| 38 | $lim = $app->getUserStateFromRequest('com_vikappointments.limit', 'limit', $app->get('list_limit'), 'int'); |
| 39 | $lim0 = $this->getListLimitStart($filters); |
| 40 | $navbut = ""; |
| 41 | |
| 42 | $rows = array(); |
| 43 | |
| 44 | $q = $dbo->getQuery(true); |
| 45 | |
| 46 | $q->select('SQL_CALC_FOUND_ROWS *') |
| 47 | ->from($dbo->qn('#__vikappointments_lang_media')) |
| 48 | ->where($dbo->qn('image') . ' = ' . $dbo->q($filters['image'])); |
| 49 | |
| 50 | $dbo->setQuery($q, $lim0, $lim); |
| 51 | $dbo->execute(); |
| 52 | |
| 53 | // assert limit used for list query |
| 54 | $this->assertListQuery($lim0, $lim); |
| 55 | |
| 56 | if ($dbo->getNumRows()) |
| 57 | { |
| 58 | $rows = $dbo->loadAssocList(); |
| 59 | $dbo->setQuery('SELECT FOUND_ROWS();'); |
| 60 | jimport('joomla.html.pagination'); |
| 61 | $pageNav = new JPagination($dbo->loadResult(), $lim0, $lim); |
| 62 | $navbut = JLayoutHelper::render('blocks.pagination', ['pageNav' => $pageNav]); |
| 63 | } |
| 64 | |
| 65 | $this->rows = $rows; |
| 66 | $this->navbut = $navbut; |
| 67 | $this->filters = $filters; |
| 68 | |
| 69 | // display the template (default.php) |
| 70 | parent::display($tpl); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Setting the toolbar. |
| 75 | * |
| 76 | * @return void |
| 77 | */ |
| 78 | private function addToolBar() |
| 79 | { |
| 80 | // add menu title and some buttons to the page |
| 81 | JToolbarHelper::title(JText::translate('VAP_TRX_LIST_TITLE'), 'vikappointments'); |
| 82 | |
| 83 | $user = JFactory::getUser(); |
| 84 | |
| 85 | JToolBarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_vikappointments&view=media'); |
| 86 | |
| 87 | if ($user->authorise('core.create', 'com_vikappointments')) |
| 88 | { |
| 89 | JToolbarHelper::addNew('langmedia.add'); |
| 90 | } |
| 91 | |
| 92 | if ($user->authorise('core.edit', 'com_vikappointments')) |
| 93 | { |
| 94 | JToolbarHelper::editList('langmedia.edit'); |
| 95 | } |
| 96 | |
| 97 | if ($user->authorise('core.delete', 'com_vikappointments')) |
| 98 | { |
| 99 | JToolbarHelper::deleteList(VikAppointments::getConfirmSystemMessage(), 'langmedia.delete'); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 |