本文整理汇总了PHP中Base_model::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_model::save方法的具体用法?PHP Base_model::save怎么用?PHP Base_model::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_model
的用法示例。
在下文中一共展示了Base_model::save方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* 统计修改
* @param array $data 修改字段信息
* @param integer $id 传入uid
* @return bool
*/
public function save($data = array(), $id = 0)
{
$result = parent::save($data, $id);
if (is_null($result)) {
return false;
} else {
return true;
}
}
示例2: save
public function save($inputs)
{
// Arrays of data which will be saved
$data = array();
// Fields of the key table
$fields = $this->list_fields();
// Set the data to the posted value.
foreach ($fields as $field) {
$data[$field] = $inputs[$field];
}
return parent::save($data);
}
示例3: save
/**
* Overload Parent
*/
function save($data)
{
parent::save($data);
if (is_array($data)) {
$data = (object) $data;
}
//save gl
$kas = new Jurnal_entry();
$kas->nomor_account = $this->cash_account;
$kas->kredit_value = (double) $data->jumlah;
$kas->debit_value = 0;
$kas->tgl_transaksi = $data->tgl_transaksi;
$kas->nomor_dokumen = "";
$pengeluaran = new Jurnal_entry();
$pengeluaran->nomor_account = $this->kode_account;
$pengeluaran->debit_value = (double) $data->jumlah;
$pengeluaran->kredit_value = 0;
$pengeluaran->tgl_transaksi = $data->tgl_transaksi;
$pengeluaran->nomor_dokumen = "";
//kas berkurang
//pengeluaran bertambah
$result = $this->Gledger->write_jurnal($pengeluaran, $kas);
}
示例4: save
public function save($inputs)
{
// Arrays of data which will be saved
$data = $data_lang = array();
// Fields of the author table
$fields = $this->list_fields();
// Set the data to the posted value.
foreach ($fields as $field) {
$data[$field] = $inputs[$field];
}
$lang_fields = $this->list_fields($this->_author_lang_table);
foreach (Settings::get_languages() as $language) {
foreach ($lang_fields as $field) {
if ($field != $this->pk_name && $field != 'lang') {
$input_field = $field . '_' . $language['lang'];
if ($inputs[$input_field] !== FALSE) {
$data_lang[$language['lang']][$field] = $inputs[$input_field];
}
}
}
}
return parent::save($data, $data_lang);
}
示例5: save
/**
* Saves the article
*
* @param array Standard data table
* @param array Lang depending data table
*
* @return int Articles saved ID
*
*/
function save($data, $lang_data)
{
// New article : Created field
if (!$data['id_article']) {
$data['created'] = $data['updated'] = date('Y-m-d H:i:s');
} else {
$data['updated'] = date('Y-m-d H:i:s');
}
// Be sure URLs are unique
$this->set_unique_urls($lang_data, $data['id_article']);
// Dates
$data['publish_on'] = $data['publish_on'] ? getMysqlDatetime($data['publish_on']) : '0000-00-00';
$data['publish_off'] = $data['publish_off'] ? getMysqlDatetime($data['publish_off']) : '0000-00-00';
$data['comment_expire'] = $data['comment_expire'] ? getMysqlDatetime($data['comment_expire']) : '0000-00-00';
$data['logical_date'] = $data['logical_date'] ? getMysqlDatetime($data['logical_date']) : '0000-00-00';
// Article saving
return parent::save($data, $lang_data);
}
示例6: save
/**
* Saves one media data
*
* @param array standard data array
* @param array lang data array
*
* @return string Inserted / Updated media ID
*/
public function save($data, $lang_data)
{
// Dates
$data['date'] = $data['date'] ? getMysqlDatetime($data['date'], Settings::get('date_format')) : '0000-00-00';
// Media saving
return parent::save($data, $lang_data);
}
示例7: _save_resource
/**
* Creates one resource if it doesn't exist, else updates it.
*
*
* @param $type
* @param $element String. Can contain the element ID (eg. 'element/3')
* @param array $actions
* @param array $data
*
* @return int|null
*/
private function _save_resource($type, $element, $actions = array(), $data = array())
{
$id_resource = NULL;
// Correct NULL actions
if (is_null($actions)) {
$actions = array();
}
$resource = $type . '/' . $element;
if (is_null($actions)) {
$actions = array();
}
// Find out $id_parent
$db_resource = $this->get_row_array(array('resource' => $resource));
$data = array_merge(array('resource' => $resource, 'actions' => implode(',', $actions)), $data);
// Get ID resource
if (!empty($db_resource)) {
$data['id_resource'] = $db_resource['id_resource'];
}
$id_resource = parent::save($data);
return $id_resource;
}
示例8: save
/**
* Saves media meta data
*
* @param $post
*
* @return int|void
*/
public function save($post)
{
foreach ($post as $key => $media) {
if (substr($key, 0, 5) == 'media') {
$data_lang = $media['lang'];
parent::save($media, $data_lang);
}
}
}
示例9: save
/**
* Saves the article
*
* @param array $data data table
* @param array $lang_data Lang depending data table
* @return int Articles saved ID
*/
public function save($data, $lang_data)
{
// New article : Created field
if (!$data['id_article'] or $data['id_article'] == '') {
$data['created'] = $data['updated'] = date('Y-m-d H:i:s');
} else {
$data['updated'] = date('Y-m-d H:i:s');
}
// Dates
$data = $this->_set_dates($data);
// Article saving
return parent::save($data, $lang_data);
}
示例10: save
/**
* Saves one media data
*
* @param array standard data array
* @param array lang data array
*
* @return string Inserted / Updated media ID
*/
function save($data, $lang_data)
{
// Dates
$data['date'] = $data['date'] ? getMysqlDatetime($data['date']) : '0000-00-00';
// Media saving
return parent::save($data, $lang_data);
}
示例11: save
/**
* Saves one Page
*
* @param array $data Page data table
* @param array $lang_data Page Lang depending data table
* @return int The inserted / updated page ID
*/
public function save($data, $lang_data)
{
// Dates
$data = $this->_set_dates($data);
// Correct level regarding to the parent
if (isset($data['id_parent'])) {
$parent_array = $this->get_parent_array($data['id_parent']);
$data['level'] = count($parent_array);
}
// Correct child pages
if (!empty($data['id_page'])) {
$page = $this->get_by_id($data['id_page']);
if ($page['id_menu'] != $data['id_menu']) {
$this->update_pages_menu($data['id_page'], $data['id_menu']);
}
}
// Clean meta data
$lang_data = $this->_clean_meta_data($lang_data);
// Base model save method call
return parent::save($data, $lang_data);
}
示例12: save
/**
* @param $data
* @param array $lang_data
*
* @return int
*/
public function save($data, $lang_data)
{
// Name
$data['name'] = url_title($data['name']);
return parent::save($data, $lang_data);
}
示例13: save
/**
* Saves one Page
*
* @param array Page data table
* @param array Page Lang depending data table
*
* @return string The inserted / updated page ID
*
*/
function save($data, $lang_data)
{
// Dates
$data['publish_on'] = $data['publish_on'] ? getMysqlDatetime($data['publish_on'], Settings::get('date_format')) : '0000-00-00';
$data['publish_off'] = $data['publish_off'] ? getMysqlDatetime($data['publish_off'], Settings::get('date_format')) : '0000-00-00';
$data['logical_date'] = $data['logical_date'] ? getMysqlDatetime($data['logical_date'], Settings::get('date_format')) : '0000-00-00';
// Creation date
if (!$data['id_page'] or $data['id_page'] == '') {
$data['created'] = date('Y-m-d H:i:s');
} else {
$data['updated'] = date('Y-m-d H:i:s');
}
// Be sure URLs are unique
$this->set_unique_urls($lang_data, $data['id_page']);
// Clean metas data
foreach ($lang_data as $lang => $row) {
foreach ($row as $key => $value) {
if ($key == 'meta_description') {
$lang_data[$lang][$key] = preg_replace('[\\"]', '', $value);
}
if ($key == 'meta_keywords') {
$lang_data[$lang][$key] = preg_replace('/[\\"\\.;]/i ', '', $value);
}
}
}
// Base model save method call
return parent::save($data, $lang_data);
}
示例14: save
/**
* Overload Parent
*/
function save($data)
{
parent::save($data);
if (is_array($data)) {
$data = (object) $data;
}
//save gl
$kas = new Jurnal_entry();
$kas->nomor_account = $this->cash_account;
$kas->debit_value = (double) $data->jumlah_in;
$kas->kredit_value = 0;
$kas->tgl_transaksi = $data->tgl_transaksi;
$kas->nomor_dokumen = "";
$tabungan = new Jurnal_entry();
$tabungan->nomor_account = $this->kode_account;
$tabungan->debit_value = 0;
$tabungan->kredit_value = (double) $data->jumlah_in;
$tabungan->tgl_transaksi = $data->tgl_transaksi;
$tabungan->nomor_dokumen = "";
$result = $this->GLedger->write_jurnal($kas, $tabungan);
}