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


PHP Language::getIDs方法代码示例

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


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

示例1: getPost

 /**
  * 0 no multi_lang
  * 1 multi_lang follow id_lang
  * 2 multi_lnag follow code_lang
  */
 public static function getPost($keys = array(), $multi_lang = 0)
 {
     $post = array();
     if ($multi_lang == 0) {
         foreach ($keys as $key) {
             // get value from $_POST
             $post[$key] = Tools::getValue($key);
         }
     } elseif ($multi_lang == 1) {
         foreach ($keys as $key) {
             // get value multi language from $_POST
             foreach (Language::getIDs(false) as $id_lang) {
                 $post[$key . '_' . (int) $id_lang] = Tools::getValue($key . '_' . (int) $id_lang);
             }
         }
     } elseif ($multi_lang == 2) {
         $languages = self::getLangAtt();
         foreach ($keys as $key) {
             // get value multi language from $_POST
             foreach ($languages as $id_code) {
                 $post[$key . '_' . $id_code] = Tools::getValue($key . '_' . $id_code);
             }
         }
     }
     return $post;
 }
开发者ID:pacxs,项目名称:pacxscom,代码行数:31,代码来源:LeomanagewidgetsHelper.php

示例2: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('saveConfiguration')) {
         $keys = LeoBlogHelper::getConfigKey(false);
         $post = array();
         foreach ($keys as $key) {
             # validate module
             $post[$key] = Tools::getValue($key);
         }
         $multi_lang_keys = LeoBlogHelper::getConfigKey(true);
         foreach ($multi_lang_keys as $multi_lang_key) {
             foreach (Language::getIDs(false) as $id_lang) {
                 $post[$multi_lang_key . '_' . (int) $id_lang] = Tools::getValue($multi_lang_key . '_' . (int) $id_lang);
             }
         }
         LeoBlogConfig::updateConfigValue('cfg_global', serialize($post));
     }
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:18,代码来源:AdminLeoblogDashboard.php

示例3: getPost

 public static function getPost($keys = array(), $lang = false)
 {
     $post = array();
     if ($lang === false) {
         foreach ($keys as $key) {
             // get value from $_POST
             $post[$key] = Tools::getValue($key);
         }
     }
     if ($lang === true) {
         foreach ($keys as $key) {
             // get value multi language from $_POST
             foreach (Language::getIDs(false) as $id_lang) {
                 $post[$key . '_' . (int) $id_lang] = Tools::getValue($key . '_' . (int) $id_lang);
             }
         }
     }
     return $post;
 }
开发者ID:pacxs,项目名称:pacxscom,代码行数:19,代码来源:Helper.php

示例4: copyFromPost

 /**
  * Copy datas from $_POST to object
  *
  * @param object &$object Object
  * @param string $table Object table
  */
 protected function copyFromPost(&$object, $table)
 {
     /* Classical fields */
     foreach ($_POST as $key => $value) {
         if (array_key_exists($key, $object) && $key != 'id_' . $table) {
             /* Do not take care of password field if empty */
             if ($key == 'passwd' && Tools::getValue('id_' . $table) && empty($value)) {
                 continue;
             }
             /* Automatically encrypt password in MD5 */
             if ($key == 'passwd' && !empty($value)) {
                 $value = Tools::encrypt($value);
             }
             $object->{$key} = $value;
         }
     }
     /* Multilingual fields */
     $rules = call_user_func(array(get_class($object), 'getValidationRules'), get_class($object));
     if (count($rules['validateLang'])) {
         $language_ids = Language::getIDs(false);
         foreach ($language_ids as $id_lang) {
             foreach (array_keys($rules['validateLang']) as $field) {
                 if (Tools::isSubmit($field . '_' . (int) $id_lang)) {
                     $object->{$field}[(int) $id_lang] = Tools::getValue($field . '_' . (int) $id_lang);
                 }
             }
         }
     }
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:35,代码来源:AdminTab.php

示例5: processImageLegends

 public function processImageLegends()
 {
     if (Tools::getValue('key_tab') == 'Images' && Tools::getValue('submitAddproductAndStay') == 'update_legends' && Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
         $id_image = (int) Tools::getValue('id_caption');
         $language_ids = Language::getIDs(false);
         foreach ($_POST as $key => $val) {
             if (preg_match('/^legend_([0-9]+)/i', $key, $match)) {
                 foreach ($language_ids as $id_lang) {
                     if ($val && $id_lang == $match[1]) {
                         Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'image_lang SET legend = "' . pSQL($val) . '" WHERE ' . ($id_image ? 'id_image = ' . (int) $id_image : 'EXISTS (SELECT 1 FROM ' . _DB_PREFIX_ . 'image WHERE ' . _DB_PREFIX_ . 'image.id_image = ' . _DB_PREFIX_ . 'image_lang.id_image AND id_product = ' . (int) $product->id . ')') . ' AND id_lang = ' . (int) $id_lang);
                     }
                 }
             }
         }
     }
 }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:16,代码来源:AdminProductsController.php

