本文整理汇总了PHP中AdminController::processAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminController::processAdd方法的具体用法?PHP AdminController::processAdd怎么用?PHP AdminController::processAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminController
的用法示例。
在下文中一共展示了AdminController::processAdd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAdd
public function processAdd()
{
if (($new_dir = Tools::getValue('directory')) != '') {
if (!Validate::isDirName($new_dir)) {
$this->display = 'add';
return !($this->errors[] = sprintf(Tools::displayError('"%s" is not a valid directory name'), $new_dir));
}
if (Theme::getByDirectory($new_dir)) {
$this->display = 'add';
return !($this->errors[] = Tools::displayError('A directory with this name already exist'));
}
if (mkdir(_PS_ALL_THEMES_DIR_ . $new_dir, Theme::$access_rights)) {
$this->confirmations[] = $this->l('The directory was successfully created.');
}
if (0 !== ($id_based = (int) Tools::getValue('based_on'))) {
$base_theme = new Theme($id_based);
$this->copyTheme($base_theme->directory, $new_dir);
$base_theme = new Theme((int) Tools::getValue('based_on'));
}
if (isset($_FILES['image_preview']) && $_FILES['image_preview']['error'] == 0) {
if (@getimagesize($_FILES['image_preview']['tmp_name']) && !ImageManager::validateUpload($_FILES['image_preview'], Tools::getMaxUploadSize())) {
move_uploaded_file($_FILES['image_preview']['tmp_name'], _PS_ALL_THEMES_DIR_ . $new_dir . '/preview.jpg');
} else {
$this->errors[] = $this->l('Image not valid');
$this->display = 'form';
return false;
}
}
}
$theme = parent::processAdd();
if ((int) $theme->product_per_page == 0) {
$theme->product_per_page = 1;
$theme->save();
}
if (is_object($theme) && (int) $theme->id > 0) {
$metas = Meta::getMetas();
foreach ($metas as &$meta) {
$meta['left'] = $theme->default_left_column;
$meta['right'] = $theme->default_right_column;
}
$theme->updateMetas($metas, true);
}
return $theme;
}
示例2: processAdd
/**
* @see AdminController::processAdd();
*/
public function processAdd()
{
if (Tools::isSubmit('submitAdd' . $this->table)) {
if (!($obj = $this->loadObject(true))) {
return;
}
$this->updateAddress();
// hack for enable the possibility to update a warehouse without recreate new id
$this->deleted = false;
return parent::processAdd();
}
}
示例3: processAdd
public function processAdd()
{
$new_dir = Tools::getValue('directory');
$res = true;
if ($new_dir != '') {
if (Validate::isDirName($new_dir) && !is_dir(_PS_ALL_THEMES_DIR_ . $new_dir)) {
$res &= mkdir(_PS_ALL_THEMES_DIR_ . $new_dir, Theme::$access_rights);
if ($res) {
$this->confirmations[] = $this->l('Directory successfully created');
}
}
if (0 !== ($id_based = (int) Tools::getValue('based_on'))) {
$base_theme = new Theme($id_based);
$res = $this->copyTheme($base_theme->directory, $new_dir);
$base_theme = new Theme((int) Tools::getValue('based_on'));
}
}
return parent::processAdd();
}
示例4: processAdd
public function processAdd()
{
if (Tools::getValue('submitFormAjax')) {
$this->redirect_after = false;
}
// Check that the new email is not already in use
$customer_email = strval(Tools::getValue('email'));
$customer = new Customer();
if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
}
if ($customer->id) {
$this->errors[] = Tools::displayError('An account already exists for this email address:') . ' ' . $customer_email;
$this->display = 'edit';
return $customer;
} elseif (trim(Tools::getValue('passwd')) == '') {
$this->validateRules();
$this->errors[] = Tools::displayError('Password can not be empty.');
$this->display = 'edit';
} elseif ($customer = parent::processAdd()) {
$this->context->smarty->assign('new_customer', $customer);
return $customer;
}
return false;
}
示例5: processAdd
/**
* Override processAdd to change SaveAndStay button action
* @see classes/AdminControllerCore::processUpdate()
*/
public function processAdd()
{
$object = parent::processAdd();
if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && !count($this->errors)) {
if ($this->display == 'add') {
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=&conf=3&update' . $this->table . '&token=' . $this->token;
} else {
$this->redirect_after = self::$currentIndex . '&id_attribute_group=' . (int) Tools::getValue('id_attribute_group') . '&conf=3&update' . $this->table . '&token=' . $this->token;
}
}
if (count($this->errors)) {
$this->setTypeAttribute();
}
return $object;
}
示例6: processAdd
public function processAdd()
{
if (Tools::getValue('submitFormAjax')) {
$this->redirect_after = false;
}
return parent::processAdd();
}
示例7: processAdd
public function processAdd()
{
// Enable the creation of quick links from the URL
$_POST = array_merge($_POST, $_GET);
return parent::processAdd();
}
示例8: processAdd
/**
* Override processAdd to change SaveAndStay button action
* @see classes/AdminControllerCore::processAdd()
*/
public function processAdd()
{
$object = parent::processAdd();
if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && !count($this->errors)) {
if ($this->table == 'feature_value' && ($this->display == 'edit' || $this->display == 'add')) {
$this->redirect_after = self::$currentIndex . '&addfeature_value&id_feature=' . (int) Tools::getValue('id_feature') . '&token=' . $this->token;
} else {
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=&conf=3&update' . $this->table . '&token=' . $this->token;
}
} elseif (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && count($this->errors)) {
$this->display = 'editFeatureValue';
}
return $object;
}
示例9: processAdd
/**
* Override processAdd to change SaveAndStay button action
* @see classes/AdminControllerCore::processUpdate()
*/
public function processAdd()
{
if ($this->table == 'attribute') {
/** @var AttributeGroup $object */
$object = new $this->className();
foreach (Language::getLanguages(false) as $language) {
if ($object->isAttribute((int) Tools::getValue('id_attribute_group'), Tools::getValue('name_' . $language['id_lang']), $language['id_lang'])) {
$this->errors['name_' . $language['id_lang']] = sprintf(Tools::displayError('The attribute value "%1$s" already exist for %2$s language'), Tools::getValue('name_' . $language['id_lang']), $language['name']);
}
}
if (!empty($this->errors)) {
return $object;
}
}
$object = parent::processAdd();
if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && !count($this->errors)) {
if ($this->display == 'add') {
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=&conf=3&update' . $this->table . '&token=' . $this->token;
} else {
$this->redirect_after = self::$currentIndex . '&id_attribute_group=' . (int) Tools::getValue('id_attribute_group') . '&conf=3&update' . $this->table . '&token=' . $this->token;
}
}
if (count($this->errors)) {
$this->setTypeAttribute();
}
return $object;
}
示例10: processAdd
public function processAdd()
{
if (Tools::getValue('submitFormAjax')) {
$this->redirect_after = false;
}
$confirmpayment = new TableConfirmPayment();
if ($confirmpayment->id) {
$this->errors[] = Tools::displayError('An account already exists for this email address:') . ' ' . $customer_email;
$this->display = 'edit';
return $confirmpayment;
} elseif ($confirmpayment = parent::processAdd()) {
$this->context->smarty->assign('new_confirmpayment', $confirmpayment);
return $confirmpayment;
}
return false;
}
示例11: processAdd
public function processAdd()
{
$object = $this->loadObject(true);
if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri'))) {
$this->errors[] = Tools::displayError('A shop URL that uses this domain already exists.');
}
if ($object->id && Tools::getValue('main')) {
$object->setMain();
}
if ($object->main && !Tools::getValue('main')) {
$this->errors[] = Tools::displayError('You cannot change a main URL to a non-main URL. You have to set another URL as your Main URL for the selected shop.');
}
if (($object->main || Tools::getValue('main')) && !Tools::getValue('active')) {
$this->errors[] = Tools::displayError('You cannot disable the Main URL.');
}
return parent::processAdd();
}
示例12: processAdd
/**
* Override processAdd to change SaveAndStay button action
* @see classes/AdminControllerCore::processAdd()
*/
public function processAdd()
{
$object = parent::processAdd();
if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && !count($this->errors)) {
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=&conf=3&update' . $this->table . '&token=' . $this->token;
} elseif (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && count($this->errors)) {
$this->display = 'editFeatureValue';
}
return $object;
}
示例13: processAdd
public function processAdd()
{
$object = $this->loadObject(true);
if ($object->id && Tools::getValue('main')) {
$object->setMain();
}
if ($object->main && !Tools::getValue('main')) {
$this->errors[] = Tools::displayError('You can\'t change a Main URL to a non-Main URL, you have to set another URL as Main URL for selected shop');
}
if (($object->main || Tools::getValue('main')) && !Tools::getValue('active')) {
$this->errors[] = Tools::displayError('You can\'t disable a Main URL');
}
return parent::processAdd();
}
示例14: processAdd
public function processAdd()
{
$id_category = (int) Tools::getValue('id_category');
$id_parent = (int) Tools::getValue('id_parent');
// if true, we are in a root category creation
if (!$id_parent) {
$_POST['is_root_category'] = $_POST['level_depth'] = 1;
$_POST['id_parent'] = $id_parent = (int) Configuration::get('PS_ROOT_CATEGORY');
}
if ($id_category) {
if ($id_category != $id_parent) {
if (!Category::checkBeforeMove($id_category, $id_parent)) {
$this->errors[] = $this->trans('The category cannot be moved here.', array(), 'Admin.Catalog.Notification');
}
} else {
$this->errors[] = $this->trans('The category cannot be a parent of itself.', array(), 'Admin.Catalog.Notification');
}
}
$object = parent::processAdd();
//if we create a you root category you have to associate to a shop before to add sub categories in. So we redirect to AdminCategories listing
if ($object && Tools::getValue('is_root_category')) {
Tools::redirectAdmin(self::$currentIndex . '&id_category=' . (int) Configuration::get('PS_ROOT_CATEGORY') . '&token=' . Tools::getAdminTokenLite('AdminCategories') . '&conf=3');
}
return $object;
}
示例15: processAdd
public function processAdd()
{
$id_category = (int) Tools::getValue('id_category');
$id_parent = (int) Tools::getValue('id_parent');
// if true, we are in a root category creation
if (!$id_parent && !Tools::isSubmit('is_root_category')) {
$_POST['is_root_category'] = $_POST['level_depth'] = $_POST['id_parent'] = $id_parent = 1;
}
if ($id_category) {
if ($id_category != $id_parent) {
if (!Category::checkBeforeMove($id_category, $id_parent)) {
$this->errors[] = Tools::displayError($this->l('Category cannot be moved here'));
}
} else {
$this->errors[] = Tools::displayError($this->l('Category cannot be parent of itself.'));
}
}
$object = parent::processAdd();
//if we create a you root category you have to associate to a shop before to add sub categories in. So we redirect to AdminCategories listing
if ($object && Tools::getValue('is_root_category')) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminCategories') . '&conf=3');
}
return $object;
}