当前位置: 首页>>代码示例>>PHP>>正文


PHP Messages::success方法代码示例

本文整理汇总了PHP中Messages::success方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::success方法的具体用法?PHP Messages::success怎么用?PHP Messages::success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Messages的用法示例。


在下文中一共展示了Messages::success方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: on_page_load

 public function on_page_load()
 {
     $email_ctx_id = $this->get('email_id_ctx', 'email');
     $email = $this->_ctx->get($email_ctx_id);
     $referrer_page = Request::current()->referrer();
     $next_page = $this->get('next_url', Request::current()->referrer());
     if (!Valid::email($email)) {
         Messages::errors(__('Use a valid e-mail address.'));
         HTTP::redirect($referrer_page);
     }
     $user = ORM::factory('user', array('email' => $email));
     if (!$user->loaded()) {
         Messages::errors(__('No user found!'));
         HTTP::redirect($referrer_page);
     }
     $reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
     if (!$reflink) {
         Messages::errors(__('Reflink generate error'));
         HTTP::redirect($referrer_page);
     }
     Observer::notify('admin_login_forgot_before', $user);
     try {
         Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
         Messages::success(__('Email with reflink send to address set in your profile'));
     } catch (Exception $e) {
         Messages::error(__('Something went wrong'));
     }
     HTTP::redirect($next_page);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:29,代码来源:forgot.php

示例2: show

 function show(Pilot $pilot)
 {
     $active = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereIn('state', array(0, 1, 3, 4))->first();
     $flights = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereState(2)->orderBy('arrival_time', 'desc')->take(15)->get();
     $flightCount = Flight::whereVatsimId($pilot->vatsim_id)->whereState(2)->count();
     $stats = new FlightStat(Flight::whereVatsimId($pilot->vatsim_id));
     if ($pilot->processing == 0) {
         Queue::push('LegacyUpdate', $pilot->vatsim_id, 'legacy');
         $pilot->processing = 2;
         $pilot->save();
     }
     if ($pilot->processing == 2) {
         Messages::success('The data for this pilot is currently being processed. In a couple of minutes, all statistics will be available.')->one();
     }
     $distances = $stats->distances($pilot->distance);
     $citypair = $stats->citypair();
     if ($flights->count() > 0) {
         $durations = $stats->durations($pilot->duration);
         extract($durations);
     }
     // Charts: popular airlines, airports and aircraft
     $airlines = $stats->topAirlines();
     $airports = $stats->topAirports();
     $aircraft = $stats->topAircraft();
     $this->javascript('assets/javascript/jquery.flot.min.js');
     $this->javascript('assets/javascript/jquery.flot.pie.min.js');
     $this->autoRender(compact('pilot', 'flights', 'active', 'distances', 'airlines', 'aircraft', 'airports', 'longest', 'shortest', 'citypair', 'hours', 'minutes'), $pilot->name);
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:28,代码来源:PilotController.php

示例3: update

 /**
  * Function for easy update a ORM object
  *
  * @param ORM $object ORM object to update
  * @param array $messages Array of custom messages
  */
 public function update(ORM $object, array $messages = array())
 {
     // Check if is a valid object
     if (!$object->loaded()) {
         Messages::warning(isset($messages['warning']) ? $messages['warning'] : 'El elemento que intentas modificar no existe o fue eliminado.');
         $this->go();
     }
     // Only if Request is POST
     if ($this->request->method() == Request::POST) {
         // Catch ORM_Validation
         try {
             // Set object values and update
             $object->values($this->request->post())->update();
             // If object is saved....
             if ($object->saved()) {
                 // Success message & redirect
                 Messages::success(isset($messages['success']) ? $messages['success'] : 'El elemento fue modificado correctamente.');
                 $this->go();
             }
         } catch (ORM_Validation_Exception $e) {
             // Error message
             if (isset($messages['error'])) {
                 Messages::error($messages['error']);
             }
             // Validation messages
             Messages::validation($e);
         }
     }
 }
开发者ID:NegoCore,项目名称:core,代码行数:35,代码来源:CRUD.php

示例4: action_post

 /**
  * 
  * @param Datasource_Section $ds
  * @param Datasource_Document $doc
  */
 public function action_post()
 {
     $id = (int) $this->request->post('id');
     $doc = $this->_get_document($id);
     Session::instance()->set('post_data', $this->request->post());
     try {
         $doc->read_values($this->request->post())->read_files($_FILES)->validate();
     } catch (Validation_Exception $e) {
         Messages::errors($e->errors('validation'));
         $this->go_back();
     } catch (DataSource_Exception_Document $e) {
         Messages::errors($e->getMessage());
         $this->go_back();
     }
     if ($doc->loaded()) {
         $this->section()->update_document($doc);
     } else {
         $doc = $this->section()->create_document($doc);
     }
     Messages::success(__('Document saved'));
     Session::instance()->delete('post_data');
     // save and quit or save and continue editing?
     if ($this->request->post('commit') !== NULL) {
         $this->go(Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'data')) . URL::query(array('ds_id' => $this->section()->id()), FALSE));
     } else {
         $this->go(Route::get('datasources')->uri(array('directory' => $this->section()->type(), 'controller' => 'document', 'action' => 'view')) . URL::query(array('ds_id' => $this->section()->id(), 'id' => $doc->id), FALSE));
     }
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:33,代码来源:document.php

示例5: action_index

 /**
  * The index action
  * 
  * @access public
  * @return void
  */
 public function action_index()
 {
     $settings = \Config::load('autoresponder.db');
     // $autoResponder = Model_Setting::find(array('where' => array(array('meta_key', '=', 'auto-responders'))));
     if (\Input::post()) {
         $input = \Input::post();
         if (!\Input::is_ajax()) {
             $val = Model_Setting::validate('create');
             if (!$val->run()) {
                 if ($val->error() != array()) {
                     // show validation errors
                     \Messages::error('<strong>There was an error while trying to create settings</strong>');
                     foreach ($val->error() as $e) {
                         \Messages::error($e->get_message());
                     }
                 }
             } else {
                 try {
                     \Config::save('autoresponder.db', array('logo_url' => $input['logo_url'], 'company_name' => $input['company_name'], 'address' => $input['address'], 'website' => $input['website'], 'phone' => $input['phone'], 'email_address' => $input['email_address'], 'sender_email_address' => $input['sender_email_address'], 'contact_us_email_address' => $input['contact_us_email_address'], 'instagram_account_name' => $input['instagram_account_name'], 'facebook_account_name' => $input['facebook_account_name']));
                     // $setting->save();
                     \Messages::success('Settings successfully created.');
                     \Response::redirect('admin/settings');
                 } catch (\Database_Exception $e) {
                     // show validation errors
                     \Messages::error('<strong>There was an error while trying to create settings.</strong>');
                     // Uncomment lines below to show database errors
                     $errors = $e->getMessage();
                     \Messages::error($errors);
                 }
             }
         }
     }
     \View::set_global('title', 'Settings');
     \Theme::instance()->set_partial('content', $this->view_dir . 'index')->set('settings', $settings, false);
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:41,代码来源:settings.php

示例6: validate

 function validate()
 {
     if (!Session::has('vatsimauth')) {
         throw new AuthException('Session does not exist');
     }
     $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
     $session = Session::get('vatsimauth');
     if (Input::get('oauth_token') !== $session['key']) {
         throw new AuthException('Returned token does not match');
         return;
     }
     if (!Input::has('oauth_verifier')) {
         throw new AuthException('No verification code provided');
     }
     $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
     if ($user) {
         Session::forget('vatsimauth');
         $authUser = User::find($user->user->id);
         if (is_null($authUser)) {
             $authUser = new User();
             $authUser->vatsim_id = $user->user->id;
             $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
         }
         $authUser->last_login = Carbon::now();
         $authUser->save();
         Auth::login($authUser);
         Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
         return Redirect::intended('/');
     } else {
         $error = $SSO->error();
         throw new AuthException($error['message']);
     }
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:33,代码来源:AuthController.php

示例7: action_callback

 public function action_callback()
 {
     // Opauth can throw all kinds of nasty bits, so be prepared
     try {
         // get the Opauth object
         $opauth = \Auth_Opauth::forge(false);
         // and process the callback
         $status = $opauth->login_or_register();
         // fetch the provider name from the opauth response so we can display a message
         $provider = $opauth->get('auth.provider', '?');
         // deal with the result of the callback process
         switch ($status) {
             // a local user was logged-in, the provider has been linked to this user
             case 'linked':
                 // inform the user the link was succesfully made
                 \Messages::success(sprintf(__('login.provider-linked'), ucfirst($provider)));
                 // and set the redirect url for this status
                 $url = 'dashboard';
                 break;
                 // the provider was known and linked, the linked account as logged-in
             // the provider was known and linked, the linked account as logged-in
             case 'logged_in':
                 // inform the user the login using the provider was succesful
                 \Messages::success(sprintf(__('login.logged_in_using_provider'), ucfirst($provider)));
                 // and set the redirect url for this status
                 $url = 'dashboard';
                 break;
                 // we don't know this provider login, ask the user to create a local account first
             // we don't know this provider login, ask the user to create a local account first
             case 'register':
                 // inform the user the login using the provider was succesful, but we need a local account to continue
                 \Messages::info(sprintf(__('login.register-first'), ucfirst($provider)));
                 // and set the redirect url for this status
                 $url = 'user/register';
                 break;
                 // we didn't know this provider login, but enough info was returned to auto-register the user
             // we didn't know this provider login, but enough info was returned to auto-register the user
             case 'registered':
                 // inform the user the login using the provider was succesful, and we created a local account
                 \Messages::success(__('login.auto-registered'));
                 // and set the redirect url for this status
                 $url = 'dashboard';
                 break;
             default:
                 throw new \FuelException('Auth_Opauth::login_or_register() has come up with a result that we dont know how to handle.');
         }
         $url = str_replace('#_=_', '', $url);
         // redirect to the url set
         \Response::redirect($url);
     } catch (\OpauthException $e) {
         \Messages::error($e->getMessage());
         \Response::redirect_back();
     } catch (\OpauthCancelException $e) {
         // you should probably do something a bit more clean here...
         exit('It looks like you canceled your authorisation.' . \Html::anchor('users/oath/' . $provider, 'Click here') . ' to try again.');
     }
 }
开发者ID:ksakuntanak,项目名称:buffohero_cms,代码行数:57,代码来源:auth.php

示例8: action_delete

 public function action_delete($id = null)
 {
     $category = Model_Category::find($id);
     if ($category->delete()) {
         // Delete cache
         \Cache::delete('sidebar');
         \Messages::success(__('backend.category.deleted'));
     } else {
         \Messages::error(__('error'));
     }
     \Response::redirect_back(\Router::get('admin_category'));
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:12,代码来源:category.php

示例9: action_delete

 public function action_delete($id = null)
 {
     $post = Model_Post::find($id);
     if ($post->delete()) {
         // Delete cache
         \Cache::delete('sidebar');
         \Messages::success(__('backend.post.deleted'));
     } else {
         \Messages::error(__('error'));
     }
     \Response::redirect_back(\Router::get('admin_post'));
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:12,代码来源:post.php

示例10: action_logout

 public function action_logout()
 {
     // remove the remember-me cookie, we logged-out on purpose
     \Auth::dont_remember_me();
     // logout
     \Auth::logout();
     // inform the user the logout was successful
     \Messages::success(__('user.login.logged-out'));
     // and go back to where you came from (or the application
     // homepage if no previous page can be determined)
     \Response::redirect_back();
 }
开发者ID:wesleysaraujo,项目名称:fuelphp-blogMVC,代码行数:12,代码来源:user.php

示例11: confirm

 public function confirm()
 {
     $new_password = Text::random();
     $this->_model->user->change_email($new_password);
     try {
         Email_Type::get('user_new_password')->send(array('username' => $this->_model->user->username, 'email' => $this->_model->user->email, 'password' => $new_password));
         Messages::success(__('An email has been send with your new password!'));
         $this->_model->delete();
         return TRUE;
     } catch (Kohana_Exception $e) {
         throw new Reflink_Exception('Email :email not send', array(':email' => $this->_model->user->email));
     }
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:13,代码来源:forgot.php

示例12: update

 function update(Airport $airport)
 {
     Diff::compare($airport, Input::all(), function ($key, $value, $model) {
         $change = new AirportChange();
         $change->airport_id = $model->id;
         $change->user_id = Auth::id();
         $change->key = $key;
         $change->value = $value;
         $change->save();
     });
     Messages::success('Thank you for your submission. We will be evaluating your feedback soon.');
     return Redirect::route('airport.show', $airport->icao);
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:13,代码来源:AirportController.php

示例13: processing

 function processing()
 {
     $user = Auth::user();
     if ($user->processing == 2) {
         $user->processing = 0;
         $user->save();
         Messages::success('The processing has been reset. Visit your pilot or controller profile to start processing again');
         return Redirect::route('user.edit');
     } else {
         Messages::error('You are not allowed to perform this action.');
         return Redirect::route('user.edit');
     }
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:13,代码来源:UserController.php

示例14: confirm

 public function confirm()
 {
     try {
         $role = ORM::factory('role', array('name' => 'login'));
         $this->_model->user->add('roles', $role);
         Email_Type::get('user_registered')->send(array('username' => $this->_model->user->username, 'email' => $this->_model->user->email));
         Messages::success(__('Thank you for registration!'));
         $this->_model->delete();
         return TRUE;
     } catch (Kohana_Exception $e) {
         throw new Reflink_Exception('Something went wrong');
     }
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:13,代码来源:register.php

示例15: action_index

 /**
  * The index action
  * 
  * @access public
  * @return void
  */
 public function action_index()
 {
     $settings = \Config::load('backup.db');
     if (\Input::post()) {
         $input = \Input::post();
         if (!\Input::is_ajax()) {
             $val = Model_Backup::validate('create');
             if (!$val->run()) {
                 if ($val->error() != array()) {
                     // show validation errors
                     \Messages::error('<strong>There was an error while trying to create settings</strong>');
                     foreach ($val->error() as $e) {
                         \Messages::error($e->get_message());
                     }
                 }
             } else {
                 try {
                     \Config::save('backup.db', array('enable' => $input['enable'], 'email' => $input['email'], 'period' => $input['period']));
                     //save cronjob
                     $output = shell_exec('crontab -l');
                     $db_backup_cron_file = "/tmp/db_backup_cron.txt";
                     if ($input['enable']) {
                         if ($input['period'] == 'daily') {
                             $daily_backup_command = '0 0 * * * wget ' . \Uri::create('backup/execute');
                             file_put_contents($db_backup_cron_file, $daily_backup_command . PHP_EOL);
                         } else {
                             if ($input['period'] == 'weekly') {
                                 $weekly_backup_command = '0 0 * * 0 wget ' . \Uri::create('backup/execute');
                                 file_put_contents($db_backup_cron_file, $weekly_backup_command . PHP_EOL);
                             }
                         }
                     } else {
                         file_put_contents($db_backup_cron_file, "" . PHP_EOL);
                     }
                     exec("crontab {$db_backup_cron_file}");
                     \Messages::success('Settings successfully created.');
                     \Response::redirect('admin/backup');
                 } catch (\Database_Exception $e) {
                     // show validation errors
                     \Messages::error('<strong>There was an error while trying to create settings.</strong>');
                     // Uncomment lines below to show database errors
                     $errors = $e->getMessage();
                     \Messages::error($errors);
                 }
             }
         }
     }
     \View::set_global('title', 'Backup');
     \Theme::instance()->set_partial('content', $this->view_dir . 'index')->set('settings', $settings, false);
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:56,代码来源:backup.php


注:本文中的Messages::success方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。