protected function prepareTable2(&$table, &$data) { if (is_array($data['elements'])) { $data['elements'] = implode(',', $data['elements']); } else { $data['elements'] = ''; } if (!$data['jform']['id'] && !$data['jform']['rules']) { $data['jform']['rules'] = array('core.create' => array(), 'core.delete' => array(), 'core.delete.own' => array(), 'core.edit' => array(), 'core.edit.state' => array(), 'core.edit.own' => array()); } if ($data['jform']['rules']) { if (!is_array($data['jform']['rules'])) { $data['jform']['rules'] = json_decode($data['jform']['rules']); } $rules = new JAccessRules(JCckDevHelper::getRules($data['jform']['rules'])); $table->setRules($rules); } }
protected function _core($data, &$config = array(), $pk = 0) { if (!$config['id']) { $isNew = true; $config['id'] = parent::g_onCCK_Storage_LocationPrepareStore(); } else { $isNew = false; } // Init $table = self::_getTable($pk); $isNew = $pk > 0 ? false : true; if (isset($table->tags)) { $tags = $table->tags; unset($table->tags); } else { $tags = null; } if (isset($data['tags'])) { if (!empty($data['tags']) && $data['tags'][0] != '') { $table->newTags = $data['tags']; } unset($data['tags']); } self::_initTable($table, $data, $config); // Check Error if (self::$error === true) { return false; } // Prepare if (is_array($data)) { $table->bind($data); } if ($isNew && !isset($data['rules'])) { $data['rules'] = array('core.create' => array(), 'core.delete' => array(), 'core.edit' => array(), 'core.edit.state' => array(), 'core.edit.own' => array()); } if (isset($data['rules']) && $data['rules']) { if (!is_array($data['rules'])) { $data['rules'] = json_decode($data['rules']); } $rules = new JAccessRules(JCckDevHelper::getRules($data['rules'])); $table->setRules($rules); } $table->check(); self::_completeTable($table, $data, $config); // Store $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $dispatcher->trigger('onContentBeforeSave', array(self::$context, &$table, $isNew)); if ($isNew === true && parent::g_isMax($table->{self::$author}, $table->{self::$parent}, $config)) { return; } if (!$table->store()) { JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); if ($isNew) { parent::g_onCCK_Storage_LocationRollback($config['id']); } return false; } // Checkin parent::g_checkIn($table); self::$pk = $table->{self::$key}; if (!$config['pk']) { $config['pk'] = self::$pk; } $config['author'] = $table->{self::$author}; $config['parent'] = $table->{self::$parent}; parent::g_onCCK_Storage_LocationStore($data, self::$table, self::$pk, $config); $dispatcher->trigger('onContentAfterSave', array(self::$context, &$table, $isNew)); // Associations // todo }
protected function prepareTable2(&$table, &$data) { if (!$data['jform']['id'] && !$data['jform']['rules']) { $data['jform']['rules'] = array('core.create' => array(), 'core.create.max.parent' => array('8' => "0"), 'core.create.max.parent.author' => array('8' => "0"), 'core.create.max.author' => array('8' => "0"), 'core.delete' => array(), 'core.delete.own' => array(), 'core.edit' => array(), 'core.edit.own' => array()); } if ($data['jform']['rules']) { if (!is_array($data['jform']['rules'])) { $data['jform']['rules'] = json_decode($data['jform']['rules']); } jimport('cck.joomla.access.access'); $rules = new CCKRules(JCckDevHelper::getRules($data['jform']['rules']), 'com_cck', 'form'); $table->setRules($rules); } }