Exemplo n.º 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;
     }
 }
Exemplo n.º 2
0
 /**
  * return a form with a nested action button
  *
  * @param $url
  * @param $method
  * @param $name
  * @param string $position
  * @param array $attributes
  * @return $this 
  * @static 
  */
 public static function formButton($url, $method, $name, $position = 'BL', $attributes = array())
 {
     //Method inherited from \Zofe\Rapyd\Widget
     return \Zofe\Rapyd\DataForm\DataForm::formButton($url, $method, $name, $position, $attributes);
 }
 /**
  * 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;
     }
 }
Exemplo n.º 4
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $info = $this->info;
     $data = DataForm::source(new TahunAkademik());
     return View::make('jurusan::tahun_akademik.create', compact('info', 'data'));
 }