protected function compile() { $strAction = \Input::get('act'); // at first check for the correct request token to be set if ($strAction && !\RequestToken::validate(\Input::get('token')) && !$this->deactivateTokens) { StatusMessage::addError(sprintf($GLOBALS['TL_LANG']['frontendedit']['requestTokenExpired'], Environment::getUrl(true, true, false)), $this->id, 'requestTokenExpired'); return; } if ($strAction == FRONTENDEDIT_ACT_DELETE && ($intId = \Input::get('id'))) { if ($this->checkPermission($intId)) { $this->deleteItem($intId); // return to the list \Controller::redirect(Url::removeQueryString(array('act', 'id', 'token'), Environment::getUrl())); } else { StatusMessage::addError($GLOBALS['TL_LANG']['formhybrid_list']['noPermission'], $this->id); return; } } if ($strAction == FRONTENDEDIT_ACT_PUBLISH && ($intId = \Input::get('id'))) { if ($this->checkPermission($intId)) { $this->publishItem($intId); // return to the list \Controller::redirect(Url::removeQueryString(array('act', 'id'), Environment::getUrl())); } else { StatusMessage::addError($GLOBALS['TL_LANG']['formhybrid_list']['noPermission'], $this->id); return; } } parent::compile(); }
/** * Currently only works for products containing one single download * * @param IsotopeProduct $objProduct * @param array $arrConfig */ public function downloadSingleProduct(IsotopeProduct $objProduct, array $arrConfig = array()) { if (($objDownload = Download::findByPid($objProduct->getProductId())) !== null && ($strPath = Files::getPathFromUuid($objDownload->singleSRC))) { // TODO count downloads // start downloading the file (protected folders also supported) \Controller::redirect(Environment::getUrl() . '?file=' . $strPath); } }
protected function getHeader() { $arrHeader = array(); $arrCurrentSorting = $this->getCurrentSorting(); foreach ($this->arrTableFields as $strName) { $isCurrentOrderField = $strName == $arrCurrentSorting['order']; $arrField = array('field' => $strName); if ($isCurrentOrderField) { $arrField['class'] = $arrCurrentSorting['sort'] == 'asc' ? 'asc' : 'desc'; $arrField['link'] = Environment::addParametersToUri(Environment::getUrl(), array('order' => $strName, 'sort' => $arrCurrentSorting['sort'] == 'asc' ? 'desc' : 'asc')); } else { $arrField['link'] = Environment::addParametersToUri(Environment::getUrl(), array('order' => $strName, 'sort' => 'asc')); } $arrHeader[] = $arrField; } return $arrHeader; }