File manager - Edit - /home/verseaumee/ptitsanes/administrator/components/com_solidres/models/fields/modal/reservationasset.php
Back
<?php /** ------------------------------------------------------------------------ SOLIDRES - Accommodation booking extension for Joomla ------------------------------------------------------------------------ * @author Solidres Team <contact@solidres.com> * @website https://www.solidres.com * @copyright Copyright (C) 2013 - 2019 Solidres. All Rights Reserved. * @license GNU General Public License version 3, or later ------------------------------------------------------------------------ */ defined('JPATH_BASE') or die; /** * Supports a modal reservation asset picker. * * @package Solidres * @subpackage ReservationAsset * @since 0.6.0 */ class JFormFieldModal_ReservationAsset extends JFormField { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'Modal_ReservationAsset'; /** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $allowEdit = ((string) $this->element['edit'] == 'true') ? true : false; $allowClear = ((string) $this->element['clear'] != 'false') ? true : false; // Load language JFactory::getLanguage()->load('com_solidres', JPATH_ADMINISTRATOR); // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); JHtml::_('bootstrap.tooltip'); // Build the script. $script = array(); $script[] = ' function jSelectReservationAsset_' . $this->id . '(id, name, object) {'; $script[] = ' document.id("' . $this->id . '_id").value = id;'; $script[] = ' document.id("' . $this->id . '_name").value = name;'; if ($allowEdit) { $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; } if ($allowClear) { $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; } $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Clear button script static $scriptClear; if ($allowClear && !$scriptClear) { $scriptClear = true; $script[] = ' function jClearReservationAsset(id) {'; $script[] = ' document.getElementById(id + "_id").value = "";'; $script[] = ' document.getElementById(id + "_name").value = "' . htmlspecialchars(JText::_('SR_SELECT_A_RESERVATION_ASSET', true), ENT_COMPAT, 'UTF-8') . '";'; $script[] = ' jQuery("#"+id + "_clear").addClass("hidden");'; $script[] = ' if (document.getElementById(id + "_edit")) {'; $script[] = ' jQuery("#"+id + "_edit").addClass("hidden");'; $script[] = ' }'; $script[] = ' return false;'; $script[] = ' }'; } // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=com_solidres&view=reservationassets&layout=modal&tmpl=component&function=jSelectReservationAsset_' . $this->id; if (isset($this->element['language'])) { $link .= '&forcedLanguage=' . $this->element['language']; } if ((int) $this->value > 0) { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('name')->from($db->quoteName('#__sr_reservation_assets'))->where('id = ' . (int) $this->value); $db->setQuery($query); try { $title = $db->loadResult(); } catch (RuntimeException $e) { throw new Exception($e->getMessage(), 500); } } if (empty($title)) { $title = JText::_('SR_SELECT_A_RESERVATION_ASSET'); } $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); // The active article id field. if (0 == (int) $this->value) { $value = ''; } else { $value = (int) $this->value; } // The current user display field. $html[] = '<span class="input-append">'; $html[] = '<input type="text" class="input-medium" id="' . $this->id . '_name" value="' . $title . '" disabled="disabled" size="35" />'; $html[] = '<a class="modal btn hasTooltip" title="' . JHtml::tooltipText('SR_SELECT_A_RESERVATION_ASSET') . '" href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> ' . JText::_('JSELECT') . '</a>'; // Edit article button if ($allowEdit) { $html[] = '<a class="btn hasTooltip' . ($value ? '' : ' hidden') . '" href="index.php?option=com_solidres&layout=modal&tmpl=component&task=reservationasset.edit&id=' . $value . '" target="_blank" title="' . JHtml::tooltipText('JACTION_EDIT') . '" ><span class="icon-edit"></span> ' . JText::_('JACTION_EDIT') . '</a>'; } // Clear article button if ($allowClear) { $html[] = '<button id="' . $this->id . '_clear" class="btn' . ($value ? '' : ' hidden') . '" onclick="return jClearReservationAsset(\'' . $this->id . '\')"><span class="icon-remove"></span> ' . JText::_('JCLEAR') . '</button>'; } $html[] = '</span>'; // class='required' for client side validation $class = ''; if ($this->required) { $class = ' class="required modal-value"'; } // The active user id field. $html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />'; return implode("\n", $html); } }
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings