/** * Load the dataGrid */ private function loadDataGrid() { // filter category if ($this->categoryId != null) { // create datagrid $this->dgProducts = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_FOR_CATEGORY, array($this->categoryId, BL::getWorkingLanguage())); // set the URL $this->dgProducts->setURL('&category=' . $this->categoryId, true); } else { // dont filter category // create datagrid $this->dgProducts = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage())); } // our JS needs to know an id, so we can highlight it $this->dgProducts->setRowAttributes(array('id' => 'row-[id]')); $this->dgProducts->enableSequenceByDragAndDrop(); $this->dgProducts->setColumnsHidden(array('category_id', 'sequence')); // check if this action is allowed if (BackendAuthentication::isAllowedAction('Edit')) { // set column URLs $this->dgProducts->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]&category=' . $this->categoryId); // add edit and media column //$this->dgProducts->addColumn('media', null, BL::lbl('Media'), BackendModel::createURLForAction('media') . '&id=[id]', BL::lbl('Media')); $this->dgProducts->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]&category=' . $this->categoryId, BL::lbl('Edit')); // set media column function $this->dgProducts->setColumnFunction(array(__CLASS__, 'setMediaLink'), array('[id]'), 'media'); } }
/** * Sets an URL, optionally only appending the provided piece * * @param string $url The URL to set. * @param bool $append Should it be appended to the existing URL. */ public function setURL($url, $append = false) { if ($append) { parent::setURL(parent::getURL() . $url); } else { parent::setURL($url); } }