本文整理汇总了PHP中Base_module_model::on_after_save方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_module_model::on_after_save方法的具体用法?PHP Base_module_model::on_after_save怎么用?PHP Base_module_model::on_after_save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_module_model
的用法示例。
在下文中一共展示了Base_module_model::on_after_save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_after_post
public function on_after_post($values)
{
$values = parent::on_after_save($values);
$data = $this->normalized_save_data;
if (isset($data['other_perms']) and is_array($data['other_perms']) and !empty($values['name'])) {
$module = $values['name'];
$CI =& get_instance();
$other_perms = $CI->fuel->permissions->create_simple_module_permissions($module, $data['other_perms']);
$users = $CI->input->post('users');
if (!empty($users)) {
// get the IDS of the other perms
$perm_ids = array();
foreach ($other_perms as $op) {
$perm = $this->find_one_array(array('name' => $op['name']));
$perm_ids[] = $perm['id'];
}
// now associate the other users to those perms
$CI->load->module_model(FUEL_FOLDER, 'fuel_users_model');
foreach ($users as $user_id) {
$user = $CI->fuel_users_model->find_by_key($user_id);
if (isset($user->id)) {
$model = $user->get_permissions(TRUE);
$user_perms = $model->find_all_array_assoc('id');
$user_perm_ids = array_keys($user_perms);
$user->permissions = array_merge($user_perm_ids, $perm_ids);
$user->save();
}
}
}
}
return $values;
}
示例2: on_after_save
/**
* Model hook executed right after saving
*
* @access public
* @param array The values that were just saved
* @return array Returns the values that were saved
*/
public function on_after_save($values)
{
parent::on_after_save($values);
$CI =& get_instance();
$user = $CI->fuel->auth->user_data();
// reset session information...
if (isset($values['id'], $user['id']) and $values['id'] == $user['id']) {
// if (!empty($values['password']))
// {
// $CI->fuel->auth->set_user_data('password', $values['password']);
// }
if (!empty($values['language'])) {
$CI->fuel->auth->set_user_data('language', $values['language']);
}
}
if (!empty($this->normalized_save_data['new_password'])) {
$this->fuel->logs->write(lang('auth_log_cms_pass_reset', $values['user_name'], $this->input->ip_address()), 'debug');
}
$this->_send_email($values['id']);
return $values;
}
示例3: on_after_save
public function on_after_save($values)
{
parent::on_after_save($values);
return $values;
}
示例4: array
function on_after_save($values)
{
// if no category is selected, then we set it to the Uncategorized
$saved_data = $this->normalized_save_data;
if (empty($saved_data['categories'])) {
$this->normalized_save_data['categories'] = array(1);
}
$values = parent::on_after_save($values);
$CI =& get_instance();
// remove cache
$CI->fuel->blog->remove_cache();
return $values;
}