Example #1
0
 public function init()
 {
     parent::init();
     mt_srand((double) microtime() * 10000);
     $this->id = $this->id ? $this->id : 'files' . strtoupper(md5(uniqid(mt_rand(), true)));
     //var_dump($this->id);
     $this->name = isset($this->model) ? Html::getInputName($this->model, $this->attribute) : $this->id;
     if (isset($this->attribute)) {
         $this->pure_attribute = BaseHtml::getAttributeName($this->attribute);
     }
     if (!$this->file_id) {
         if (isset($this->attribute)) {
             $this->file_id = $this->model[$this->pure_attribute];
         } else {
             $this->file_id = -1;
         }
     }
     if (!$this->options) {
         $this->options = [];
     }
     if (!$this->select_callback) {
         $this->select_callback = false;
     }
     if (!$this->caption) {
         $this->caption = false;
     }
 }