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


PHP Messages::warning方法代码示例

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


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

示例1: before

 /**
  * @param   none
  * @throws  none
  * @returns	void
  */
 public function before()
 {
     $result = array();
     // users need to be logged in to access this controller
     if (!\Sentry::check()) {
         $result = array('message' => 'You need to be logged in to access that page.', 'url' => '/admin/login');
         // Don't show this message if url is just 'admin'
         if (\Uri::string() == 'admin/admin/index') {
             unset($result['message']);
         }
         \Session::set('redirect_to', \Uri::admin('current'));
     } else {
         if (!\Sentry::user()->is_admin()) {
             $result = array('message' => 'Access denied. You need to be a member of staff to access that page.', 'url' => '/admin/login');
             \Session::set('redirect_to', \Uri::admin('current'));
         }
     }
     if (!empty($result)) {
         if (\Input::is_ajax()) {
             \Messages::error('You need to be logged in to complete this action.');
             echo \Messages::display('left', false);
             exit;
         } else {
             if (isset($result['message'])) {
                 \Messages::warning($result['message']);
             }
             \Response::redirect($result['url']);
         }
     }
     parent::before();
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:36,代码来源:admin.php

示例2: action_update

 public function action_update()
 {
     // If not logged in redirect to home
     if (!\Auth::check()) {
         \Messages::info(__('user.login.not-logged'));
         \Response::redirect_back();
     }
     // was the login form posted?
     if (\Input::method() == 'POST') {
         // check the credentials.
         if (\Auth::instance()->validate_user(\Auth::get_email(), \Input::param('password'))) {
             if (\Input::param('new_password') === \Input::param('confirm_password')) {
                 \Auth::change_password(\Input::param('password'), \Input::param('new_password'));
                 // inform the user the password change was successful
                 \Messages::success(__('user.login.changed'));
                 \Response::redirect_back();
             }
             \Messages::warning(__('user.login.mismatch-password'));
         } else {
             // login failed, show an error message
             \Messages::error(__('user.login.bad-password'));
         }
         \Response::redirect_back('/backend/account/index/password');
     }
     // display the password reset page
     $this->template->content = View::forge('user/password/update');
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:27,代码来源:password.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: show

 function show(Airline $airline)
 {
     $activeFlights = $airline->flights()->whereIn('state', [0, 1, 3, 4])->join('pilots', 'flights.vatsim_id', '=', 'pilots.vatsim_id')->with(['departure' => function ($departure) {
         $departure->remember(15);
     }, 'arrival' => function ($arrival) {
         $arrival->remember(15);
     }])->select('flights.*', 'pilots.name')->orderBy('departure_time', 'desc')->remember(15)->get();
     $historicFlights = $airline->flights()->whereState(2)->join('pilots', 'flights.vatsim_id', '=', 'pilots.vatsim_id')->with(['departure' => function ($departure) {
         $departure->remember(15);
     }, 'arrival' => function ($arrival) {
         $arrival->remember(15);
     }])->select('flights.*', 'pilots.name')->orderBy('departure_time', 'desc')->take(25)->remember(15)->get();
     if ($airline->duration == 0) {
         $airline->duration = $airline->flights()->whereState(2)->remember(120)->sum('duration');
         $airline->save();
     }
     if ($airline->duration > 0) {
         $pilots = $airline->flights()->whereState(2)->leftJoin('pilots', 'flights.vatsim_id', '=', 'pilots.vatsim_id')->select('pilots.*', DB::raw('SUM(flights.duration) AS duration'))->orderBy('duration', 'desc')->groupBy('flights.vatsim_id')->take(5)->remember(120)->get()->transform(function ($pilot) use($airline) {
             return array('name' => $pilot->name, 'duration' => $pilot->duration, 'percent' => number_format($pilot->duration / $airline->duration * 100, 1));
         });
         $pilots->add(array('name' => 'Others', 'duration' => $airline->duration - $pilots->sum('duration'), 'percent' => number_format(($airline->duration - $pilots->sum('duration')) / $airline->duration * 100, 1)));
         $pilots = $pilots->toArray();
         foreach ($pilots as &$pilot) {
             $pilot = array($pilot['name'], $pilot['duration']);
         }
         $aircraft = $airline->flights()->whereState(2)->whereNotNull('aircraft_id')->where('aircraft_id', '!=', '')->with(['aircraft' => function ($aircraft) {
             $aircraft->remember(120);
         }])->select('aircraft_id', DB::raw('SUM(duration) AS duration'))->orderBy('duration', 'desc')->groupBy('aircraft_id')->take(5)->remember(120)->get()->transform(function ($aircraft) use($airline) {
             return array('name' => $aircraft->aircraft->implode('name', '<br />'), 'duration' => $aircraft->duration, 'percent' => number_format($aircraft->duration / $airline->duration * 100, 1));
         });
         $aircraft->add(array('name' => 'Other', 'duration' => $airline->duration - $aircraft->sum('duration'), 'percent' => number_format(($airline->duration - $aircraft->sum('duration')) / $airline->duration * 100, 1)));
         $aircraft = $aircraft->toArray();
         foreach ($aircraft as &$airplane) {
             $airplane = array($airplane['name'], $airplane['duration']);
         }
     } else {
         $pilots = array();
         $aircraft = array();
     }
     $pilots = piechartData($pilots)['javascript'];
     $aircraft = piechartData($aircraft)['javascript'];
     if (!in_array($airline->icao, Cache::get('legacy.airlines', []))) {
         Queue::push('LegacyUpdateAirline', array('airline' => $airline->icao), 'legacy');
         Messages::warning('Data for this airline may be missing. It is being processed by year. Depending on the popularity of the airline, it could take minutes to hours before it is done.')->one();
     }
     $this->javascript('assets/javascript/jquery.flot.min.js');
     $this->javascript('assets/javascript/jquery.flot.pie.min.js');
     $this->autoRender(compact('airline', 'historicFlights', 'pilots', 'aircraft', 'activeFlights'), $airline->icao . ' - ' . $airline->name);
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:49,代码来源:AirlineController.php

示例5: before

 public function before()
 {
     parent::before();
     // Get action, module and controller name
     $this->actionName = \Request::active()->action;
     $this->moduleName = \Request::active()->module;
     $this->controllerName = strtolower(str_replace('Controller_', '', \Request::active()->controller));
     $this->controllerName = str_replace($this->moduleName . '\\', '', $this->controllerName);
     // Check Auth Access
     if (!\Auth::check()) {
         \Messages::warning(__('user.login.not-logged'));
         //            \Response::redirect('user/service/index/login');
     }
     $this->template->title = "RN | Admin";
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:15,代码来源:backend.php

示例6: before

 public function before()
 {
     parent::before();
     // Get action, module and controller name
     $this->actionName = \Request::active()->action;
     $this->moduleName = \Request::active()->module;
     $this->controllerName = strtolower(str_replace('Controller_', '', \Request::active()->controller));
     $this->controllerName = str_replace($this->moduleName . '\\', '', $this->controllerName);
     // Check Auth Access
     if (!\Auth::check()) {
         \Messages::warning(__('user.login.not-logged'));
         \Response::redirect('user/service/index/login');
     }
     $this->_user = Model_User::find($this->_userId);
     // Set Navigation
     $this->template->title = "RN | Wall Street Journal";
     // Set global
     $this->dataGlobal['title'] = \Config::get('application.seo.backend.title');
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:19,代码来源:method.php

示例7: action_social_disconnect

 public function action_social_disconnect($provider)
 {
     // we have a UID and logged in? Just attach this authentication to a user
     if (\Auth::check()) {
         list(, $user_id) = \Auth::instance()->get_user_id();
         $entry = Model_Users_Providers::query()->where('parent_id', $user_id)->and_where_open()->where('provider', $provider)->and_where_close()->get_one();
         if ($entry) {
             $entry->delete();
             // attachment went ok so we'll redirect
             Messages::success('Social Media Account Unlinked');
             Response::redirect_back();
         } else {
             Messages::warning('Social Mediea Account not found');
             Response::redirect_back();
         }
     }
     return false;
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:18,代码来源:account.php


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