Beispiel #1
0
 protected function process()
 {
     $result = parent::process();
     switch ($this->action) {
         case "update":
             if ($this->on("error")) {
                 $this->status = "modify";
                 //$this->process_url = rpd_url_helper::get_url();
             }
             if ($this->on("success")) {
                 //settare messaggio in sessione o in variabile
                 $this->status = "modify";
                 $this->redirect = $this->url->replace('update' . $this->cid, 'show' . $this->cid)->get();
             }
             break;
         case "insert":
             if ($this->on("error")) {
                 $this->status = "create";
             }
             if ($this->on("success")) {
                 $this->status = "show";
                 $this->redirect = $this->url->remove('insert' . $this->cid)->append('show' . $this->cid, $this->model->getKey())->get();
             }
             break;
         case "delete":
             if ($this->on("error")) {
             }
             if ($this->on("success")) {
                 $this->message("record deleted");
             }
             break;
     }
 }
 /**
  * process works with current action/status, appended fields and model
  * it do field validation, field auto-update, then model operations
  * in can change current status and setup an output message
  * @return bool|void
  */
 protected function process()
 {
     $result = parent::process();
     switch ($this->action) {
         case "update":
             if ($this->on("error")) {
                 $this->status = "modify";
             }
             if ($this->on("success")) {
                 $this->status = "modify";
                 if (in_array('update', $this->back_on)) {
                     $this->redirect = $this->back_url;
                 } else {
                     $this->redirect = $this->url->replace('update' . $this->cid, 'show' . $this->cid)->get();
                 }
             }
             break;
         case "insert":
             if ($this->on("error")) {
                 $this->status = "create";
             }
             if ($this->on("success")) {
                 $this->status = "show";
                 if (in_array('insert', $this->back_on)) {
                     $this->redirect = $this->back_url;
                 } else {
                     $this->redirect = $this->url->remove('insert' . $this->cid)->append('show' . $this->cid, $this->model->getKey())->get();
                 }
             }
             break;
         case "delete":
             if ($this->on("error")) {
                 $this->message(trans('rapyd::rapyd.err'));
             }
             if ($this->on("success")) {
                 if (in_array('do_delete', $this->back_on)) {
                     $this->redirect = $this->back_url;
                 } else {
                     $this->message(trans('rapyd::rapyd.deleted'));
                 }
             }
             break;
     }
     switch ($this->status) {
         case "delete":
             $this->message(trans('rapyd::rapyd.conf_delete'));
             break;
         case "unknow_record":
             $this->message(trans('rapyd::rapyd.err_unknown'));
             break;
     }
 }