PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / import / view.html.php
vikappointments / admin / views / import Last commit date
tmpl 4 years ago index.html 6 years ago view.html.php 2 years ago
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 import view.
16 *
17 * @since 1.6
18 */
19 class VikAppointmentsViewimport 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
35 VAPLoader::import('libraries.import.factory');
36 $handler = ImportFactory::getObject($type);
37
38 if (!$handler)
39 {
40 throw new Exception('Import type not supported.', 404);
41 }
42
43 $this->addToolBar($handler);
44
45 $file = (string) $handler->getFile();
46
47 $this->type = $type;
48 $this->args = $args;
49 $this->file = $file;
50
51 // display the template (default.php)
52 parent::display($tpl);
53 }
54
55 /**
56 * Setting the toolbar.
57 *
58 * @return void
59 */
60 protected function addToolBar($handler)
61 {
62 // add menu title and some buttons to the page
63 JToolBarHelper::title(JText::translate('VAPMAINTITLEVIEWIMPORT'), 'vikappointments');
64
65 if ($task = $handler->getCancelTask())
66 {
67 JToolBarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_vikappointments&task=' . $task);
68 }
69
70 if (JFactory::getUser()->authorise('core.create', 'com_vikappointments'))
71 {
72 JToolBarHelper::addNew('import.add', JText::translate('VAPIMPORT'));
73 }
74
75 if ($handler->hasSampleFile())
76 {
77 JToolBarHelper::custom('import.downloadsample', 'download', 'download', JText::translate('VAPDOWNLOAD'), false);
78 }
79 }
80 }
81