Exemplo n.º 1
0
 public function __construct(array $allowedClassesInstances, $label = null, $flags = null, $element_id = null)
 {
     foreach ($allowedClassesInstances as $e) {
         if (is_string($e) && class_exists($e)) {
             $this->allowedClassesInstances[$e] = new $e();
         } else {
             if ($e instanceof Element) {
                 $this->allowedClassesInstances[$e->getClass()] = $e;
             } else {
                 // error elements must be an array of valid classes names or Elements
             }
         }
     }
     parent::__construct($label, $flags, $element_id);
 }
Exemplo n.º 2
0
 public function __construct(array $allowedClassesInstances, $label = null, $flags = null, $element_id = null)
 {
     if (is_string($allowedClassesInstances[0])) {
         foreach ($allowedClassesInstances as $class) {
             $this->allowedClassesInstances[$class] = new $class();
         }
     } else {
         if ($allowedClassesInstances[0] instanceof \SimplOn\Elements\Element) {
             foreach ($allowedClassesInstances as $classInstance) {
                 $this->allowedClassesInstances[$classInstance->getClass()] = $classInstance;
             }
         } else {
             // error elements must be an array of valid classes names or Elements
         }
     }
     parent::__construct($label, $flags, $element_id);
 }
Exemplo n.º 3
0
 public function __construct(\SimplOn\Elements\Element $element, $label = null, $flags = null, $element_id = null)
 {
     $this->element($element);
     parent::__construct($label, $flags, $element_id);
 }
Exemplo n.º 4
0
 public function filterCriteria($filterCriteria = null)
 {
     $glue = '_';
     $name = $this->name();
     $num = 0;
     $paste = '';
     $ret = array();
     $values = $this->val();
     if (is_array($values)) {
         foreach ($values as $value) {
             if (property_exists($this->parent, $name . $num)) {
                 $paste = $name . $glue . $num;
                 while (property_exists($this->parent, $paste)) {
                     $paste .= $glue;
                 }
                 $ret[] = $name . ' == :' . $paste;
             } else {
                 $ret[] = $name . ' == :' . $name . $num;
             }
             $num += 1;
         }
         $criteria = implode(' OR ', $ret);
         return $criteria;
     } else {
         return parent::filterCriteria($filterCriteria);
     }
 }