public function build($view = '')
 {
     $view == '' and $view = 'rapyd::datagrid';
     parent::build();
     Persistence::save();
     foreach ($this->data as $tablerow) {
         $row = new Row($tablerow);
         foreach ($this->columns as $column) {
             $cell = new Cell($column->name);
             $sanitize = count($column->filters) || $column->cell_callable ? false : true;
             $value = $this->getCellValue($column, $tablerow, $sanitize);
             $cell->value($value);
             $cell->parseFilters($column->filters);
             if ($column->cell_callable) {
                 $callable = $column->cell_callable;
                 $cell->value($callable($cell->value));
             }
             $row->add($cell);
         }
         if (count($this->row_callable)) {
             foreach ($this->row_callable as $callable) {
                 $callable($row);
             }
         }
         $this->rows[] = $row;
     }
     return \View::make($view, array('dg' => $this, 'buttons' => $this->button_container, 'label' => $this->label));
 }
示例#2
0
 protected function sniffAction()
 {
     $this->reset_url = $this->url->remove('ALL')->append('reset' . $this->cid, 1)->get();
     $this->process_url = $this->url->remove('ALL')->append('search' . $this->cid, 1)->get();
     ///// search /////
     if ($this->url->value('search')) {
         $this->action = "search";
         Persistence::save();
     } elseif ($this->url->value("reset")) {
         $this->action = "reset";
         Persistence::clear();
     } else {
         Persistence::clear();
     }
 }
示例#3
0
 public function build($view = '')
 {
     $this->initJsWidget();
     $view == '' and $view = 'rapyd::datatree';
     $this->open = Form::open($this->attributes);
     $this->close = Form::hidden('save', 1) . Form::close();
     // we save on POST and only if the widget's own input variable is filled
     // because sometimes we have more than a tree widget on the same page
     // but just one save
     if (\Request::method() == 'POST' && \Input::get($this->name)) {
         $this->lockAndSave();
     }
     $this->data = $this->source->find($this->source->getKey())->getDescendants()->toHierarchy();
     Persistence::save();
     $this->rows = $this->makeRowsRecursive($this->data);
     return \View::make($view, array('dg' => $this, 'buttons' => $this->button_container, 'label' => $this->label));
 }