示例6: loadRoutes

    /**
     * Load default routes group by languages
     */
    protected function loadRoutes($id_shop = null)
    {
        $context = Context::getContext();
        // Load custom routes from modules
        $modules_routes = Hook::exec('moduleRoutes', array('id_shop' => $id_shop), null, true, false);
        if (is_array($modules_routes) && count($modules_routes)) {
            foreach ($modules_routes as $module_route) {
                if (is_array($module_route) && count($module_route)) {
                    foreach ($module_route as $route => $route_details) {
                        if (array_key_exists('controller', $route_details) && array_key_exists('rule', $route_details) && array_key_exists('keywords', $route_details) && array_key_exists('params', $route_details)) {
                            if (!isset($this->default_routes[$route])) {
                                $this->default_routes[$route] = array();
                            }
                            $this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details);
                        }
                    }
                }
            }
        }
        $language_ids = Language::getIDs();
        if (isset($context->language) && !in_array($context->language->id, $language_ids)) {
            $language_ids[] = (int) $context->language->id;
        }
        // Set default routes
        foreach ($language_ids as $id_lang) {
            foreach ($this->default_routes as $id => $route) {
                $this->addRoute($id, $route['rule'], $route['controller'], $id_lang, $route['keywords'], isset($route['params']) ? $route['params'] : array(), $id_shop);
            }
        }
        // Load the custom routes prior the defaults to avoid infinite loops
        if ($this->use_routes) {
            // Load routes from meta table
            $sql = 'SELECT m.page, ml.url_rewrite, ml.id_lang
					FROM `' . _DB_PREFIX_ . 'meta` m
					LEFT JOIN `' . _DB_PREFIX_ . 'meta_lang` ml ON (m.id_meta = ml.id_meta' . Shop::addSqlRestrictionOnLang('ml', $id_shop) . ')
					ORDER BY LENGTH(ml.url_rewrite) DESC';
            if ($results = Db::getInstance()->executeS($sql)) {
                foreach ($results as $row) {
                    if ($row['url_rewrite']) {
                        $this->addRoute($row['page'], $row['url_rewrite'], $row['page'], $row['id_lang'], array(), array(), $id_shop);
                    }
                }
            }
            // Set default empty route if no empty route (that's weird I know)
            if (!$this->empty_route) {
                $this->empty_route = array('routeID' => 'index', 'rule' => '', 'controller' => 'index');
            }
            // Load custom routes
            foreach ($this->default_routes as $route_id => $route_data) {
                if ($custom_route = Configuration::get('PS_ROUTE_' . $route_id, null, null, $id_shop)) {
                    if (isset($context->language) && !in_array($context->language->id, $language_ids)) {
                        $language_ids[] = (int) $context->language->id;
                    }
                    foreach ($language_ids as $id_lang) {
                        $this->addRoute($route_id, $custom_route, $route_data['controller'], $id_lang, $route_data['keywords'], isset($route_data['params']) ? $route_data['params'] : array(), $id_shop);
                    }
                }
            }
        }
    }
开发者ID:jpodracky,项目名称:dogs,代码行数:63,代码来源:Dispatcher.php

