示例#1
0
 public function input(array $attributes = array())
 {
     $options = Jelly::select($this->field->foreign['model'])->execute()->as_array(':primary_key', ':name_key');
     $value = $this->model->__get($this->field->name);
     if ($this->field->null or empty($value) and !array_key_exists('not_empty', $this->field->rules)) {
         $options = array_merge(array('' => __('None')), $options);
     }
     $this->view->set(array('name' => $this->field->name, 'value' => $value, 'options' => $options, 'attributes' => $attributes));
     return parent::input();
 }
示例#2
0
 public function input(array $attributes = array())
 {
     $value = $this->model->__get($this->field->name);
     $ids = array();
     foreach ($value as $model) {
         $ids[] = $model->id();
     }
     $this->view->set(array('name' => $this->field->name, 'ids' => $ids, 'foreign' => $this->field->foreign, 'attributes' => $attributes));
     return parent::input();
 }
示例#3
0
 public function input(array $attributes = array())
 {
     $choices = array_intersect_key(array_map('__', $this->field->choices), array(0, 1));
     $value = (int) $this->model->__get($this->field->name);
     if (!array_key_exists($value, $choices)) {
         $value = $this->field->default;
     }
     $this->view->set(array('name' => $this->field->name, 'value' => $value, 'choices' => $choices, 'attributes' => $attributes));
     return parent::input();
 }
示例#4
0
 public function input(array $attributes = array())
 {
     $tmp = $this->model->__get($this->field->name);
     $cached = NULL;
     if (!is_string($tmp) or !preg_match('/^[a-z0-9]{32}-[a-z0-9]{32}$/iD', $tmp)) {
         $tmp = NULL;
         $cached = NULL;
     } else {
         $cache = Cache::instance()->get($tmp);
         $cached = Arr::path($cache, 'upload.name');
     }
     $this->view->set(array('name' => $this->field->name, 'value' => $this->model->get($this->field->name, FALSE), 'tmp' => $tmp, 'cached' => $cached, 'attributes' => $attributes));
     return parent::input();
 }
示例#5
0
 public function input(array $attributes = array())
 {
     $this->view->set(array('name' => $this->field->name, 'value' => $this->model->__get($this->field->name), 'attributes' => $attributes));
     return parent::input();
 }
示例#6
0
 public function input(array $attributes = array())
 {
     $_POST[$this->field->name . '-mod'] = Arr::get($_POST, $this->field->name . '-mod', 1);
     $this->view->set(array('name' => $this->field->name, 'value' => $this->model->get($this->field->name), 'options' => Jelly::select($this->model->meta()->table())->order_by('priority', 'desc')->execute()->as_array('priority', 'name'), 'attributes' => $attributes));
     return parent::input();
 }