Esempio n. 1
0
 public function input($prefix = 'jelly/field', $data = array())
 {
     if (!isset($data['options'])) {
         $data['options'] = Jelly::select($this->foreign['model'])->join('products_suppliers', 'LEFT')->on('products_suppliers.supplier_id', '=', $this->foreign['model'] . ':primary_key')->where('products_suppliers.product_id', '=', $this->product->id)->execute()->as_array($this->foreign['model'] . ':primary_key', $this->foreign['model'] . ':name_key');
     }
     return parent::input($prefix, $data);
 }
Esempio n. 2
0
 public function input($prefix = 'jelly/field', $data = array())
 {
     if (!isset($data['options'])) {
         $options = Jelly::select($this->foreign['model'])->execute();
         foreach ($options as $v) {
             $data['options'][$v->id] = $v->name . ' - ' . $v->value . ' zł';
         }
     }
     return parent::input($prefix, $data);
 }
Esempio n. 3
0
 public function input($prefix = 'jelly/field', $data = array())
 {
     if (!isset($data['options'])) {
         $options = Jelly::select($this->foreign['model'])->execute()->as_array();
         foreach ($options as $v) {
             $this->list[$v['id']] = $v;
             if ($v['category'] !== NULL) {
                 $this->parent[$v['category']][] = $v['id'];
             }
         }
         $data['options'] = $this->view_category(1);
         if ($this->no_root) {
             unset($data['options'][1]);
         }
     }
     return parent::input($prefix, $data);
 }
Esempio n. 4
0
 /**
  * @param Field_BelongsTo $element
  * @return $this
  */
 private function __write_belongs_to(Field_BelongsTo $element)
 {
     $this->__instance->{$element->name()} = $element->model()->where($element->model()->primary_key(), "=", $element->value())->find();
     return $this;
 }