view.html.php
68 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 API plugin management view. |
| 16 | * |
| 17 | * @since 1.7 |
| 18 | */ |
| 19 | class VikAppointmentsViewmanageapiplugin 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 | |
| 31 | // set the toolbar |
| 32 | $this->addToolBar(); |
| 33 | |
| 34 | $apis = VAPFactory::getApi(); |
| 35 | |
| 36 | $ids = $input->get('cid', array(''), 'string'); |
| 37 | |
| 38 | // search for specified plugin |
| 39 | $plugins = $apis->getPluginsList($ids[0]); |
| 40 | |
| 41 | if (count($plugins) == 0) |
| 42 | { |
| 43 | // plugin not found, back to the list |
| 44 | $app->enqueueMessage(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'), 'error'); |
| 45 | $app->redirect('index.php?option=com_vikappointments&view=apiplugins'); |
| 46 | exit; |
| 47 | } |
| 48 | |
| 49 | $this->plugin = $plugins[0]; |
| 50 | |
| 51 | // display the template |
| 52 | parent::display($tpl); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Setting the toolbar. |
| 57 | * |
| 58 | * @return void |
| 59 | */ |
| 60 | private function addToolBar() |
| 61 | { |
| 62 | // add menu title and some buttons to the page |
| 63 | JToolbarHelper::title(JText::translate('VAPMAINTITLEVIEWAPIPLUGINS'), 'vikappointments'); |
| 64 | |
| 65 | JToolbarHelper::cancel('apiplugin.cancel', 'JTOOLBAR_CLOSE'); |
| 66 | } |
| 67 | } |
| 68 |