当前位置: 首页>>代码示例>>PHP>>正文


PHP AdminController::processAdd方法代码示例

本文整理汇总了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;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:44,代码来源:AdminThemesController.php

示例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();
     }
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:15,代码来源:AdminWarehousesController.php

示例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();
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:19,代码来源:AdminThemesController.php

示例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;
 }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:25,代码来源:AdminCustomersController.php

示例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;
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:19,代码来源:AdminAttributesGroupsController.php

示例6: processAdd

 public function processAdd()
 {
     if (Tools::getValue('submitFormAjax')) {
         $this->redirect_after = false;
     }
     return parent::processAdd();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:7,代码来源:AdminAddressesController.php

示例7: processAdd

 public function processAdd()
 {
     // Enable the creation of quick links from the URL
     $_POST = array_merge($_POST, $_GET);
     return parent::processAdd();
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:6,代码来源:AdminQuickAccessesController.php

示例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;
 }
开发者ID:retallicka,项目名称:PrestaShop,代码行数:18,代码来源:AdminFeaturesController.php

示例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;
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:31,代码来源:AdminAttributesGroupsController.php

示例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;
 }
开发者ID:ekachandrasetiawan,项目名称:SupraShop,代码行数:16,代码来源:AdminConfirmPaymentController.php

示例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();
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:17,代码来源:AdminShopUrlController.php

示例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;
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:14,代码来源:AdminFeaturesController.php

示例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();
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:14,代码来源:AdminShopUrlController.php

示例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;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:25,代码来源:AdminCategoriesController.php

示例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;
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:24,代码来源:AdminCategoriesController.php


注:本文中的AdminController::processAdd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。