示例7: getTranslationsFields

 /**
  * @deprecated 1.5.0.1 (use getFieldsLang())
  * @param array $fields_array
  *
  * @return array
  * @throws PrestaShopException
  */
 protected function getTranslationsFields($fields_array)
 {
     $fields = array();
     if ($this->id_lang == null) {
         foreach (Language::getIDs(false) as $id_lang) {
             $this->makeTranslationFields($fields, $fields_array, $id_lang);
         }
     } else {
         $this->makeTranslationFields($fields, $fields_array, $this->id_lang);
     }
     return $fields;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:19,代码来源:ObjectModel.php

示例8: manageEntityDeclinatedImages

 protected function manageEntityDeclinatedImages($directory, $normal_image_sizes)
 {
     $normal_image_size_names = array();
     foreach ($normal_image_sizes as $normal_image_size) {
         $normal_image_size_names[] = $normal_image_size['name'];
     }
     // If id is detected
     $object_id = $this->wsObject->urlSegment[2];
     if (!Validate::isUnsignedId($object_id)) {
         throw new WebserviceException('The image id is invalid. Please set a valid id or the "default" value', array(60, 400));
     }
     // For the product case
     if ($this->imageType == 'products') {
         // Get available image ids
         $available_image_ids = array();
         // New Behavior
         foreach (Language::getIDs() as $id_lang) {
             foreach (Image::getImages($id_lang, $object_id) as $image) {
                 $available_image_ids[] = $image['id_image'];
             }
         }
         $available_image_ids = array_unique($available_image_ids, SORT_NUMERIC);
         // If an image id is specified
         if ($this->wsObject->urlSegment[3] != '') {
             if ($this->wsObject->urlSegment[3] == 'bin') {
                 $current_product = new Product($object_id);
                 $this->wsObject->urlSegment[3] = $current_product->getCoverWs();
             }
             if (!Validate::isUnsignedId($object_id) || !in_array($this->wsObject->urlSegment[3], $available_image_ids)) {
                 throw new WebserviceException('This image id does not exist', array(57, 400));
             } else {
                 // Check for new image system
                 $image_id = $this->wsObject->urlSegment[3];
                 $path = implode('/', str_split((string) $image_id));
                 $image_size = $this->wsObject->urlSegment[4];
                 if (file_exists($directory . $path . '/' . $image_id . (strlen($this->wsObject->urlSegment[4]) > 0 ? '-' . $this->wsObject->urlSegment[4] : '') . '.jpg')) {
                     $filename = $directory . $path . '/' . $image_id . (strlen($this->wsObject->urlSegment[4]) > 0 ? '-' . $this->wsObject->urlSegment[4] : '') . '.jpg';
                     $orig_filename = $directory . $path . '/' . $image_id . '.jpg';
                 } else {
                     // else old system or not exists
                     $orig_filename = $directory . $object_id . '-' . $image_id . '.jpg';
                     $filename = $directory . $object_id . '-' . $image_id . '-' . $image_size . '.jpg';
                 }
             }
         } elseif ($this->wsObject->method == 'GET' || $this->wsObject->method == 'HEAD') {
             if ($available_image_ids) {
                 $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $object_id));
                 foreach ($available_image_ids as $available_image_id) {
                     $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id' => $available_image_id, 'xlink_resource' => $this->wsObject->wsUrl . 'images/' . $this->imageType . '/' . $object_id . '/' . $available_image_id), false);
                 }
                 $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('image', array());
             } else {
                 $this->objOutput->setStatus(404);
                 $this->wsObject->setOutputEnabled(false);
             }
         }
     } else {
         $orig_filename = $directory . $object_id . '.jpg';
         $image_size = $this->wsObject->urlSegment[3];
         $filename = $directory . $object_id . '-' . $image_size . '.jpg';
     }
     // in case of declinated images list of a product is get
     if ($this->output != '') {
         return true;
     } elseif (isset($image_size) && $image_size != '') {
         // Check the given size
         if ($this->imageType == 'products' && $image_size == 'bin') {
             $filename = $directory . $object_id . '-' . $image_id . '.jpg';
         } elseif (!in_array($image_size, $normal_image_size_names)) {
             $exception = new WebserviceException('This image size does not exist', array(58, 400));
             throw $exception->setDidYouMean($image_size, $normal_image_size_names);
         }
         if (!file_exists($filename)) {
             throw new WebserviceException('This image does not exist on disk', array(59, 500));
         }
         // Display the resized specific image
         $this->imgToDisplay = $filename;
         return true;
     } elseif (isset($orig_filename)) {
         $orig_filename_exists = file_exists($orig_filename);
         return $this->manageDeclinatedImagesCRUD($orig_filename_exists, $orig_filename, $normal_image_sizes, $directory);
     } else {
         return $this->manageDeclinatedImagesCRUD(false, '', $normal_image_sizes, $directory);
     }
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:85,代码来源:WebserviceSpecificManagementImages.php

示例9: getWSProductName

 /**
  * Webservice : getter for the product name
  */
 public function getWSProductName()
 {
     $res = array();
     foreach (Language::getIDs(true) as $id_lang) {
         $res[$id_lang] = Product::getProductName($this->id_product, $this->id_product_attribute, $id_lang);
     }
     return $res;
 }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:11,代码来源:StockMvtWS.php

示例10: copyFromPost

 /**
  * Copy data values from $_POST to object
  *
  * @param ObjectModel &$object Object
  * @param string $table Object table
  */
 protected function copyFromPost(&$object, $table)
 {
     /* Classical fields */
     foreach ($_POST as $key => $value) {
         if (array_key_exists($key, $object) && $key != 'id_' . $table) {
             /* Do not take care of password field if empty */
             if ($key == 'passwd' && Tools::getValue('id_' . $table) && empty($value)) {
                 continue;
             }
             /* Automatically encrypt password in MD5 */
             if ($key == 'passwd' && !empty($value)) {
                 $value = Tools::encrypt($value);
             }
             $object->{$key} = $value;
         }
     }
     /* Multilingual fields */
     $class_vars = get_class_vars(get_class($object));
     $fields = array();
     if (isset($class_vars['definition']['fields'])) {
         $fields = $class_vars['definition']['fields'];
     }
     foreach ($fields as $field => $params) {
         if (array_key_exists('lang', $params) && $params['lang']) {
             foreach (Language::getIDs(false) as $id_lang) {
                 if (Tools::isSubmit($field . '_' . (int) $id_lang)) {
                     $object->{$field}[(int) $id_lang] = Tools::getValue($field . '_' . (int) $id_lang);
                 }
             }
         }
     }
 }
开发者ID:pixiefrog,项目名称:PrestaShop,代码行数:38,代码来源:AdminController.php

示例11: postProcess


