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


PHP AdminController::processSave方法代码示例

本文整理汇总了PHP中AdminController::processSave方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminController::processSave方法的具体用法?PHP AdminController::processSave怎么用?PHP AdminController::processSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AdminController的用法示例。


在下文中一共展示了AdminController::processSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processSave

 public function processSave()
 {
     parent::processSave();
     if (Tools::isSubmit('submitAddaddress')) {
         $this->display = 'editaddresses';
     }
 }
开发者ID:carloslastresDev,项目名称:HealthyTaiwan_UsingPrestaShop,代码行数:7,代码来源:AdminManufacturersController.php

示例2: processSave

 public function processSave()
 {
     if (!$this->validateDiscount(Tools::getValue('reduction'))) {
         $this->errors[] = Tools::displayError('The discount value is incorrect (must be a percentage).');
     } else {
         $this->updateCategoryReduction();
         $object = parent::processSave();
         $this->updateRestrictions();
         return $object;
     }
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:11,代码来源:AdminGroupsController.php

示例3: processSave

 public function processSave()
 {
     $employee = new Employee((int) Tools::getValue('id_employee'));
     // If the employee is editing its own account
     if ($this->restrict_edition) {
         $current_password = trim(Tools::getValue('old_passwd'));
         if (Tools::getValue('passwd') && (empty($current_password) || !Validate::isPasswdAdmin($current_password) || !$employee->getByEmail($employee->email, $current_password))) {
             $this->errors[] = Tools::displayError('Your current password is invalid.');
         } elseif (Tools::getValue('passwd') && (!Tools::getValue('passwd2') || Tools::getValue('passwd') !== Tools::getValue('passwd2'))) {
             $this->errors[] = Tools::displayError('The confirmation password does not match.');
         }
         $_POST['id_profile'] = $_GET['id_profile'] = $employee->id_profile;
         $_POST['active'] = $_GET['active'] = $employee->active;
         // Unset set shops
         foreach ($_POST as $postkey => $postvalue) {
             if (strstr($postkey, 'checkBoxShopAsso_' . $this->table) !== false) {
                 unset($_POST[$postkey]);
             }
         }
         foreach ($_GET as $postkey => $postvalue) {
             if (strstr($postkey, 'checkBoxShopAsso_' . $this->table) !== false) {
                 unset($_GET[$postkey]);
             }
         }
         // Add current shops associated to the employee
         $result = Shop::getShopById((int) $employee->id, $this->identifier, $this->table);
         foreach ($result as $row) {
             $key = 'checkBoxShopAsso_' . $this->table;
             if (!isset($_POST[$key])) {
                 $_POST[$key] = array();
             }
             if (!isset($_GET[$key])) {
                 $_GET[$key] = array();
             }
             $_POST[$key][$row['id_shop']] = 1;
             $_GET[$key][$row['id_shop']] = 1;
         }
     } else {
         $_POST['id_last_order'] = $employee->getLastElementsForNotify('order');
         $_POST['id_last_customer_message'] = $employee->getLastElementsForNotify('customer_message');
         $_POST['id_last_customer'] = $employee->getLastElementsForNotify('customer');
     }
     //if profile is super admin, manually fill checkBoxShopAsso_employee because in the form they are disabled.
     if ($_POST['id_profile'] == _PS_ADMIN_PROFILE_) {
         $result = Db::getInstance()->executeS('SELECT id_shop FROM ' . _DB_PREFIX_ . 'shop');
         foreach ($result as $row) {
             $key = 'checkBoxShopAsso_' . $this->table;
             if (!isset($_POST[$key])) {
                 $_POST[$key] = array();
             }
             if (!isset($_GET[$key])) {
                 $_GET[$key] = array();
             }
             $_POST[$key][$row['id_shop']] = 1;
             $_GET[$key][$row['id_shop']] = 1;
         }
     }
     if ($employee->isLastAdmin()) {
         if (Tools::getValue('id_profile') != (int) _PS_ADMIN_PROFILE_) {
             $this->errors[] = Tools::displayError('You should have at least one employee in the administrator group.');
             return false;
         }
         if (Tools::getvalue('active') == 0) {
             $this->errors[] = Tools::displayError('You cannot disable or delete the administrator account.');
             return false;
         }
     }
     if (Tools::getValue('bo_theme_css')) {
         $bo_theme = explode('|', Tools::getValue('bo_theme_css'));
         $_POST['bo_theme'] = $bo_theme[0];
         if (!in_array($bo_theme[0], scandir(_PS_ADMIN_DIR_ . DIRECTORY_SEPARATOR . 'themes'))) {
             $this->errors[] = Tools::displayError('Invalid theme');
             return false;
         }
         if (isset($bo_theme[1])) {
             $_POST['bo_css'] = $bo_theme[1];
         }
     }
     $assos = $this->getSelectedAssoShop($this->table);
     if (!$assos && ($this->table = 'employee')) {
         if (Shop::isFeatureActive() && _PS_ADMIN_PROFILE_ != $_POST['id_profile']) {
             $this->errors[] = Tools::displayError('The employee must be associated with at least one shop.');
         }
     }
     if (count($this->errors)) {
         return false;
     }
     return parent::processSave();
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:89,代码来源:AdminEmployeesController.php

示例4: processSave

 public function processSave()
 {
     $_POST['price'] = Tools::getValue('leave_bprice_on') ? '-1' : Tools::getValue('price');
     if (Validate::isLoadedObject($object = parent::processSave())) {
         $object->deleteConditions();
         foreach ($_POST as $key => $values) {
             if (preg_match('/^condition_group_([0-9]+)$/Ui', $key, $condition_group)) {
                 $conditions = array();
                 foreach ($values as $value) {
                     $condition = explode('_', $value);
                     $conditions[] = array('type' => $condition[0], 'value' => $condition[1]);
                 }
                 $object->addConditions($conditions);
             }
         }
         $object->apply();
         return $object;
     }
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:19,代码来源:AdminSpecificPriceRuleController.php

示例5: processSave

 public function processSave()
 {
     /** @var ShopUrl $object */
     $object = $this->loadObject(true);
     if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri'))) {
         $this->errors[] = $this->trans('A shop URL that uses this domain already exists.', array(), 'Admin.Notifications.Error');
     }
     $unallowed = str_replace('/', '', Tools::getValue('virtual_uri'));
     if ($unallowed == 'c' || $unallowed == 'img' || is_numeric($unallowed)) {
         $this->errors[] = $this->trans('A shop virtual URL cannot be "%URL%"', array('%URL%' => $unallowed), 'Admin.Notifications.Error');
     }
     $return = parent::processSave();
     if (!$this->errors) {
         Tools::generateHtaccess();
         Tools::clearSmartyCache();
         Media::clearCache();
     }
     return $return;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:19,代码来源:AdminShopUrlController.php

示例6: processSave

 public function processSave()
 {
     // Check that default group is selected
     if (!is_array(Tools::getValue('groupBox')) || !in_array(Tools::getValue('id_default_group'), Tools::getValue('groupBox'))) {
         $this->errors[] = Tools::displayError('A default customer group must be selected in group box.');
     }
     // Check the requires fields which are settings in the BO
     $customer = new Customer();
     $this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase());
     return parent::processSave();
 }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:11,代码来源:AdminCustomersController.php

示例7: processSave

    /**
     * Call the right method for creating or updating object
     *
     * @return mixed
     */
    public function processSave()
    {
        if ($this->table == 'feature') {
            $id_feature = (int) Tools::getValue('id_feature');
            // Adding last position to the feature if not exist
            if ($id_feature <= 0) {
                $sql = 'SELECT `position`+1
						FROM `' . _DB_PREFIX_ . 'feature`
						ORDER BY position DESC';
                // set the position of the new feature in $_POST for postProcess() method
                $_POST['position'] = DB::getInstance()->getValue($sql);
            }
            // clean \n\r characters
            foreach ($_POST as $key => $value) {
                if (preg_match('/^name_/Ui', $key)) {
                    $_POST[$key] = str_replace('\\n', '', str_replace('\\r', '', $value));
                }
            }
        }
        return parent::processSave();
    }
开发者ID:retallicka,项目名称:PrestaShop,代码行数:26,代码来源:AdminFeaturesController.php

示例8: processSave

    /**
     * Call the right method for creating or updating object
     *
     * @return mixed
     */
    public function processSave()
    {
        if ($this->table == 'feature') {
            $id_feature = (int) Tools::getValue('id_feature');
            // Adding last position to the feature if not exist
            if ($id_feature <= 0) {
                $sql = 'SELECT `position`+1
						FROM `' . _DB_PREFIX_ . 'feature`
						ORDER BY position DESC';
                // set the position of the new feature in $_POST for postProcess() method
                $_POST['position'] = DB::getInstance()->getValue($sql);
            }
            // clean \n\r characters
            foreach ($_POST as $key => $value) {
                if (preg_match('/^name_/Ui', $key)) {
                    $_POST[$key] = str_replace('\\n', '', str_replace('\\r', '', $value));
                }
            }
            //by webkul to save image of feature with feature name
            $obj_feature = parent::processSave();
            $feature_values = FeatureValue::getFeatureValuesWithLang(1, $obj_feature->id);
            if ($feature_values) {
                $obj_feature_value = new FeatureValue($feature_values[0]['id_feature_value']);
            } else {
                $obj_feature_value = new FeatureValue();
            }
            //validate feature image
            if (isset($_FILES['logo'])) {
                $this->validAddFeatureImage($_FILES['logo']);
            }
            $img_path = _PS_IMG_DIR_ . 'rf/' . $obj_feature->id . '.png';
            if (isset($_FILES['logo'])) {
                $current_file = _PS_TMP_IMG_DIR_ . 'feature_mini_' . $obj_feature->id . '_' . $this->context->shop->id . '.png';
                if (file_exists($current_file)) {
                    unlink($current_file);
                }
                $this->uploadFeatureImage($_FILES['logo'], $img_path);
            }
            $obj_feature_value->id_feature = $obj_feature->id;
            foreach (Language::getLanguages(true) as $lang) {
                $obj_feature_value->value[$lang['id_lang']] = $obj_feature->id . '.png';
            }
            $obj_feature_value->save();
        }
        return $obj_feature;
    }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:51,代码来源:AdminFeaturesController.php

示例9: processSave

 public function processSave()
 {
     if (!$this->id_object) {
         $tmp_addr_format = new AddressFormat();
     } else {
         $tmp_addr_format = new AddressFormat($this->id_object);
     }
     $tmp_addr_format->format = Tools::getValue('address_layout');
     if (!$tmp_addr_format->checkFormatFields()) {
         $error_list = $tmp_addr_format->getErrorList();
         foreach ($error_list as $num_error => $error) {
             $this->errors[] = $error;
         }
     }
     if (strlen($tmp_addr_format->format) <= 0) {
         $this->errors[] = $this->l('Address format invalid');
     }
     $country = parent::processSave();
     if (!count($this->errors)) {
         if (is_null($tmp_addr_format->id_country)) {
             $tmp_addr_format->id_country = $country->id;
         }
         if (!$tmp_addr_format->save()) {
             $this->errors[] = Tools::displayError('Invalid address layout ' . Db::getInstance()->getMsgError());
         }
     }
     return $country;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:28,代码来源:AdminCountriesController.php

示例10: processSave

 public function processSave()
 {
     $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.');
     }
     $return = parent::processSave();
     if (!$this->errors) {
         Tools::generateHtaccess();
     }
     return $return;
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:12,代码来源:AdminShopUrlController.php

示例11: processSave

 public function processSave()
 {
     $confirmpayment = new TableConfirmPayment();
     $this->errors = array_merge($this->errors, $confirmpayment->validateFieldsRequiredDatabase());
     return parent::processSave();
 }
开发者ID:ekachandrasetiawan,项目名称:SupraShop,代码行数:6,代码来源:AdminConfirmPaymentController.php

示例12: processSave

 public function processSave()
 {
     if (!$this->validateDiscount(Tools::getValue('reduction'))) {
         $this->errors[] = $this->trans('The discount value is incorrect (must be a percentage).', array(), 'Admin.Parameters.Notification');
     } else {
         $this->updateCategoryReduction();
         $object = parent::processSave();
         $this->updateRestrictions();
         return $object;
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:11,代码来源:AdminGroupsController.php

示例13: processSave

 public function processSave()
 {
     $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 (str_replace('/', '', Tools::getValue('virtual_uri')) == 'c') {
         $this->errors[] = Tools::displayError('A shop virtual URL can not be "/c/", because "/c/" is the virtual url prefix for category images.');
     }
     $return = parent::processSave();
     if (!$this->errors) {
         Tools::generateHtaccess();
         Tools::clearSmartyCache();
         Media::clearCache();
     }
     return $return;
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:17,代码来源:AdminShopUrlController.php

示例14: processSave

 public function processSave()
 {
     if (!count($this->errors)) {
         $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()) {
                 $address_format_result = $tmp_addr_format->save();
             } else {
                 $error_list = $tmp_addr_format->getErrorList();
                 foreach ($error_list as $num_error => $error) {
                     $this->errors[] = $error;
                 }
             }
             if (!isset($address_format_result) || !$address_format_result) {
                 $this->errors[] = Tools::displayError('Invalid address layout ' . Db::getInstance()->getMsgError());
             }
         }
         unset($tmp_addr_format);
     }
     return parent::processSave();
 }
开发者ID:AmineBENCHEIKHBRAHIM,项目名称:LnsTech-Prestashop-WebSite,代码行数:29,代码来源:AdminCountriesController.php

示例15: processSave

 public function processSave()
 {
     $id = Tools::getValue('block_identifier');
     if (Validate::isModuleName($id)) {
         return parent::processSave();
     }
     $this->errors[] = Tools::displayError('The field "block_identifier" is invalid. Allowed characters:') . ' a-z, A-Z, 0-9, _';
     $this->display = 'edit';
     return FALSE;
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:10,代码来源:AdminStaticBlocks.php


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