Файловый менеджер - Редактировать - /home/lmsyaran/public_html/joomla5/administrator/components/com_fabrik/tables/form.php
Назад
<?php /** * Form Fabrik Table * * @package Joomla * @subpackage Fabrik * @copyright Copyright (C) 2005-2020 Media A-Team, Inc. - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ // No direct access defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Table\Table; use Joomla\CMS\Language\Text; use \Joomla\Registry\Registry; require_once JPATH_ADMINISTRATOR . '/components/com_fabrik/tables/fabtable.php'; /** * Form Fabrik Table * * @package Joomla * @subpackage Fabrik * @since 3.0 */ class FabrikTableForm extends FabTable { /** * @var string */ public $db_table_name = ''; /** * @var int */ public $connection_id; /** * Constructor * * @param JDatabaseDriver &$db database object */ public function __construct(&$db) { parent::__construct('#__fabrik_forms', 'id', $db); } /** * Method to bind an associative array or object to the Table instance.This * method only binds properties that are publicly accessible and optionally * takes an array of properties to ignore when binding. * * @param mixed $src An associative array or object to bind to the Table instance. * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return boolean True on success. */ public function bind($src, $ignore = array()) { if (isset($src['params']) && is_array($src['params'])) { $registry = new Registry; $registry->loadArray($src['params']); $src['params'] = (string) $registry; } // Needed for form edit view where we see the database table anme and connection id if (array_key_exists('db_table_name', $src)) { $this->db_table_name = $src['db_table_name']; } if (array_key_exists('connection_id', $src)) { $this->connection_id = $src['connection_id']; } return parent::bind($src, $ignore); } /** * Method to store a row in the database from the Table instance properties. * If a primary key value is set the row with that primary key value will be * updated with the instance property values. If no primary key value is set * a new row will be inserted into the database with the properties from the * Table instance. * * @param boolean $updateNulls True to update fields even if they are null. * * @return boolean True on success. */ public function store($updateNulls = true) { // We don't want these to be stored - generates an sql error unset($this->db_table_name); unset($this->connection_id); //return parent::store($updateNulls); if (!parent::store($updateNulls)) { throw new RuntimeException('Fabrik error storing form data: ' . $this->getError()); } return true; } /** * Method to load a row from the database by primary key and bind the fields * to the Table instance properties. * * @param mixed $keys An optional primary key value to load the row by, or an array of fields to match. If not * set the instance property value is used. * @param boolean $reset True to reset the default values before loading the new row. * * @return boolean True if successful. False if row not found or on error (internal error state set in that case). */ public function load($keys = null, $reset = true) { if (empty($keys)) { // If empty, use the value of the current key $keyName = $this->_tbl_key; $keyValue = $this->$keyName; // If empty primary key there's is no need to load anything if (empty($keyValue)) { return true; } $keys = array($keyName => $keyValue); } elseif (!is_array($keys)) { // Load by primary key. $keys = array($this->_tbl_key => $keys); } if ($reset) { $this->reset(); } // Initialise the query. $query = $this->_db->getQuery(true); $query->select($this->_tbl . '.*, l.db_table_name, l.connection_id'); $query->from($this->_tbl); $fields = array_keys($this->getProperties()); foreach ($keys as $field => $value) { // Check that $field is in the table. if (!in_array($field, $fields)) { //H $e = new JException(Text::sprintf('JLIB_DATABASE_ERROR_CLASS_IS_MISSING_FIELD', get_class($this), $field)); $e = new \Exception(Text::sprintf('JLIB_DATABASE_ERROR_CLASS_IS_MISSING_FIELD', get_class($this), $field)); $this->setError($e); return false; } // Add the search tuple to the query. $query->where($this->_db->qn($this->_tbl) . '.' . $this->_db->qn($field) . ' = ' . $this->_db->q($value)); } $query->join('LEFT', '#__fabrik_lists AS l ON l.form_id = ' . $this->_tbl . '.id'); $this->_db->setQuery($query); $row = $this->_db->loadAssoc(); // Check that we have a result. if (empty($row)) { //H $e = new JException(Text::_('JLIB_DATABASE_ERROR_EMPTY_ROW_RETURNED')); $e = new \Exception(Text::_('JLIB_DATABASE_ERROR_EMPTY_ROW_RETURNED')); $this->setError($e); return false; } // Bind the object with the row and return. return $this->bind($row); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка