public function render($content) { $uri = $this->getOption('uri'); $field = $this->getOption('field'); $uriParams = array('module' => $uri[0], 'controller' => $uri[1], 'action' => $uri[2]); if ($this->getOption('alias')) { $uriParams[$this->getOption('alias')] = $content->{$field}; } else { $uriParams[$field] = $content->{$field}; } $params = array('tag' => 'a', 'attrs' => array('href' => $this->getDecorator()->view->_helperUrl->getUrl($uriParams))); if ($this->getOption('callback')) { $params['attrs']['onclick'] = $this->getOption('callback') . '(' . $content->{$field} . ', this); return false;'; } $linkDecorator = new \Core\Grid\Decorator\HtmlTag($params); return $this->_decorator->render($linkDecorator->render($this->getOption('title'))); }
public function render($content) { if ($this->getOption('sortable')) { $fieldName = $this->getOption('currentField'); $request = \Core\Http\Request::getInstance(); $sortby = $request->getParam('sortby', false); $img = ''; if ($sortby == $fieldName) { $sort = $request->getParam('sortorder', false); $img = '<img class="fv_sort_order" src="' . \Core\Config::getInstance()->app['baseUrl'] . 'i/s_' . $sort . '.png" alt="sort" />'; } else { $sort = false; } $sort = $sort == false || $sort == 'desc' ? 'asc' : 'desc'; $url = $this->getDecorator()->view->_helperUrl->getUrl(array('sortby' => $fieldName, 'sortorder' => $sort), false); $decorator = new \Core\Grid\Decorator\HtmlTag(array('tag' => 'a', 'attrs' => array('href' => $url))); $content .= $img; $content = $decorator->render($content); } return parent::render($content); }