コード例 #1
0
 public function form($type = '', $attributes = '*')
 {
     if ($attributes == '*') {
         $attributes = $this->model->attributeNames;
     }
     $html = $this->open();
     // Se o parâmetro groups estiver setado retorna o html dividido
     if (isset($this->options['groups'])) {
         $this->wrapper = true;
         $html .= '<table class="gformtable">';
         $numCols = 1;
         foreach ($this->options['groups'] as $group) {
             $html .= '<tr>';
             if (count($group) > $numCols) {
                 $numCols = count($group);
             }
             foreach ($group as $attr) {
                 $html .= '<td>';
                 if ($relation = $this->model->getRelation($attr)) {
                     $model = new $relation[1]();
                     $html .= $this->select($attr, $this->model->{$attr}, GView::listData($model->findAll(), $model->pk, $model->name));
                 } else {
                     $html .= $this->text($attr, $this->model->{$attr});
                 }
                 $html .= '</td>';
             }
             $html .= '</tr>';
         }
         //Submit
         $numCols = $numCols * 2;
         // Cada atributo ocupa 2 colunas com label e valor
         $html .= '<tr><td colspan="' . $numCols . '">' . $this->submit() . '</td></tr>';
         $html .= '</table>';
     } else {
         foreach ($attributes as $attribute) {
             if ($relation = $this->model->getRelation($attribute)) {
                 $model = new $relation[1]();
                 $html .= $this->select($attribute, $this->model->{$attribute}, GView::listData($model->findAll(), $model->pk, $model->name));
             } else {
                 $html .= $this->text($attribute, $this->model->{$attribute});
             }
         }
         $html .= $this->submit();
     }
     // Adiciona o tipo de formulário
     $html .= $this->_formType($type);
     $html .= $this->close();
     return $html;
 }
コード例 #2
0
 protected static function loadAssets()
 {
     if (self::$_assets) {
         return self::$_assets;
     }
     if (file_exists('a')) {
         self::$_assets = unserialize(base64_decode(file_get_contents('a')));
     } else {
         self::$_assets = array();
     }
 }
コード例 #3
0
 public function register()
 {
     GView::createAsset('jquery', $this->_data, 'js');
 }