Beispiel #1
0
 /**
  * Add action - add the new network
  *
  * @package     las
  * @version     1.0
  */
 public function addAction()
 {
     // Set title, pick view and send variables
     $this->tag->setTitle(__('Networks') . ' / ' . __('Add'));
     $this->view->pick('networks/write');
     $this->view->setVars(['type' => Networks::type(true), 'status' => Networks::status(true), 'bitRate' => Settings::options('bitRate', $this->las['general']['bitRate'])]);
     // Check if the form has been sent
     if ($this->request->isPost() === true && $this->request->hasPost('submit')) {
         $network = new Networks();
         $valid = $network->write();
         // Check if data are valid
         if ($valid instanceof Networks) {
             unset($_POST);
             $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 {
         $this->tag->setDefaults(['mask' => '/24']);
     }
 }