本文整理汇总了PHP中JModelAdmin::save方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelAdmin::save方法的具体用法?PHP JModelAdmin::save怎么用?PHP JModelAdmin::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModelAdmin
的用法示例。
在下文中一共展示了JModelAdmin::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save($data)
{
$oldData = array();
if ($data['id'] > 0) {
$table = $this->getTable();
$table->load($data['id']);
$oldData['id'] = $table->id;
$oldData['provider'] = $table->provider;
$oldData['type'] = $table->type;
$oldData['attribs'] = (array) $table->attribs;
}
// Set the dates
$date = JFactory::getDate();
if ($data['id'] == 0) {
$data['created'] = $date->toSql();
}
$data['modified'] = $date->toSql();
if ($data['provider'] != '--' && $data['type'] != '--') {
$channel = JFBCFactory::provider($data['provider'])->channel($data['type']);
$data = $channel->onBeforeSave($data);
// Manipulate the data however may be necessary
}
$return = parent::save($data);
// Used to removed permissions from users that aren't associated with this channel (or anything else needed for cleanup)
if ($return && $data['provider'] != '--' && $data['type'] != '--') {
$data['id'] = $this->getState('channel.id');
$channel->onAfterSave($data, $oldData);
}
return $return;
}
示例2: save
/**
* The save function
*
* @param array $list - data to save
*
* @return bool
*/
public function save($list)
{
$user = JFactory::getUser();
$item = array();
$item['id'] = null;
$item['mc_id'] = $list['id'];
$item['web_id'] = $list['web_id'];
$item['list_name'] = $list['name'];
$item['date_created'] = $list['date_created'];
$item['email_type_option'] = $list['email_type_option'];
$item['use_awesomebar'] = $list['use_awesomebar'];
$item['default_from_name'] = $list['default_from_name'];
$item['default_from_email'] = $list['default_from_email'];
$item['default_subject'] = $list['default_subject'];
$item['default_language'] = $list['default_language'];
$item['list_rating'] = $list['list_rating'];
$item['subscribe_url_short'] = $list['subscribe_url_short'];
$item['subscribe_url_long'] = $list['subscribe_url_long'];
$item['beamer_address'] = $list['beamer_address'];
$item['visibility'] = $list['visibility'];
$item['created_user_id'] = $user->id;
$item['created_time'] = JFactory::getDate()->toSql();
$item['modified_user_id'] = $user->id;
$item['modified_time'] = JFactory::getDate()->toSql();
$item['access'] = 1;
$item['query_data'] = json_encode($list);
return parent::save($item);
}
示例3: save
public function save($data)
{
if (!empty($data['payment_type'])) {
$data['payment_type'] = json_encode($data['payment_type']);
}
return parent::save($data);
}
示例4: save
function save($data)
{
$courses_csv = implode(',', $data['courses']);
$data['courses'] = $courses_csv;
$return = parent::save($data);
return $return;
}
示例5: save
public function save($data)
{
$success = parent::save($data);
if ($success) {
// request option list
$values = JRequest::getVar('joomdoc_option_value', array(), 'default', 'array');
$labels = JRequest::getVar('joomdoc_option_label', array(), 'default', 'array');
// prepare database table
$option = JTable::getInstance('Option', JOOMDOC_TABLE_PREFIX);
/* @var $option JoomDOCTableOption */
$option->field = $this->getState($this->getName() . '.id');
$option->ordering = 0;
$query = $this->getDbo()->getQuery(true);
$query->select('id')->from('#__joomdoc_option')->where('field = ' . (int) $option->field);
$ids = $this->getDbo()->setQuery($query)->loadColumn();
$sid = array();
foreach ($values as $id => $value) {
$option->id = in_array($id, $ids) ? $id : null;
$option->value = $value;
$option->label = $labels[$id];
$option->ordering++;
$option->store();
$sid[] = (int) $option->id;
}
$query->clear()->delete('#__joomdoc_option')->where('field = ' . (int) $option->field);
if ($sid) {
$query->where('id NOT IN (' . implode(', ', $sid) . ')');
}
$this->getDbo()->setQuery($query)->query();
}
return $success;
}
示例6: save
public function save($form)
{
$canDo = JoaktreeHelper::getActions();
$msg = JText::_('JTAPPS_MESSAGE_NOSAVE');
if ($canDo->get('core.create') || $canDo->get('core.edit')) {
$ret = parent::save($form);
if ($ret) {
$msg = JText::_('JT_MESSAGE_SAVED');
}
// Bind the rules.
if (isset($form['rules'])) {
$actions = array();
$tmp = array();
$tmp[0] = '';
foreach ($data['rules'] as $action => $identities) {
$identities = array_diff($identities, $tmp);
$actions[$action] = $identities;
}
$table = $this->getTable();
$rules = new JRules($actions);
$table->setRules($rules);
}
}
return $msg;
}
示例7: save
public function save($data)
{
if (parent::save($data)) {
$formId = $this->getState($this->getName() . '.id');
$db = JFactory::getDBO();
$query = 'DELETE FROM `#__baforms_columns` WHERE `form_id`=' . $formId;
$db->setQuery($query);
$db->query();
$query = 'DELETE FROM `#__baforms_items` WHERE `form_id`=' . $formId;
$db->setQuery($query);
$db->query();
$newdata = explode('|', $data['form_columns']);
foreach ($newdata as $dat) {
if ($dat != '') {
$table = JTable::getInstance('Columns', 'FormsTable');
$table->bind(array('form_id' => $formId, 'settings' => $dat));
$table->store();
}
}
$newdata = explode('|_-_|', $data['form_content']);
foreach ($newdata as $dat) {
if ($dat != '') {
$table = JTable::getInstance('Items', 'FormsTable');
$table->bind(array('form_id' => $formId, 'column_id' => '2', 'settings' => $dat));
$table->store();
}
}
return true;
} else {
return false;
}
}
示例8: save
public function save($data)
{
//$data['begin'] = sprintf("%u", ip2long(long2ip(ip2long($data['begin']))));
//$data['end'] = sprintf("%u", ip2long(long2ip(ip2long($data['end']))));
$data['begin'] = sprintf("%010u", ip2long($data['begin']));
$data['end'] = sprintf("%010u", ip2long($data['end']));
parent::save($data);
}
示例9: save
public function save($data)
{
if (parent::save($data)) {
$this->updateCounter();
return true;
} else {
return false;
}
}
示例10: save
public function save($data)
{
$app = JFactory::getApplication();
if ($app->input->get('task') == 'save' || $app->input->get('task') == "apply") {
$object->type = $data['type'];
$object->unit = $data['unit'];
$data['params'] = json_encode($object);
}
return parent::save($data);
}
示例11: save
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success, False on error.
*
* @since 12.2
*/
public function save($data)
{
if (isset($data['alias']) && empty($data['alias'])) {
/** @noinspection PhpUndefinedClassInspection */
$data['alias'] = ru_RULocalise::transliterate($data['manufacturer_name']);
$data['alias'] = preg_replace('#\\W#', '-', $data['alias']);
$data['alias'] = preg_replace('#[-]+#', '-', $data['alias']);
}
return parent::save($data);
}
示例12: save
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 3.0
*/
public function save($data)
{
/* echo '<pre>';
print_r($data);
echo '</pre>';
exit();*/
parent::save($data);
return true;
}
示例13: save
public function save($data)
{
$app = JFactory::getApplication();
if ($app->input->get('task') == 'save2copy') {
list($title, $alias) = $this->pageGenerateNewTitle($data['alias'], $data['title']);
$data['title'] = $title;
$data['alias'] = $alias;
}
parent::save($data);
return true;
}
示例14: save
public function save($data)
{
$app = JFactory::getApplication();
$param = $app->input->get('params', array(), 'array');
$item = $this->getItem($data['id']);
$params = (object) $item->params;
$params->flight_number = $param['flight_number'];
$params->return_flight_number = $param['return_flight_number'];
$data['params'] = json_encode($params);
return parent::save($data);
}
示例15: save
public function save($data)
{
$app = JFactory::getApplication();
if ($app->input->get('task') == 'save' || $app->input->get('task') == "apply") {
$jfom = $app->input->get('jform', array(), 'array');
$params = array();
$params['price_per_distance'] = $jfom['price_per_distance'];
$data['params'] = json_encode($params);
}
return parent::save($data);
}