view.html.php
62 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 service info view. |
| 16 | * |
| 17 | * @since 1.0 |
| 18 | */ |
| 19 | class VikAppointmentsViewserviceinfo 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 | $ids = $input->getUint('cid', array(0), 'uint'); |
| 33 | |
| 34 | // get options |
| 35 | $q = $dbo->getQuery(true) |
| 36 | ->select($dbo->qn(array('o.id', 'o.name'))) |
| 37 | ->from($dbo->qn('#__vikappointments_option', 'o')) |
| 38 | ->leftjoin($dbo->qn('#__vikappointments_ser_opt_assoc', 'a') . ' ON ' . $dbo->qn('o.id') . ' = ' . $dbo->qn('a.id_option')) |
| 39 | ->where($dbo->qn('a.id_service') . ' = ' . $ids[0]); |
| 40 | |
| 41 | $dbo->setQuery($q); |
| 42 | $options = $dbo->loadObjectList(); |
| 43 | |
| 44 | // get employees |
| 45 | $q = $dbo->getQuery(true) |
| 46 | ->select($dbo->qn(array('e.id', 'e.nickname'))) |
| 47 | ->from($dbo->qn('#__vikappointments_employee', 'e')) |
| 48 | ->leftjoin($dbo->qn('#__vikappointments_ser_emp_assoc', 'a') . ' ON ' . $dbo->qn('e.id') . ' = ' . $dbo->qn('a.id_employee')) |
| 49 | ->where($dbo->qn('a.id_service') . ' = ' . $ids[0]) |
| 50 | ->order($dbo->qn('a.ordering') . ' ASC'); |
| 51 | |
| 52 | $dbo->setQuery($q); |
| 53 | $employees = $dbo->loadObjectList(); |
| 54 | |
| 55 | $this->options = $options; |
| 56 | $this->employees = $employees; |
| 57 | |
| 58 | // display the template |
| 59 | parent::display($tpl); |
| 60 | } |
| 61 | } |
| 62 |