本文整理汇总了PHP中Message::success方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::success方法的具体用法?PHP Message::success怎么用?PHP Message::success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::success方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_edit
public function action_edit($user_id)
{
$this->template->title = __("Sửa thông tin tài khoản");
$this->template->section_title = __("Sửa thông tin tài khoản");
$data = array();
$user_id = intval($user_id);
if ($user_id <= 0) {
Request::instance()->redirect('admin/user/index');
}
$user = BLL_User::getById($user_id);
if (!$user) {
Request::instance()->redirect('admin/user/index');
}
if (Request::$method == 'POST') {
$active = isset($_POST['active']);
$post = $user->validate_update($_POST);
if ($post->check()) {
$post = $post->as_array();
$user->password = Auth::instance()->hash_password($post['password']);
$user->save();
Message::success('Thay đổi thông tin thành công');
Request::instance()->redirect('admin/user/index');
} else {
$_POST = $post->as_array();
$data['errors'] = $post->errors('admin/user/form');
}
}
$data['user'] = $user->toArray();
$this->template->content = View::factory('admin/user/edit', $data);
}
示例2: action_user
public function action_user()
{
$id = (int) $this->request->param('id', 0);
$post = ORM::factory('user', $id);
if (!$post->loaded() or $id === 1) {
Message::error(__("User doesn't exists!"));
Log::error('Attempt to access non-existent user.');
$this->request->redirect(Route::get('admin/user')->uri(array('action' => 'list')), 404);
}
$this->title = __(':user Permissions', array(":user" => $post->name));
$action = Route::get('admin/permission')->uri(array('action' => 'user', 'id' => isset($post->id) ? $post->id : 0));
$view = View::factory('admin/permission/user')->set('post', $post)->set('oldperms', $post->perms())->set('permissions', ACL::all())->set('action', $action)->bind('errors', $this->_errors);
if ($this->valid_post('permissions')) {
$perms = array_filter($_POST['perms']);
$post->data = array('permissions' => $perms);
try {
$post->save();
Message::success(__('Permissions: saved successful!'));
$this->request->redirect(Route::get('admin/permission')->uri(array('action' => 'user', 'id' => $post->id)));
} catch (ORM_Validation_Exception $e) {
Message::error(__('Permissions save failed!'));
$this->_errors = $e->errors('models', TRUE);
} catch (Exception $e) {
Message::error(__('Permissions save failed!'));
$this->_errors = array($e->getMessage());
}
}
$this->response->body($view);
}
示例3: action_create
public function action_create()
{
$this->template->title = __("Thêm mới kênh truyền hình");
$this->template->section_title = __("Thêm mới kênh truyền hình");
$data = array();
if (Request::$method == "POST") {
$channel = new LichTruyenHinh();
$post = $channel->validate_create($_POST);
if ($post->check()) {
$post = $post->as_array();
$channel->user_id = Auth::instance()->get_user()->id;
$channel->channel_name = $post['channel_name'];
$channel->active = true;
$channel->slug = $post['slug'];
$channel->meta_keys = $post['meta_keys'];
$channel->meta_desc = $post['meta_desc'];
$channel->xml_uri = $post['xml_uri'];
$channel->created_at = date("Y-m-d h:i:s");
$channel->save();
Message::success('Thêm mới kênh truyền hình thành công!');
Request::instance()->redirect('/admin/lichtruyenhinh/index');
} else {
$_POST = $post->as_array();
$data['errors'] = $post->errors();
}
}
// $categories = TruyenCuoiCategory::bll()->getCatById_WithStoryCount();
// $data['categories'] = $categories;
$this->template->content = View::factory('/admin/lichtruyenhinh/create', $data);
}
示例4: action_spam
public function action_spam()
{
$id = (int) $this->request->param('id', 0);
$question = ORM::factory('Feedback_Question', $id);
$user_id = $this->user->id;
if (!$question->loaded()) {
$this->redirect('manage/feedback');
}
$token = Arr::get($_POST, 'token', false);
$return = Security::xss_clean(Arr::get($_GET, 'r', 'manage/expert'));
$this->set('return', Url::media($return));
if ($this->request->method() == Request::POST && Security::token() === $token) {
$question->is_spam = ($question->is_spam + 1) % 2;
$question->spam_mod_id = $user_id;
$question->save();
if ($question->is_spam == 1) {
Message::success(i18n::get('The question is marked as spam'));
} else {
Message::success(i18n::get('Marked "Spam" is removed from the question'));
}
$this->redirect($return);
} else {
if ($question->loaded()) {
$this->set('question', $question)->set('token', Security::token(true));
} else {
$this->redirect('manage/expert');
}
}
}
示例5: action_edit
/**
* Edit
*/
public function action_edit()
{
$this->title = __('home.page_edit');
// Fields for save
$for_extract = ['text', 'meta_t', 'meta_d', 'meta_k'];
$config = Config::get('home');
$data = Arr::extract($_POST, $for_extract);
if ($this->request->is_post()) {
$data = Validation::factory(array_map('trim', $data))->rule('meta_t', 'not_empty')->rule('meta_d', 'not_empty')->rule('meta_k', 'not_empty');
if ($data->check()) {
foreach ($for_extract as $field) {
$config[$field] = $data[$field];
}
$config->save();
Message::success(__('settings.changes_saved'));
HTTP::redirect(Route::url('b_home'));
} else {
Message::error(__('settings.error_saving'));
$errors = $data->errors('validation');
}
} else {
$data = $config;
}
$this->content = View::factory($this->view, ['data' => $data])->bind('errors', $errors);
}
示例6: action_login
public function action_login()
{
if ($this->_auth->logged_in()) {
// redirect to the user account
$this->request->redirect(Route::get('admin')->uri(), 200);
}
// Disable sidebars on login page
$this->_sidebars = FALSE;
$this->title = __('Sign In');
$user = ORM::factory('user');
// Create form action
$destination = isset($_GET['destination']) ? $_GET['destination'] : 'admin';
$params = array('action' => 'login');
$action = Route::get('admin/login')->uri($params) . URL::query(array('destination' => $destination));
if ($layout = kohana::find_file('views', 'layouts/login')) {
$this->template->set_filename('layouts/login');
}
$view = View::factory('admin/login')->set('use_username', Config::get('auth.username'))->set('post', $user)->set('action', $action)->bind('errors', $this->_errors);
if ($this->valid_post('login')) {
try {
// Check Auth
$user->login($this->request->post());
// If the post data validates using the rules setup in the user model
Message::success(__('Welcome, %title!', array('%title' => $user->nick)));
Log::info('User :name logged in.', array(':name' => $user->name));
// redirect to the user account
$this->request->redirect(isset($_GET['destination']) ? $_GET['destination'] : 'admin', 200);
} catch (Validation_Exception $e) {
$this->_errors = $e->array->errors('login', TRUE);
}
}
$this->response->body($view);
}
示例7: action_delete
public function action_delete()
{
$search = $this->request->param('string', "");
$id = $this->request->param('material_id', 0);
$id_project = $this->request->param('project_id', 0);
$type = $this->request->param('type', 0);
$article = ORM::factory('Material_Project')->where('material_id', '=', $id)->where('project_id', '=', $id_project)->where('type', '=', $type)->find();
$id = $article->id;
$article = ORM::factory('Material_Project', $id);
$article->delete();
Message::success('Удалено');
$this->redirect('manage/search/' . $id_project . '/all/' . $search);
/*if (!$article->loaded())
{
throw new HTTP_Exception_404;
}
$token = Arr::get($_POST, 'token', false);
if (($this->request->method() == Request::POST) && Security::token() === $token)
{
$loger = new Loger('delete',$article->material_id);
$loger->logThis($article);
$article->delete();
Message::success('Удалено');
$this->redirect('manage/project/'.$id_project );
}
else
{
$this->set('record', $article)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/project/'.$id_project));
}
*/
}
示例8: action_edit
public function action_edit()
{
$id = $this->request->param('id', 0);
$opinion = ORM::factory('Expert_Opinion', $id);
$experts = ORM::factory('Expert')->order_by('name_' . I18n::$lang)->find_all();
$user_id = $this->user->id;
$this->set('opinion', $opinion);
$this->set('experts', $experts);
if ($this->request->method() == Request::POST) {
try {
$opinion->expert_id = Arr::get($_POST, 'expert_id', '');
$opinion->title = Arr::get($_POST, 'title', '');
$opinion->description = Arr::get($_POST, 'description', '');
$opinion->text = Arr::get($_POST, 'text', '');
$opinion->protected = Arr::get($_POST, 'protected', '');
$opinion->date = date('Y-m-d H:i:s');
$opinion->user_id = $user_id;
$opinion->save();
$event = $id ? 'edit' : 'create';
$loger = new Loger($event, $opinion->title);
$loger->logThis($opinion);
Message::success(i18n::get('The position of an expert retained'));
$this->redirect('manage/expertopinions/view/' . $opinion->id . '/page-' . $this->page);
} catch (ORM_Validation_Exception $e) {
$errors = $e->errors($e->alias());
foreach ($errors as $key => $item) {
$errors[preg_replace("/(_ru|_kz|_en)/", '', $key)] = preg_replace("/(_ru|_kz|_en)/", '', $item);
}
$this->set('opinion', $_POST);
$this->set('errors', $errors);
}
}
}
示例9: display
public static function display()
{
$messages = "";
if ($_POST['cc_form'] === 'add-group') {
$group = $_POST['group'];
$rows = Database::select('users', 'name', array('name = ? AND type = ?', $group, 'group'), null, 1)->fetch(PDO::FETCH_ASSOC);
if (!empty($rows)) {
$messages .= Message::error(__('admin', 'group-in-use'));
} else {
$row = DB::select('users', array('data'), array('users_id = ?', $_GET['parent']))->fetch(PDO::FETCH_ASSOC);
$inheritance = unserialize($row['data']);
$inheritance = $inheritance['permissions'];
$result = Database::insert('users', array('name' => filter('admin_add_group_name', $group), 'type' => 'group', 'group' => '-1', 'data' => serialize(filter('admin_add_group_data', array('permissions' => $inheritance)))));
if ($result === 1) {
$messages .= Message::success(__('admin', 'group-added'));
}
}
}
$form = new Form('self', 'post', 'add-group');
$form->startFieldset(__("admin", 'group-information'));
$form->addInput(__('admin', 'group-name'), 'text', 'group', self::get('group'));
$groups = Users::allGroups();
foreach ($groups as $key => $value) {
$groups[$value->getId()] = $value->getName();
}
$form->addSelectList(__('admin', 'inherit-permissions'), 'parent', $groups);
plugin('admin_add_group_custom_fields', array(&$form));
$form->addSubmit('', 'add-group', __('admin', 'add-group'));
$form->endFieldset();
plugin('admin_add_group_custom_fieldset', array(&$form));
$form = $form->endAndGetHTML();
return array(__('admin', 'add-group'), $messages . $form);
}
示例10: action_edit
/**
* Basic
*/
public function action_edit()
{
$this->title = __('settings.settings_general');
// Fields for save
$for_extract = ['per_page_frontend', 'per_page_backend', 'sitename', 'siteslogan', 'copyright', 'year_creation_site', 'type_backend_menu'];
$config = Config::get('settings');
$data = Arr::extract($_POST, $for_extract);
if ($this->request->is_post()) {
$data = Validation::factory(array_map('trim', $data))->rules('per_page_frontend', [['not_empty'], ['digit']])->rules('per_page_backend', [['not_empty'], ['digit']])->rules('year_creation_site', [['not_empty'], ['digit']])->rule('sitename', 'not_empty');
if ($data->check()) {
foreach ($for_extract as $field) {
$config[$field] = $data[$field];
}
$config->save();
Message::success(__('settings.changes_saved'));
HTTP::redirect(Route::url('b_settings'));
} else {
Message::error(__('settings.error_saving'));
$errors = $data->errors('validation');
}
} else {
$data = $config;
}
$this->content = View::factory($this->view, ['data' => $data])->bind('errors', $errors);
}
示例11: messages
public function messages(Message $message)
{
$this->tpl->error = $message->error();
$this->tpl->success = $message->success();
$this->tpl->alert = $message->alert();
$this->tpl->info = $message->info();
$this->tpl->debug = $message->debug();
}
示例12: action_delete
public function action_delete()
{
$id = (int) $this->request->param('id', 0);
$token = Arr::get($_POST, 'token', false);
$acts = ORM::factory('Acts', $id);
if (!$acts->loaded()) {
throw new HTTP_Exception_404();
}
if ($this->request->post() && Security::token() === $token) {
$acts->delete();
Message::success('Акт удален');
$this->redirect('manage/acts');
} else {
$this->set('record', $acts)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/acts'));
}
}
示例13: action_delete
public function action_delete()
{
$id = (int) $this->request->param('id', 0);
$link = ORM::factory('Link', $id);
if (!$link->loaded()) {
throw new HTTP_Exception_404();
}
$token = Arr::get($_POST, 'token', false);
if ($this->request->method() == Request::POST && Security::token() === $token) {
$link->delete();
Message::success('Удалено');
$this->redirect('manage/links');
} else {
$this->set('record', $link)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/links'));
}
}
示例14: action_delete
public function action_delete()
{
$type = (int) Arr::get($_GET, 'type', 0);
$id = (int) $this->request->param('id', 0);
$item = ORM::factory('Comment', $id);
if (!$item->loaded()) {
throw new HTTP_Exception_404();
}
$token = Arr::get($_POST, 'token', false);
if ($this->request->method() == Request::POST && Security::token() === $token) {
$item->delete();
Message::success('Комментарий удален');
$this->redirect('manage/comments?type=' . $type);
} else {
$this->set('type', $type);
$this->set('record', $item)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/comments?type=' . $type));
}
}
示例15: action_checked
public function action_checked()
{
$id = $this->request->param('id', 0);
$penitentials = ORM::factory('Penitentials', $id);
if (!$penitentials->loaded()) {
throw new HTTP_Exception_404();
}
if ($penitentials->checked) {
$penitentials->checked = 0;
$penitentials->save();
Message::success('Траурный режим отключен');
} else {
$penitentials->checked = 1;
$penitentials->save();
Message::success('Траурный режим включен');
}
$this->redirect('manage/penitentials/');
}