view.html.php
81 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 export view. |
| 16 | * |
| 17 | * @since 1.6 |
| 18 | */ |
| 19 | class VikAppointmentsViewexport 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 | $type = $input->getString('import_type'); |
| 33 | $args = $input->get('import_args', array(), 'array'); |
| 34 | $cid = $input->get('cid', array(), 'uint'); |
| 35 | |
| 36 | VAPLoader::import('libraries.import.factory'); |
| 37 | |
| 38 | $handler = ImportFactory::getObject($type); |
| 39 | |
| 40 | if (!$handler) |
| 41 | { |
| 42 | throw new Exception('Import type not supported.', 404); |
| 43 | } |
| 44 | |
| 45 | $rows = $handler->getExportableRows($args); |
| 46 | |
| 47 | // get the list of all the available exportable classes |
| 48 | $export_list = ImportFactory::getExportList(); |
| 49 | |
| 50 | $this->addToolBar($handler); |
| 51 | |
| 52 | $this->type = $type; |
| 53 | $this->args = $args; |
| 54 | $this->cid = $cid; |
| 55 | $this->rows = $rows; |
| 56 | $this->handler = $handler; |
| 57 | $this->exportList = $export_list; |
| 58 | |
| 59 | // display the template (default.php) |
| 60 | parent::display($tpl); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Setting the toolbar. |
| 65 | * |
| 66 | * @return void |
| 67 | */ |
| 68 | protected function addToolBar($handler) |
| 69 | { |
| 70 | // add menu title and some buttons to the page |
| 71 | JToolBarHelper::title(JText::translate('VAPMAINTITLEVIEWEXPORT'), 'vikappointments'); |
| 72 | |
| 73 | if ($task = $handler->getCancelTask()) |
| 74 | { |
| 75 | JToolBarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_vikappointments&task=' . $task); |
| 76 | } |
| 77 | |
| 78 | JToolBarHelper::custom('export', 'download', 'download', JText::translate('VAPDOWNLOAD'), false); |
| 79 | } |
| 80 | } |
| 81 |