private function load() { $result = false; // Load the table object, empty if _state->data->key = null; $this->getTable()->load($this->_state->get($this->_key, null)); //if we have incoming data, bind it to the table object if ($data = $this->_state->get('data', false)) { $this->_table->bind($data); } //set the state to the table data. $this->_state->set('data', get_object_vars($this->_table)); }
/** * Get a connection table object * * @param int $id connection id * * @return object connection tables */ public function &getConnection($id = null) { if (!is_null($id)) { $this->setId($id); } if (!is_object($this->_connection)) { $session = JFactory::getSession(); $key = 'fabrik.connection.' . $this->_id; if ($session->has($key)) { $connProperties = unserialize($session->get($key)); // $$$ rob since J1.6 - connection properties stored as an array (in f2 it was an object) if (is_a($connProperties, '__PHP_Incomplete_Class') || JArrayHelper::getValue($connProperties, 'id') == '') { $session->clear($key); } else { $this->_connection = FabTable::getInstance('connection', 'FabrikTable'); $this->_connection->bind($connProperties); return $this->_connection; } } if ($this->_id == -1 || $this->_id == '') { $this->_connection = $this->loadDefaultConnection(); } else { $this->_connection = FabTable::getInstance('Connection', 'FabrikTable'); $this->_connection->load($this->_id); } // $$$ rob store the connection for later use as it may be required by modules/plugins $session->set($key, serialize($this->_connection->getProperties())); } return $this->_connection; }
/** * Bind Table override * @override * * @see JTable::bind() */ public function bind($fromArray, $saveTask = false, $sessionTask = false) { parent::bind($fromArray); if ($saveTask) { $services = array(); foreach ($fromArray as $key => $value) { if (strpos($key, 'chk_') === 0) { $services[$key] = $value; } } if (is_array($services)) { $this->services = json_encode($services); } } // Manage complex attributes during session recovering bind/load if ($sessionTask) { $services = array(); foreach ($fromArray as $key => $value) { if (strpos($key, 'chk_') === 0) { $services[$key] = $value; } } $registry = new JRegistry($services); $this->services = $registry; } return true; }
public function bind($src, $ignore = array()) { if (!is_object($src) && !is_array($src)) { $src = new stdClass(); } return parent::bind($src, $ignore); }
public function bind($array, $ignore = '') { // in here we are checking for the empty value of the checkbox //don't override without calling base class return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['print_title']) && is_array($array['print_title'])) { $array['print_title'] = array_filter($array['print_title']); if (count($array['print_title'])) { $registry = new JRegistry(); $registry->loadArray($array['print_title']); $array['print_title'] = (string) $registry; } } if (isset($array['nutrients']) && is_array($array['nutrients'])) { $registry = new JRegistry(); $registry->loadArray($array['nutrients']); $array['nutrients'] = (string) $registry; } if (isset($array['compositions']) && is_array($array['compositions'])) { // delete 0 values $array['compositions'] = array_filter($array['compositions']); $registry = new JRegistry(); $registry->loadArray($array['compositions']); $array['compositions'] = (string) $registry; // if composition has sub compositions then nutrients values must delete $array['nutrients'] = ''; } return parent::bind($array, $ignore); }
/** * Overloaded bind function * * @param array $array Named array to bind * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return null|string null is operation was satisfactory, otherwise returns an error * */ public function bind($array, $ignore = array()) { if (!array_key_exists('readonly', $array)) { $array['readonly'] = '0'; } return parent::bind($array, $ignore); }
/** * Test for delete method with no primary key specified. * * @return void * * @since 12.3 */ public function testDelete() { $this->assertEquals(2, $this->getConnection()->getRowCount('jos_dbtest_composite'), "Pre-Condition"); $this->object->bind(array('id1' => 25, 'id2' => 50, 'title' => 'My Title')); $this->object->delete(); $this->assertEquals(1, $this->getConnection()->getRowCount('jos_dbtest_composite'), "Delete failed."); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 3.3.3 */ public function bind($array, $ignore = '') { if ($array['date'] == 'update') { $array['date'] = ''; } return parent::bind($array, $ignore); }
public function bind($src, $ignore = array()) { if (empty($src) || is_null($src)) { return true; } return parent::bind($src, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind */ public function bind($array, $ignore = '') { if (isset($array['body']) && is_array($array['body'])) { $registry = new JRegistry(); $registry->loadArray($array['body']); $array['body'] = (string) $registry; } if (isset($array['special']) && is_array($array['special'])) { $registry = new JRegistry(); $registry->loadArray($array['special']); $array['special'] = (string) $registry; } if (isset($array['laboratory']) && is_array($array['laboratory'])) { $registry = new JRegistry(); $registry->loadArray($array['laboratory']); $array['laboratory'] = (string) $registry; } if (isset($array['payment']) && is_array($array['payment'])) { $registry = new JRegistry(); $registry->loadArray($array['payment']); $array['payment'] = (string) $registry; } if (isset($array['ctags']) && is_array($array['ctags'])) { $array['ctags'] = implode(',', $array['ctags']); } else { $data['ctags'] = ''; } return parent::bind($array, $ignore); }
/** * Method to bind an associative array or object to the JTable instance.This * method only binds properties that are publicly accessible and optionally * takes an array of properties to ignore when binding. * * @param mixed $array An associative array or object to bind to the JTable instance. * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return boolean True on success. * * @link https://docs.joomla.org/JTable/bind * @since 3.2 * @throws UnexpectedValueException */ public function bind($array, $ignore = '') { if (isset($array['item_description'])) { $pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i'; $tagPos = preg_match($pattern, $array['item_description']); if ($tagPos == 0) { $this->introtext = $array['item_description']; $this->fulltext = ''; } else { list($this->introtext, $this->fulltext) = preg_split($pattern, $array['item_description'], 2); } } if (isset($array['params']) && is_array($array['params'])) { $tmp = array(); foreach ($array['params']['attr'] as $key => $param) { $tmp['attr_' . $key] = $param; } $array['params'] = json_encode($tmp); } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (isset($array['techs']) && is_array($array['techs'])) { $registry = new JRegistry(); $registry->loadArray($array['techs']); $array['techs'] = (string) $registry; } return parent::bind($array, $ignore); }
/** * Overloaded bind function * @access public * @param array $hash named array * @return null|string null is operation was satisfactory, otherwise returns an error */ public function bind($array, $ignore = '') { if (key_exists('params', $array) && is_array($array['params'])) { $array['params'] = json_encode($array['params']); } return parent::bind($array, $ignore); }
public function bind($array, $ignore = '') { if (!isset($array['lic'])) { $array['lic'] = '0'; } return parent::bind($array, $ignore); }
/** * Overloaded bind function * * @param array $hash named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (is_array($array['categoria'])) { $array['categoria'] = implode(',', $array['categoria']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function * * @param array $array Named array * @param mixed $ignore An optional array or space separated list of properties * to ignore while binding. * * @return mixed Null if operation was satisfactory, otherwise returns an error string * * @see JTable::bind() * @since 3.1 */ public function bind($array, $ignore = '') { if (isset($array['core_params']) && is_array($array['core_params'])) { $registry = new Registry(); $registry->loadArray($array['core_params']); $array['core_params'] = (string) $registry; } if (isset($array['core_metadata']) && is_array($array['core_metadata'])) { $registry = new Registry(); $registry->loadArray($array['core_metadata']); $array['core_metadata'] = (string) $registry; } if (isset($array['core_images']) && is_array($array['core_images'])) { $registry = new Registry(); $registry->loadArray($array['core_images']); $array['core_images'] = (string) $registry; } if (isset($array['core_urls']) && is_array($array['core_urls'])) { $registry = new Registry(); $registry->loadArray($array['core_urls']); $array['core_urls'] = (string) $registry; } if (isset($array['core_body']) && is_array($array['core_body'])) { $registry = new Registry(); $registry->loadArray($array['core_body']); $array['core_body'] = (string) $registry; } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array $array Named array * @param string $ignore * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!isset($array['lat']) && !isset($array['lng'])) { $options = array(0 => $array['address_1'], 1 => $array['city'], 2 => isset($array['geo_state_id']) ? $array['geo_state_id'] : null, 3 => $array['country_id']); $coords = SRFactory::getGeoCoder($options)->process(); if (is_array($coords)) { $array['lat'] = $coords['lat']; $array['lng'] = $coords['lng']; } } // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { $rules = new JAccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); }
public function bind($src, $ignore = array()) { parent::bind($src); $this->_params = new JRegistry($this->params); // Setup missing params $storeNow = false; $db = JFactory::getDBO(); // Grab thumbnail from cover photo $thumbnail = $this->_params->get('thumbnail'); if (empty($thumbnail)) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($this->photoid); $thumbnail = str_replace(JURI::root(), '', $photo->getThumbURI()); $this->_params->set('thumbnail', $thumbnail); $storeNow = true; } // Grab last update from last uploaded photo $lastupdated = $this->_params->get('lastupdated'); if (empty($lastupdated)) { $this->_updatelastUpdate(); $storeNow = true; } // How many photos in this album $count = $this->_params->get('count', -1); if ($count != $this->getPhotosCount()) { $this->_updateCount(); $storeNow = true; } // Do we need to store this album again? if ($storeNow) { $this->store(); } return true; }
/** * Overloaded bind function * * @param array $hash named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { // if ($array['durata'] == 0) { // $array['durata'] = $this->checkContentDuration($array['id']); // } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { $input = JFactory::getApplication()->input; $task = $input->getString('task', ''); if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_somosmaestros') && $array['state'] == 1)) { $array['state'] = 0; } if ($array['id'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_somosmaestros.video.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_somosmaestros', 'video'); $default_actions = JFactory::getACL()->getAssetRules('com_somosmaestros.video.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
public function bind($array, $ignore = '') { // Search for the {readmore} tag and split the text up accordingly. if (isset($array['value']) && is_array($array['value'])) { $registry = new Registry(); $registry->loadArray($array['value']); $array['value'] = (string) $registry; } // if (isset($array['media']) && is_array($array['media'])) // { // $registry = new Registry; // $registry->loadArray($array['media']); // $array['media'] = (string) $registry; // } // // if (isset($array['metadata']) && is_array($array['metadata'])) // { // $registry = new Registry; // $registry->loadArray($array['metadata']); // $array['metadata'] = (string) $registry; // } // // // Bind the rules. // if (isset($array['rules']) && is_array($array['rules'])) // { // $rules = new JAccessRules($array['rules']); // $this->setRules($rules); // } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (!JFactory::getUser()->authorise('core.edit.state', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id']) && $array['state'] == 1) { $array['state'] = 0; } if (!isset($array['created_by']) || $array['created_by'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_einsatzkomponente', 'einsatzbilderbearbeiten'); $default_actions = JFactory::getACL()->getAssetRules('com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array $array Named array * @param mixed $ignore Optional array or list of parameters to ignore * * @return null|string null is operation was satisfactory, otherwise returns an error * * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { $input = JFactory::getApplication()->input; $task = $input->getString('task', ''); if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_autofilter') && $array['state'] == 1)) { $array['state'] = 0; } if ($array['id'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_autofilter.categorie.' . $array['id'])) { $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_autofilter/access.xml', "/access/section[@name='categorie']/"); $default_actions = JAccess::getAssetRules('com_autofilter.categorie.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } // Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function * * @acces public * @param array $hash named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $array['params'] = json_encode($array['params']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable::bind */ public function bind($array, $ignore = '') { // For Fields group // Convert jform[fields_group][field] to jform[field] or JTable cannot bind data. // ========================================================================================== $data = array(); $array = AKHelper::_('array.pivotFromTwoDimension', $array); // Set field['param_xxx'] to params // ========================================================================================== if (empty($array['params'])) { $array['params'] = AKHelper::_('array.pivotFromPrefix', 'param_', $array, JArrayHelper::getValue($array, 'params', array())); } // Set params to JRegistry // ========================================================================================== if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } // Bind the rules. // ========================================================================================== if (isset($array['rules']) && is_array($array['rules'])) { $rules = new JAccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_mapa.mapadevenezuela.' . $array['id'])) { $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_mapa/access.xml', "/access/section[@name='mapadevenezuela']/"); $default_actions = JAccess::getAssetRules('com_mapa.mapadevenezuela.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function * * @param array $array Named array to bind * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return mixed Null if operation was satisfactory, otherwise returns an error * * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_quick2cart.region.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_quick2cart', 'region'); $default_actions = JFactory::getACL()->getAssetRules('com_quick2cart.region.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } // Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Binds an array to the object * @param array Named array * @param string Space separated list of fields not to bind * @return boolean */ function bind($array, $ignore = '') { $result = parent::bind($array); // cast properties $this->id = (int) $this->id; return $result; }
public function loadByKey($key) { $db = DiscussHelper::getDBO(); $query = 'SELECT * FROM ' . $db->nameQuote($this->_tbl) . ' WHERE ' . $db->nameQuote('key') . '=' . $db->Quote($key); $db->setQuery($query); $data = $db->loadObject(); return parent::bind($data); }
public function bind($array, $ignore = array()) { if (isset($array['rules']) && is_array($array['rules'])) { $rules = new JAccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); }