//.........这里部分代码省略.........
                     } else {
                         $amount += $shipping_cost_amount;
                     }
                 }
                 $order_carrier = new OrderCarrier((int) $order->getIdOrderCarrier());
                 if (Validate::isLoadedObject($order_carrier)) {
                     $order_carrier->weight = (double) $order->getTotalWeight();
                     if ($order_carrier->update()) {
                         $order->weight = sprintf("%.3f " . Configuration::get('PS_WEIGHT_UNIT'), $order_carrier->weight);
                     }
                 }
                 if ($amount >= 0) {
                     if (!OrderSlip::create($order, $order_detail_list, $shipping_cost_amount, $voucher, $choosen, Tools::getValue('TaxMethod') ? false : true)) {
                         $this->errors[] = Tools::displayError('You cannot generate a partial credit slip.');
                     } else {
                         Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $order_detail_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop);
                         $customer = new Customer((int) $order->id_customer);
                         $params['{lastname}'] = $customer->lastname;
                         $params['{firstname}'] = $customer->firstname;
                         $params['{id_order}'] = $order->id;
                         $params['{order_name}'] = $order->getUniqReference();
                         @Mail::Send((int) $order->id_lang, 'credit_slip', Mail::l('New credit slip regarding your order', (int) $order->id_lang), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int) $order->id_shop);
                     }
                     foreach ($order_detail_list as &$product) {
                         $order_detail = new OrderDetail((int) $product['id_order_detail']);
                         if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                             StockAvailable::synchronize($order_detail->product_id);
                         }
                     }
                     // Generate voucher
                     if (Tools::isSubmit('generateDiscountRefund') && !count($this->errors) && $amount > 0) {
                         $cart_rule = new CartRule();
                         $cart_rule->description = sprintf($this->l('Credit slip for order #%d'), $order->id);
                         $language_ids = Language::getIDs(false);
                         foreach ($language_ids as $id_lang) {
                             // Define a temporary name
                             $cart_rule->name[$id_lang] = sprintf('V0C%1$dO%2$d', $order->id_customer, $order->id);
                         }
                         // Define a temporary code
                         $cart_rule->code = sprintf('V0C%1$dO%2$d', $order->id_customer, $order->id);
                         $cart_rule->quantity = 1;
                         $cart_rule->quantity_per_user = 1;
                         // Specific to the customer
                         $cart_rule->id_customer = $order->id_customer;
                         $now = time();
                         $cart_rule->date_from = date('Y-m-d H:i:s', $now);
                         $cart_rule->date_to = date('Y-m-d H:i:s', strtotime('+1 year'));
                         $cart_rule->partial_use = 1;
                         $cart_rule->active = 1;
                         $cart_rule->reduction_amount = $amount;
                         $cart_rule->reduction_tax = true;
                         $cart_rule->minimum_amount_currency = $order->id_currency;
                         $cart_rule->reduction_currency = $order->id_currency;
                         if (!$cart_rule->add()) {
                             $this->errors[] = Tools::displayError('You cannot generate a voucher.');
                         } else {
                             // Update the voucher code and name
                             foreach ($language_ids as $id_lang) {
                                 $cart_rule->name[$id_lang] = sprintf('V%1$dC%2$dO%3$d', $cart_rule->id, $order->id_customer, $order->id);
                             }
                             $cart_rule->code = sprintf('V%1$dC%2$dO%3$d', $cart_rule->id, $order->id_customer, $order->id);
                             if (!$cart_rule->update()) {
                                 $this->errors[] = Tools::displayError('You cannot generate a voucher.');
                             } else {
                                 $currency = $this->context->currency;
                                 $customer = new Customer((int) $order->id_customer);
开发者ID:ekachandrasetiawan,项目名称:BeltcareCom,代码行数:67,代码来源:AdminOrdersController.php

示例12: createOrderDiscount

 /**
  * @deprecated 1.5.0.1
  * @param Order $order
  * @return Discount
  */
 public static function createOrderDiscount($order, $productList, $qtyList, $name, $shipping_cost = false, $id_category = 0, $subcategory = 0)
 {
     $products = $order->getProducts(false, $productList, $qtyList);
     // Totals are stored in the order currency (or at least should be)
     $total = $order->getTotalProductsWithTaxes($products);
     $discounts = $order->getDiscounts(true);
     $total_tmp = $total;
     foreach ($discounts as $discount) {
         if ($discount['id_discount_type'] == Discount::PERCENT) {
             $total -= $total_tmp * ($discount['value'] / 100);
         } elseif ($discount['id_discount_type'] == Discount::AMOUNT) {
             $total -= $discount['value'] * ($total_tmp / $order->total_products_wt);
         }
     }
     if ($shipping_cost) {
         $total += $order->total_shipping;
     }
     // create discount
     $voucher = new Discount();
     $voucher->id_discount_type = Discount::AMOUNT;
     foreach (Language::getIDs((bool) $order) as $id_lang) {
         $voucher->description[$id_lang] = strval($name) . (int) $order->id;
     }
     $voucher->value = (double) $total;
     $voucher->name = 'V0C' . (int) $order->id_customer . 'O' . (int) $order->id;
     $voucher->id_customer = (int) $order->id_customer;
     $voucher->id_currency = (int) $order->id_currency;
     $voucher->quantity = 1;
     $voucher->quantity_per_user = 1;
     $voucher->cumulable = 1;
     $voucher->cumulable_reduction = 1;
     $voucher->minimal = (double) $voucher->value;
     $voucher->active = 1;
     $voucher->cart_display = 1;
     $now = time();
     $voucher->date_from = date('Y-m-d H:i:s', $now);
     $voucher->date_to = date('Y-m-d H:i:s', $now + 3600 * 24 * 365.25);
     /* 1 year */
     if (!$voucher->validateFieldsLang(false) || !$voucher->add()) {
         return false;
     }
     // set correct name
     $voucher->name = 'V' . (int) $voucher->id . 'C' . (int) $order->id_customer . 'O' . $order->id;
     if (!$voucher->update()) {
         return false;
     }
     return $voucher;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:53,代码来源:Discount.php

示例13: is_array

 $product->id_shop_default = (int) Configuration::get('PS_SHOP_DEFAULT');
 //price
 $product->price = $prd['price'] ? $prd['price'] : 0;
 //Category
 //Qte
 $link_rewrite = is_array($product->link_rewrite) && isset($product->link_rewrite[$id_lang]) ? trim($product->link_rewrite[$id_lang]) : '';
 $valid_link = Validate::isLinkRewrite($link_rewrite);
 if (isset($product->link_rewrite[$id_lang]) && empty($product->link_rewrite[$id_lang]) || !$valid_link) {
     $link_rewrite = Tools::link_rewrite($product->name[$id_lang]);
     if ($link_rewrite == '') {
         $link_rewrite = 'friendly-url-autogeneration-failed';
     }
 }
 if (!(is_array($product->link_rewrite) && count($product->link_rewrite) && !empty($product->link_rewrite[$id_lang]))) {
     $res = array();
     foreach (Language::getIDs(false) as $id_lang) {
         $res[$id_lang] = $link_rewrite;
     }
     $product->link_rewrite = $res;
 }
 if ($product->save()) {
     $id_image = array();
     //delete existing images if "delete_existing_images" is set to 1
     $multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator : ',';
     if (isset($prd['images']) && $prd['images']) {
         $image_url = explode('/', $prd['images']);
         $url = _PS_IMG_MGT_DIR_ . end($image_url);
         $product_has_images = (bool) Image::getImages($id_lang, $product->id);
         $image = new Image();
         $image->id_product = (int) $product->id;
         $image->position = Image::getHighestPosition($product->id) + 1;
开发者ID:abdoumej,项目名称:libsamy,代码行数:31,代码来源:import.php

示例14: createMultiLangField

 protected static function createMultiLangField($field)
 {
     $res = array();
     foreach (Language::getIDs(false) as $id_lang) {
         $res[$id_lang] = $field;
     }
     return $res;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:8,代码来源:AdminImportController.php

示例15: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit($this->table . 'Orderby') || Tools::isSubmit($this->table . 'Orderway')) {
         $this->filter = true;
     }
     if (Tools::isSubmit('submitAddorder_return_state')) {
         $id_order_return_state = Tools::getValue('id_order_return_state');
         // Create Object OrderReturnState
         $order_return_state = new OrderReturnState((int) $id_order_return_state);
         $order_return_state->color = Tools::getValue('color');
         $order_return_state->name = array();
         foreach (Language::getIDs(false) as $id_lang) {
             $order_return_state->name[$id_lang] = Tools::getValue('name_' . $id_lang);
         }
         // Update object
         if (!$order_return_state->save()) {
             $this->errors[] = Tools::displayError('An error has occurred: Can\'t save the current order\'s return status.');
         } else {
             Tools::redirectAdmin(self::$currentIndex . '&conf=4&token=' . $this->token);
         }
     }
     if (Tools::isSubmit('submitBulkdeleteorder_return_state')) {
         $this->className = 'OrderReturnState';
         $this->table = 'order_return_state';
         $this->boxes = Tools::getValue('order_return_stateBox');
         parent::processBulkDelete();
     }
     if (Tools::isSubmit('deleteorder_return_state')) {
         $id_order_return_state = Tools::getValue('id_order_return_state');
         // Create Object OrderReturnState
         $order_return_state = new OrderReturnState((int) $id_order_return_state);
         if (!$order_return_state->delete()) {
             $this->errors[] = Tools::displayError('An error has occurred: Can\'t delete the current order\'s return status.');
         } else {
             Tools::redirectAdmin(self::$currentIndex . '&conf=1&token=' . $this->token);
         }
     }
     if (Tools::isSubmit('submitAdd' . $this->table)) {
         $this->deleted = false;
         // Disabling saving historisation
         $_POST['invoice'] = (int) Tools::getValue('invoice_on');
         $_POST['logable'] = (int) Tools::getValue('logable_on');
         $_POST['send_email'] = (int) Tools::getValue('send_email_on');
         $_POST['hidden'] = (int) Tools::getValue('hidden_on');
         $_POST['shipped'] = (int) Tools::getValue('shipped_on');
         $_POST['paid'] = (int) Tools::getValue('paid_on');
         $_POST['delivery'] = (int) Tools::getValue('delivery_on');
         $_POST['pdf_delivery'] = (int) Tools::getValue('pdf_delivery_on');
         $_POST['pdf_invoice'] = (int) Tools::getValue('pdf_invoice_on');
         if (!$_POST['send_email']) {
             foreach (Language::getIDs(false) as $id_lang) {
                 $_POST['template_' . $id_lang] = '';
             }
         }
         return parent::postProcess();
     } elseif (Tools::isSubmit('delete' . $this->table)) {
         $order_state = new OrderState(Tools::getValue('id_order_state'), $this->context->language->id);
         if (!$order_state->isRemovable()) {
             $this->errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
         } else {
             return parent::postProcess();
         }
     } elseif (Tools::isSubmit('submitBulkdelete' . $this->table)) {
         foreach (Tools::getValue($this->table . 'Box') as $selection) {
             $order_state = new OrderState((int) $selection, $this->context->language->id);
             if (!$order_state->isRemovable()) {
                 $this->errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
                 break;
             }
         }
         if (!count($this->errors)) {
             return parent::postProcess();
         }
     } else {
         return parent::postProcess();
     }
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:77,代码来源:AdminStatusesController.php


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