예제 #1
0
 /**
  * Qos settings
  *
  * @package     las
  * @version     1.0
  */
 public function qosAction()
 {
     $this->tag->setTitle(__('Settings') . ' / ' . __(ucfirst($this->dispatcher->getActionName())));
     $settings = Settings::find(['category = :category: AND status = :status:', 'bind' => [':category' => $this->dispatcher->getActionName(), ':status' => Settings::ACTIVE]]);
     $this->view->setVars(['settings' => $settings, 'category' => __(ucfirst($this->dispatcher->getActionName())), 'priority' => \Las\Models\Services::priority(true)]);
     // Check if the form has been sent
     if ($this->request->isPost() === true && $this->request->hasPost('submit')) {
         // Try to update settings
         $valid = Settings::qos($settings);
         // Check if data are valid
         if ($valid === TRUE) {
             $this->flashSession->success($this->tag->linkTo(['#', 'class' => 'close', 'title' => __("Close"), '×']) . '<strong>' . __('Success') . '!</strong> ' . __("The data has been saved."));
         } else {
             $this->view->setVar('errors', $valid);
             $this->flashSession->warning($this->tag->linkTo(['#', 'class' => 'close', 'title' => __("Close"), '×']) . '<strong>' . __('Warning') . '!</strong> ' . __("Please correct the errors."));
         }
     } else {
         // Values to fill out the form
         $this->tag->setDefaults($this->las[$this->dispatcher->getActionName()]);
     }
 }