本文整理汇总了PHP中AdminTab::postProcess方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminTab::postProcess方法的具体用法?PHP AdminTab::postProcess怎么用?PHP AdminTab::postProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminTab
的用法示例。
在下文中一共展示了AdminTab::postProcess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
global $currentIndex;
if (Tools::isSubmit('submitPrint')) {
if (!Validate::isDate(Tools::getValue('date_from'))) {
$this->_errors[] = $this->l('Invalid from date');
}
if (!Validate::isDate(Tools::getValue('date_to'))) {
$this->_errors[] = $this->l('Invalid end date');
}
if (!sizeof($this->_errors)) {
$orders = Order::getOrdersIdInvoiceByDate(Tools::getValue('date_from'), Tools::getValue('date_to'), NULL, 'invoice');
if (sizeof($orders)) {
Tools::redirectAdmin('pdf.php?invoices&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')) . '&token=' . $this->token);
}
$this->_errors[] = $this->l('No invoice found for this period');
}
} elseif (Tools::isSubmit('submitOptionsinvoice')) {
if (intval(Tools::getValue('PS_INVOICE_NUMBER')) == 0) {
$this->_errors[] = $this->l('Invalid invoice number');
} else {
parent::postProcess();
}
} else {
parent::postProcess();
}
}
示例2: postProcess
public function postProcess()
{
if (isset($_POST['submitAdd' . $this->table])) {
$search = strval(Tools::getValue('search'));
$string = strval(Tools::getValue('alias'));
$aliases = explode(',', $string);
if (empty($search) or empty($string)) {
$this->_errors[] = $this->l('aliases and result are both required');
}
if (!Validate::isValidSearch($search)) {
$this->_errors[] = $search . ' ' . $this->l('is not a valid result');
}
foreach ($aliases as $alias) {
if (!Validate::isValidSearch($alias)) {
$this->_errors[] = $alias . ' ' . $this->l('is not a valid alias');
}
}
if (!sizeof($this->_errors)) {
foreach ($aliases as $alias) {
$obj = new Alias(NULL, trim($alias), trim($search));
$obj->save();
}
}
} else {
parent::postProcess();
}
}
示例3: postProcess
public function postProcess()
{
if (isset($_GET['delete' . $this->table]) or Tools::getValue('submitDel' . $this->table)) {
$this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
} else {
if (Tools::getValue('submitAdd' . $this->table)) {
$id_country = Tools::getValue('id_country');
$tmp_addr_format = new AddressFormat($id_country);
$save_status = false;
$is_new = is_null($tmp_addr_format->id_country);
if ($is_new) {
$tmp_addr_format = new AddressFormat();
$tmp_addr_format->id_country = $id_country;
}
$tmp_addr_format->format = Tools::getValue('address_layout');
if (strlen($tmp_addr_format->format) > 0) {
if ($tmp_addr_format->checkFormatFields()) {
$save_status = $is_new ? $tmp_addr_format->save() : $tmp_addr_format->update();
} else {
$errorList = $tmp_addr_format->getErrorList();
foreach ($errorList as $numError => $error) {
$this->_errors[] = $error;
}
}
if (!$save_status) {
$this->_errors[] = Tools::displayError('Invalid address layout' . Db::getInstance()->getMsgError());
}
}
unset($tmp_addr_format);
}
return parent::postProcess();
}
}
示例4: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
$this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
$this->adminAttributes->postProcess($this->token);
Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors));
// send _errors as reference to allow postProcessAttributeGroup to stop saving process
if (Tools::getValue('submitDel' . $this->table)) {
if ($this->tabAccess['delete'] === '1') {
if (isset($_POST[$this->table . 'Box'])) {
$object = new $this->className();
if ($object->deleteSelection($_POST[$this->table . 'Box'])) {
Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token);
}
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
} else {
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} else {
parent::postProcess();
}
}
示例5: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitAdd' . $this->table)) {
if ($id = intval(Tools::getValue('id_attachment')) and $a = new Attachment($id)) {
$_POST['file'] = $a->file;
$_POST['mime'] = $a->mime;
}
if (!sizeof($this->_errors)) {
if (isset($_FILES['file']) and is_uploaded_file($_FILES['file']['tmp_name'])) {
if ($_FILES['file']['size'] > $this->maxFileSize) {
$this->_errors[] = $this->l('File too large, maximum size allowed:') . ' ' . $this->maxFileSize / 1000 . ' ' . $this->l('kb');
} else {
$uploadDir = dirname(__FILE__) . '/../../download/';
do {
$uniqid = sha1(microtime());
} while (file_exists($uploadDir . $uniqid));
if (!copy($_FILES['file']['tmp_name'], $uploadDir . $uniqid)) {
$this->_errors[] = $this->l('File copy failed');
}
@unlink($_FILES['file']['tmp_name']);
$_POST['name_2'] .= '.' . pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$_POST['file'] = $uniqid;
$_POST['mime'] = $_FILES['file']['type'];
}
}
}
$this->validateRules();
}
return parent::postProcess();
}
示例6: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
$this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
$this->adminAttributes->postProcess($this->token);
Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors));
// send _errors as reference to allow postProcessAttributeGroup to stop saving process
if (Tools::getValue('submitDel' . $this->table)) {
if ($this->tabAccess['delete'] === '1') {
if (isset($_POST[$this->table . 'Box'])) {
$object = new $this->className();
if ($object->deleteSelection($_POST[$this->table . 'Box'])) {
Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token);
}
$this->_errors[] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations');
} else {
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} else {
parent::postProcess();
}
if (isset($this->_errors) && count($this->_errors)) {
$key = array_search('An error occurred during deletion of ' . $this->table . '.', $this->_errors);
if ($key !== false) {
$this->_errors[$key] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations');
}
}
}
示例7: postProcess
public function postProcess()
{
global $cookie;
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
if (Tools::isSubmit('submitAdd' . $this->table)) {
if ($id_category = intval(Tools::getValue('id_category'))) {
if (!Category::checkBeforeMove($id_category, intval(Tools::getValue('id_parent')))) {
$this->_errors[] = Tools::displayError('category cannot be moved here');
return false;
}
// Updating customer's group
if ($this->tabAccess['edit'] !== '1') {
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
} else {
$object = new $this->className($id_category);
if (Validate::isLoadedObject($object)) {
$object->updateGroup(Tools::getValue('groupBox'));
} else {
$this->_errors[] = Tools::displayError('an error occurred while updating object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
}
}
}
parent::postProcess();
}
示例8: postProcess
public function postProcess()
{
global $currentIndex;
$this->product = new Product(intval(Tools::getValue('id_product')));
if (isset($_POST['generate'])) {
if (!is_array(Tools::getValue('options'))) {
$this->_errors[] = Tools::displayError('You need to choose at least 1 attribute.');
} else {
$tab = array_values($_POST['options']);
if (sizeof($tab) and Validate::isLoadedObject($this->product)) {
self::setAttributesImpacts($this->product->id, $tab);
$this->combinations = array_values(self::createCombinations($tab));
$values = array_values(array_map(array($this, 'addAttribute'), $this->combinations));
$this->product->deleteProductAttributes();
$res = $this->product->addProductAttributeMultiple($values);
$this->product->addAttributeCombinationMultiple($res, $this->combinations);
} else {
$this->_errors[] = Tools::displayError('Unable to initialize parameters, combinations is missing or object cannot be load.');
}
}
} elseif (isset($_POST['back'])) {
Tools::redirectAdmin($currentIndex . '&id_product=' . intval(Tools::getValue('id_product')) . '&id_category=' . intval(Tools::getValue('id_category')) . '&addproduct' . '&tabs=2&token=' . Tools::getValue('token'));
}
parent::postProcess();
}
示例9: postProcess
public function postProcess()
{
if (isset($_GET['delete' . $this->table]) || Tools::getValue('submitDel' . $this->table)) {
$this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
} elseif (Tools::getValue('submitAdd' . $this->table)) {
if (!Tools::getValue('id_' . $this->table)) {
if (Validate::isLanguageIsoCode(Tools::getValue('iso_code')) && Country::getByIso(Tools::getValue('iso_code'))) {
$this->_errors[] = Tools::displayError('This ISO code already exists, you cannot create two country with the same ISO code');
}
} else {
if (Validate::isLanguageIsoCode(Tools::getValue('iso_code'))) {
$id_country = Country::getByIso(Tools::getValue('iso_code'));
if (!is_null($id_country) && $id_country != Tools::getValue('id_' . $this->table)) {
$this->_errors[] = Tools::displayError('This ISO code already exists, you cannot create two country with the same ISO code');
}
}
}
if (Tools::isSubmit('standardization')) {
Configuration::updateValue('PS_TAASC', (bool) Tools::getValue('standardization', false));
}
if (isset($this->_errors) && count($this->_errors)) {
return false;
}
}
return parent::postProcess();
}
示例10: postProcess
public function postProcess()
{
if (isset($_GET['delete' . $this->table]) or Tools::getValue('submitDel' . $this->table)) {
$this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
} else {
return parent::postProcess();
}
}
示例11: postProcess
public function postProcess()
{
global $cookie;
if (Tools::isSubmit('rebuildStock')) {
StockMvt::addMissingMvt((int) $cookie->id_employee, false);
}
return parent::postProcess();
}
示例12: postProcess
public function postProcess()
{
if (isset($_GET['delete' . $this->table]) and $_GET[$this->identifier] == (int) _PS_ADMIN_PROFILE_) {
$this->_errors[] = $this->l('For security reasons, you cannot delete the Administrator profile');
} else {
parent::postProcess();
}
}
示例13: postProcess
public function postProcess()
{
if (isset($_POST['submitAdd' . $this->table]) and Tools::getValue('delimiter1') >= Tools::getValue('delimiter2')) {
$this->_errors[] = Tools::displayError('invalid range');
} else {
parent::postProcess();
}
}
示例14: postProcess
public function postProcess()
{
if ($this->tabAccess['edit'] === '1' and Tools::getValue('submitAdd' . $this->table)) {
if ($id = intval(Tools::getValue($this->identifier)) and $obj = new $this->className($id) and Validate::isLoadedObject($obj)) {
$obj->setProducts($_POST['products']);
}
}
return parent::postProcess();
}
示例15: postProcess
public function postProcess()
{
$result = Db::getInstance()->ExecuteS('
SELECT `id_subdomain`
FROM `' . _DB_PREFIX_ . 'subdomain`
');
if (sizeof($result) === 1) {
foreach ($result as $row) {
$this->_listSkipDelete = array($row['id_subdomain']);
}
}
return parent::postProcess();
}