File manager - Edit - /home/verseaumee/ptitsanes/plugins/solidres/feedback/administrator/components/com_solidres/models/feedbacktype.php
Back
<?php /* ------------------------------------------------------------------------ Solidres - Hotel booking extension for Joomla ------------------------------------------------------------------------ @Author Solidres Team @Website http://www.solidres.com @Copyright Copyright (C) 2013 - 2015 Solidres. All Rights Reserved. @License GNU General Public License version 3, or later ------------------------------------------------------------------------ */ defined('_JEXEC') or die; /** * Feedback type model. * * @package Solidres * @subpackage Feedback * @since 0.8.0 */ class SolidresModelFeedBackType extends SRModelAdmin { /** * Constructor. * * @param array An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { parent::__construct($config); $this->text_prefix = strtoupper($this->option); } /** * Method to test whether a record can be deleted. * * @param object A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { $user = JFactory::getUser(); return $user->authorise('core.delete', 'com_solidres'); } /** * Prepare and sanitise the table prior to saving. * * @since 1.6 */ protected function prepareTable($table) { jimport('joomla.filter.output'); $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); return $table; } /** * Method to test whether a record can be edit. * * @param object A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canEditState($record) { $user = JFactory::getUser(); return $user->authorise('core.edit.state', 'com_solidres'); } /** * Returns a reference to the a Table object, always creating it. * * @param type The table type to instantiate * @param string A prefix for the table class name. Optional. * @param array Configuration array for model. Optional. * * @return JTable A database object * @since 1.6 */ public function getTable($type = 'FeedBackType', $prefix = 'SolidresTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * Method to get the record form. * * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * @since 1.6 */ public function getForm($data = array(), $loadData = true) { JForm::addFormPath(SR_PLUGIN_FEEDBACK_ADMINISTRATOR.'/models/forms'); JForm::addFieldPath(SR_PLUGIN_FEEDBACK_ADMINISTRATOR.'/models/fields'); $form = $this->loadForm('com_solidres.feedbacktype', 'feedbacktype', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_solidres.edit.feedbacktype.data', array()); if (empty($data)) { $data = $this->getItem(); } return $data; } public function delete(&$pks) { $pks = (array) $pks; $db = $this->getDbo(); $query = $db->getQuery(true) ->select('count(r.id)') ->from($db->quoteName('#__sr_feedback_attribute_values', 'r')) ->where('r.attribute_id IN (' . join(',', $pks) . ')'); $db->setQuery($query); $count = (int) $db->loadResult(); if ($count) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('SR_FEEDBACK_DELETE_WARNING_HAVE_CHILDREN', 'index.php?option=com_solidres&view=feedbacktypevalues'), 'warning'); $app->redirect('index.php?option=com_solidres&view=feedbacktypes'); } return parent::delete($pks); } }
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings