Пример #1
0
 public function addItem($value, $caption = '', $selected = null, $enabled = true, $class = null)
 {
     if ($value instanceof CComboItem || $value instanceof COptGroup) {
         parent::addItem($value);
     } else {
         if (is_null($selected)) {
             $selected = 'no';
             if (is_array($this->value)) {
                 if (str_in_array($value, $this->value)) {
                     $selected = 'yes';
                 }
             } elseif (strcmp($value, $this->value) == 0) {
                 $selected = 'yes';
             }
         } else {
             $selected = 'yes';
         }
         $citem = new CComboItem($value, $caption, $selected, $enabled);
         if ($class !== null) {
             $citem->addClass($class);
         }
         parent::addItem($citem);
     }
     return $this;
 }