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)); }
/** * @param string $url * @param string $name * @param string $position * @param array $attributes * * @return $this */ public function link($url, $name, $position = "BL", $attributes = array()) { $match_url = trim(parse_url($url, PHP_URL_PATH), '/'); if (Request::path() != $match_url) { $url = Persistence::get($match_url, parse_url($url, PHP_URL_QUERY)); } $attributes = array_merge(array("class" => "btn btn-default"), $attributes); $this->button_container[$position][] = HTML::link($url, $name, $attributes); $this->links[] = $url; return $this; }
/** * @param string $url * @param string $name * @param string $position * @param array $attributes * * @return $this */ public function link($url, $name, $position = "BL", $attributes = array()) { $base = str_replace(Request::path(), '', strtok(Request::fullUrl(), '?')); $match_url = str_replace($base, '/', strtok($url, '?')); if (Request::path() != $match_url) { $url = Persistence::get($match_url, parse_url($url, PHP_URL_QUERY)); } $attributes = array_merge(array("class" => "btn btn-default"), $attributes); $this->button_container[$position][] = HTML::link($url, $name, $attributes); $this->links[] = $url; return $this; }
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(); } }
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)); }
protected function sniffAction() { $this->reset_url = $this->url->remove('ALL')->append('reset', 1)->get(); $this->process_url = $this->url->remove('ALL')->append('search', 1)->get(); ///// search ///// if ($this->url->value('search')) { $this->action = "search"; //Persistence::save(); } elseif ($this->url->value("reset")) { $this->action = "reset"; //Persistence::clear(); } else { $page = Persistence::all(); if (count($page)) { $this->action = "search"; } //Persistence::save(); } }
/** * enable auto-back feature on given actions * @param string $actions * @param string $uri * @return $this */ public function back($actions = 'insert|update|do_delete', $url = "") { if ($url == "") { if (count($this->links)) { $url = array_pop($this->links); } else { return $this; } } else { $match_url = trim(parse_url($url, PHP_URL_PATH), '/'); if (Request::path() != $match_url) { $url = Persistence::get($match_url); } } $this->back_on = explode("|", $actions); $this->back_url = $url; return $this; }
/** * enable auto-back feature on given actions * @param string $actions * @param string $uri * @return $this */ public function back($actions = 'insert|update|do_delete', $url = "") { if ($url == "") { if (count($this->links)) { $url = array_pop($this->links); } else { return $this; } } else { $base = str_replace(Request::path(), '', strtok(Request::fullUrl(), '?')); $match_url = str_replace($base, '/', strtok($url, '?')); if (Request::path() != $match_url) { $url = Persistence::get($match_url); } } $this->back_on = explode("|", $actions); $this->back_url = $url; return $this; }