Example #1
0
 public function test($object, Validation_Errors $errors, $array_access = false)
 {
     $value = trim($this->value_of_attribute($object, $this->attribute, $array_access));
     $parsed = CMS::parse_parms($value);
     if (is_string($parsed)) {
         $errors->reject_value($this->attribute, $parsed);
     }
 }
Example #2
0
 protected function parse_parms($in)
 {
     return CMS::parse_parms($in);
 }
Example #3
0
 public function change($id, $data, $item)
 {
     if (is_object($item)) {
         $item->id = $id;
     }
     $value = CMS::parse_parms($data['valuesrc']);
     if (is_string($value)) {
         $item->valuesrc = $data['valuesrc'];
         return $value;
     } else {
         $rc = CMS::vars()->on_change_call($id, $value, $data);
         if (is_string($rc)) {
             $item->valuesrc = $data['valuesrc'];
             return $rc;
         }
         $item->assign(array('value' => serialize($value), 'valuesrc' => $data['valuesrc']));
         $item->update_value();
         return true;
     }
 }
Example #4
0
 public function assign_to_object($object, Forms_Form $form, $name, $parms)
 {
     if (isset($parms['parse_to'])) {
         $f = $parms['parse_to'];
         $object->{$f} = CMS::parse_parms($form[$name]);
     }
     if (isset($parms['serialize_to'])) {
         $f = $parms['serialize_to'];
         $object->{$f} = serialize(CMS::parse_parms($form[$name]));
     }
 }
Example #5
0
 public function change($id, $data, $item)
 {
     $value = CMS::parse_parms($data['valuesrc']);
     if (is_string($value)) {
         $item->valuesrc = $data['valuesrc'];
         return $value;
     } else {
         $rc = CMS_Var::on_change($id, $value, $data);
         if (is_string($rc)) {
             $item->valuesrc = $data['valuesrc'];
             return $rc;
         }
         CMS_Var::update_value($id, serialize($value), $data['valuesrc']);
         return true;
     }
 }