PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / manageimport / view.html.php
vikappointments / admin / views / manageimport Last commit date
tmpl 4 years ago index.html 7 years ago view.html.php 2 years ago
view.html.php
85 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 manage import view.
16 *
17 * @since 1.6
18 */
19 class VikAppointmentsViewmanageimport 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 $this->addToolBar();
33
34 $type = $input->getString('import_type');
35 $args = $input->get('import_args', array(), 'array');
36
37 VAPLoader::import('libraries.import.factory');
38 $handler = ImportFactory::getObject($type);
39
40 if (!$handler)
41 {
42 throw new Exception('Import type not supported.', 404);
43 }
44
45 if (!$handler->hasFile())
46 {
47 // file not uploaded, back to import view
48 $url = 'index.php?option=com_vikappointments&view=import&import_type=' . $type;
49
50 if ($args)
51 {
52 $url .= '&' . http_build_query(array('import_args' => $args));
53 }
54
55 $app->redirect($url);
56 exit;
57 }
58
59 $this->type = $type;
60 $this->args = $args;
61 $this->handler = $handler;
62
63 // display the template (default.php)
64 parent::display($tpl);
65 }
66
67 /**
68 * Setting the toolbar.
69 *
70 * @return void
71 */
72 protected function addToolBar()
73 {
74 // add menu title and some buttons to the page
75 JToolBarHelper::title(JText::translate('VAPMAINTITLEMANAGEIMPORT'), 'vikappointments');
76
77 if (JFactory::getUser()->authorise('core.create', 'com_vikappointments'))
78 {
79 JToolBarHelper::apply('import.save', JText::translate('VAPSAVE'));
80 }
81
82 JToolBarHelper::cancel('import.cancel');
83 }
84 }
85