コード例 #1
0
ファイル: checkboxescustom.php プロジェクト: kenjs/Goteo
 public function __construct($data = array())
 {
     parent::__construct($data);
     if (!is_array($this->options)) {
         $this->options = array();
     }
     $i = 0;
     foreach ($this->options as $value => &$option) {
         $i++;
         if (!$option instanceof CheckBoxCustom) {
             if (is_string($option)) {
                 $option = new CheckBoxCustom(array('value' => $value, 'label' => (string) $option));
             } else {
                 if (is_array($option)) {
                     $option = new CheckBoxCustom($option);
                 } else {
                     continue;
                 }
             }
         }
         if (isset($this->value)) {
             $option->checked = $option->value == $this->value;
         }
         $option->name = $this->name;
         if (!isset($option->id)) {
             $option->id = $this->id . "-{$i}";
         }
     }
 }
コード例 #2
0
ファイル: radios.php プロジェクト: anvnguyen/Goteo
 public function __construct($data = array())
 {
     parent::__construct($data);
     if (!is_array($this->options)) {
         $this->options = array();
     }
     foreach ($this->options as $value => &$option) {
         if (is_string($option)) {
             $option = new Radio(array('value' => $value, 'label' => (string) $option, 'name' => $this->name));
         } else {
             if (is_array($option)) {
                 $option = new Radio($option + array('name' => $this->name, 'level' => $this->level + 1));
             } else {
                 continue;
             }
         }
         if (isset($this->value)) {
             $option->checked = $option->value == $this->value;
         }
         $option->id = $this->id . '-' . $option->value;
     }
 }
コード例 #3
0
 public static function compareNames(Named $left, Named $right)
 {
     return strcasecmp($left->getName(), $right->getName());
 }
コード例 #4
0
ファイル: User.php プロジェクト: uglybob/bh.net
 public function __construct($name)
 {
     parent::__construct($name);
     $this->level = 1;
 }