Ejemplo n.º 1
0
 public function getNewValue()
 {
     $process = Input::get('search') || Input::get('save') ? true : false;
     if ($process && Input::exists($this->name)) {
         if ($this->status == "create") {
             $this->action = "insert";
         } elseif ($this->status == "modify") {
             $this->action = "update";
         }
         if ($this->multiple) {
             $this->value = "";
             if (Input::get($this->name)) {
                 $values = Input::get($this->name);
                 if (!is_array($values)) {
                     $this->new_value = $values;
                 } else {
                     $this->new_value = implode($this->serialization_sep, $values);
                 }
             }
         } else {
             $this->new_value = HTML::xssfilter(Input::get($this->name));
         }
     } elseif ($this->action == "insert" && $this->insert_value != null) {
         $this->new_value = $this->insert_value;
     } elseif ($this->action == "update" && $this->update_value != null) {
         $this->new_value = $this->update_value;
     } else {
         $this->action = "idle";
     }
     if ($this->new_value == "") {
         $this->new_value = null;
     }
 }
Ejemplo n.º 2
0
 public function buildAttributes()
 {
     return HTML::buildAttributes($this->attributes);
 }
Ejemplo n.º 3
0
 public function getNewValue($forceProcess = false)
 {
     $process = Input::get('search') || Input::get('save') || $forceProcess ? true : false;
     if ($process && Input::exists($this->name)) {
         if ($this->status == "create") {
             $this->action = "insert";
         } elseif ($this->status == "modify") {
             $this->action = "update";
         }
         if ($this->multiple) {
             $this->value = "";
             if (Input::get($this->name)) {
                 $values = Input::get($this->name);
                 if (!is_array($values)) {
                     $this->new_value = $values;
                 } else {
                     $this->new_value = implode($this->serialization_sep, $values);
                 }
             }
         } else {
             $this->new_value = HTML::xssfilter(Input::get($this->name));
         }
     } elseif ($this->action == "insert" && $this->insert_value != null) {
         $this->edited = true;
         $this->new_value = $this->insert_value;
     } elseif ($this->action == "update" && $this->update_value != null) {
         $this->edited = true;
         $this->new_value = $this->update_value;
     } elseif ($this->type == 'auto') {
         //if is auto and no default is matched, keep the old value
         $this->new_value = $this->value;
     } else {
         $this->action = "idle";
     }
     if ($this->new_value == "") {
         $this->new_value = null;
     }
     //Run the pre_save_processor
     if (is_a($this->pre_save_processor, 'Closure') && $this->form) {
         $this->new_value = $this->pre_save_processor->__invoke($this->new_value, $this->form->fields, $this->form->model);
     }
 }
Ejemplo n.º 4
0
 public function getNewValue()
 {
     $process = Input::get('search') || Input::get('save') ? true : false;
     if ($process && Input::exists($this->name)) {
         if ($this->status == "create") {
             $this->action = "insert";
         } elseif ($this->status == "modify") {
             $this->action = "update";
         }
         if ($this->multiple) {
             $this->value = "";
             if (Input::get($this->name)) {
                 $values = Input::get($this->name);
                 if (!is_array($values)) {
                     $this->new_value = $values;
                 } else {
                     $this->new_value = implode($this->serialization_sep, $values);
                 }
             }
         } else {
             if ($this->with_xss_filter) {
                 $this->new_value = HTML::xssfilter(Input::get($this->name));
             } else {
                 $this->new_value = Input::get($this->name);
             }
         }
     } elseif ($this->action == "insert" && $this->insert_value != null) {
         $this->edited = true;
         $this->new_value = $this->insert_value;
     } elseif ($this->action == "update" && $this->update_value != null) {
         $this->edited = true;
         $this->new_value = $this->update_value;
     } elseif ($this->type == 'auto') {
         //if is auto and no default is matched, keep the old value
         $this->new_value = $this->value;
     } else {
         $this->action = "idle";
     }
     if ($this->new_value == "") {
         $this->new_value = null;
     }
 }