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


PHP lang_get_all函数代码示例

本文整理汇总了PHP中lang_get_all函数的典型用法代码示例。如果您正苦于以下问题:PHP lang_get_all函数的具体用法?PHP lang_get_all怎么用?PHP lang_get_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_languages

 public function get_languages()
 {
     $records = array();
     foreach (lang_get_all() as $l) {
         $records[] = array('id' => $l['id'], 'text' => $l['name']);
     }
     return array(EXT_JSON_READER_ROOT => $records);
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:8,代码来源:reports_products.php

示例2: save

 /**
  * Save the manufacturer
  *
  * @access public
  * @param $id
  * @param $data
  * @return boolean
  */
 public function save($id = NULL, $data)
 {
     $this->load->library('upload');
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //editing or adding the manufacturer
     if (is_numeric($id)) {
         $this->db->update('manufacturers', array('manufacturers_name' => $data['name'], 'last_modified' => date('Y-m-d H:i:s')), array('manufacturers_id' => $id));
     } else {
         $this->db->insert('manufacturers', array('manufacturers_name' => $data['name'], 'date_added' => date('Y-m-d H:i:s')));
     }
     //check transaction status and then upload the manufacturer image
     if ($this->db->trans_status() === TRUE) {
         $manufacturers_id = $id ? $id : $this->db->insert_id();
         $config['upload_path'] = ROOTPATH . 'images/manufacturers/';
         $config['allowed_types'] = 'gif|jpg|png';
         $this->upload->initialize($config);
         if ($this->upload->do_upload($data['image'])) {
             $this->db->update('manufacturers', array('manufacturers_image' => $this->upload->data('file_name')), array('manufacturers_id' => $manufacturers_id));
             //check transaction status
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
             }
         }
     } else {
         $error = TRUE;
     }
     //process languages
     if ($error === FALSE) {
         foreach (lang_get_all() as $l) {
             $manufacturers_info = array('manufacturers_url' => $data['url'][$l['id']], 'manufacturers_friendly_url' => $data['friendly_url'][$l['id']], 'manufacturers_page_title' => $data['page_title'][$l['id']], 'manufacturers_meta_keywords' => $data['meta_keywords'][$l['id']], 'manufacturers_meta_description' => $data['meta_description'][$l['id']]);
             //editing or adding the manufacturer
             if (is_numeric($id)) {
                 $this->db->update('manufacturers_info', $manufacturers_info, array('manufacturers_id' => $manufacturers_id, 'languages_id' => $l['id']));
             } else {
                 $manufacturers_info['manufacturers_id'] = $manufacturers_id;
                 $manufacturers_info['languages_id'] = $l['id'];
                 $this->db->insert('manufacturers_info', $manufacturers_info);
             }
             //check transaction status
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
                 break;
             }
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:64,代码来源:manufacturers_model.php

示例3: save

 /**
  * Save slide image
  *
  * @access public
  * @param $id
  * @param $data
  * @return boolean
  */
 public function save($id = NULL, $data)
 {
     //load upload library
     $this->load->library('upload');
     $this->upload->initialize(array('upload_path' => ROOTPATH . 'images/', 'allowed_types' => 'gif|jpg|jpeg|png'));
     //start transaction
     $this->db->trans_start();
     if (is_numeric($id)) {
         foreach (lang_get_all() as $l) {
             $image_data = array('description' => $data['description'][$l['id']], 'image_url' => $data['image_url'][$l['id']], 'sort_order' => $data['sort_order'], 'group' => $data['group'], 'status' => $data['status']);
             //if new image is uploaded to override the old one
             if ($this->upload->do_upload('image' . $l['id'])) {
                 $file = $this->upload->data();
                 //delete image
                 $result = $this->db->select('image')->from('slide_images')->where(array('image_id' => $id, 'language_id' => $l['id']))->get();
                 if ($result->num_rows() > 0) {
                     $image = $result->row_array();
                     if (!empty($image)) {
                         @unlink($image_path . $image['image']);
                     }
                 }
                 //update image
                 $image_data['image'] = $file['file_name'];
             }
             $this->db->update('slide_images', $image_data, array('language_id' => $l['id'], 'image_id' => $id));
         }
     } else {
         //get insert image id
         $insert_id = 1;
         $result = $this->db->select_max('image_id')->get('slide_images');
         if ($result->num_rows() > 0) {
             $row = $result->row_array();
             $insert_id = $row['image_id'] + 1;
         }
         //insert image for each language
         foreach (lang_get_all() as $l) {
             if ($this->upload->do_upload('image' . $l['id'])) {
                 $image = $this->upload->data();
                 $this->db->insert('slide_images', array('image_id' => $insert_id, 'language_id' => $l['id'], 'description' => $data['description'][$l['id']], 'image' => $image['file_name'], 'image_url' => $data['image_url'][$l['id']], 'sort_order' => $data['sort_order'], 'group' => $data['group'], 'status' => $data['status']));
             }
         }
     }
     //complete transaction
     $this->db->trans_complete();
     //check transaction status
     if ($this->db->trans_status() === FALSE) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:58,代码来源:slide_images_model.php

示例4: save

 /**
  * Save the weight class
  *
  * @access public
  * @param $id
  * @param $data
  * @param $default
  * @return boolean
  */
 public function save($id = NULL, $data, $default = FALSE)
 {
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //editing or adding the weight class
     if (is_numeric($id)) {
         $weight_class_id = $id;
     } else {
         $result = $this->db->select_max('weight_class_id')->from('weight_classes')->get();
         $max_weight_class = $result->row_array();
         $result->free_result();
         $weight_class_id = $max_weight_class['weight_class_id'] + 1;
     }
     //languages
     foreach (lang_get_all() as $l) {
         //editing or adding the weight class
         if (is_numeric($id)) {
             $this->db->update('weight_classes', array('weight_class_key' => $data['key'][$l['id']], 'weight_class_title' => $data['name'][$l['id']]), array('weight_class_id' => $weight_class_id, 'language_id' => $l['id']));
         } else {
             $this->db->insert('weight_classes', array('weight_class_id' => $weight_class_id, 'language_id' => $l['id'], 'weight_class_key' => $data['key'][$l['id']], 'weight_class_title' => $data['name'][$l['id']]));
         }
         //check transaction status
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
             break;
         }
     }
     //process weiht class rules
     if ($error === FALSE) {
         //editing or adding the weight class
         if (is_numeric($id)) {
             $result = $this->db->select('weight_class_to_id')->from('weight_classes_rules')->where(array('weight_class_from_id' => $weight_class_id, 'weight_class_to_id !=' => $weight_class_id))->get();
             if ($result->num_rows() > 0) {
                 foreach ($result->result_array() as $rule) {
                     $this->db->update('weight_classes_rules', array('weight_class_rule' => $data['rules'][$rule['weight_class_to_id']]), array('weight_class_from_id' => $weight_class_id, 'weight_class_to_id' => $rule['weight_class_to_id']));
                     //check transaction status
                     if ($this->db->trans_status() === FALSE) {
                         $error = TRUE;
                         break;
                     }
                 }
             }
             $result->free_result();
         } else {
             $result = $this->db->select('weight_class_id')->from('weight_classes')->where(array('weight_class_id !=' => $weight_class_id, 'language_id' => lang_id()))->get();
             if ($result->num_rows() > 0) {
                 foreach ($result->result_array() as $class) {
                     $this->db->insert('weight_classes_rules', array('weight_class_from_id' => $class['weight_class_id'], 'weight_class_to_id' => $weight_class_id, 'weight_class_rule' => '1'));
                     //check transaction status
                     if ($this->db->trans_status() === FALSE) {
                         $error = TRUE;
                         break;
                     }
                     if ($error === FALSE) {
                         $this->db->insert('weight_classes_rules', array('weight_class_from_id' => $weight_class_id, 'weight_class_to_id' => $class['weight_class_id'], 'weight_class_rule' => $data['rules'][$class['weight_class_id']]));
                         //check transaction status
                         if ($this->db->trans_status() === FALSE) {
                             $error = TRUE;
                             break;
                         }
                     }
                 }
             }
             $result->free_result();
         }
     }
     //handle configuration
     if ($error === FALSE) {
         if ($default === TRUE) {
             $this->db->update('configuration', array('configuration_value' => $weight_class_id), array('configuration_key' => 'SHIPPING_WEIGHT_UNIT'));
             //check transaction status
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
             }
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:95,代码来源:weight_classes_model.php

示例5: get_data

 public function get_data($id)
 {
     $Qcategories = $this->db->get_where('categories', array('categories_id' => $id));
     $data = $Qcategories->row_array();
     $Qcategories->free_result();
     foreach (lang_get_all() as $l) {
         $Qcategories_descriptions = $this->db->select('categories_name, categories_url, categories_page_title, categories_meta_keywords, categories_meta_description')->from('categories_description')->where(array('categories_id' => $id, 'language_id' => $l['id']))->get();
         $description = $Qcategories_descriptions->row_array();
         $data['categories_name[' . $l['id'] . ']'] = $description['categories_name'];
         $data['page_title[' . $l['id'] . ']'] = $description['categories_page_title'];
         $data['meta_keywords[' . $l['id'] . ']'] = $description['categories_meta_keywords'];
         $data['meta_description[' . $l['id'] . ']'] = $description['categories_meta_description'];
         $data['categories_url[' . $l['id'] . ']'] = $description['categories_url'];
         $Qcategories_descriptions->free_result();
     }
     if (empty($data)) {
         return FALSE;
     }
     $data['childs_count'] = sizeof($this->category_tree->get_children($id, $dummy = array()));
     $data['products_count'] = $this->category_tree->get_number_of_products($id);
     $cPath = explode('_', $this->category_tree->get_full_cpath($id));
     array_pop($cPath);
     $data['parent_category_id'] = !empty($cPath) ? implode('_', $cPath) : 0;
     $Qcategories->free_result();
     return $data;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:26,代码来源:categories_model.php

示例6: save

 /**
  * Save the image group
  *
  * @access public
  * @param $id
  * @param $data
  * @param $default
  * @return boolean
  */
 public function save($id = NULL, $data, $default = FALSE)
 {
     //editing or adding the products images groups
     if (is_numeric($id)) {
         $group_id = $id;
     } else {
         $result = $this->db->select_max('id')->from('products_images_groups')->get();
         $group = $result->row_array();
         $group_id = $group['id'] + 1;
         $result->free_result();
     }
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //process languages
     foreach (lang_get_all() as $l) {
         $image_group = $data;
         $image_group['title'] = $data['title'][$l['id']];
         $image_group['force_size'] = $data['force_size'] === TRUE ? 1 : 0;
         if (is_numeric($id)) {
             $this->db->update('products_images_groups', $image_group, array('id' => $id, 'language_id' => $l['id']));
         } else {
             $image_group['id'] = $group_id;
             $image_group['language_id'] = $l['id'];
             $this->db->insert('products_images_groups', $image_group);
         }
         //check transaction status
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
             break;
         }
     }
     if ($error === FALSE) {
         //update the default image group
         if ($default === TRUE) {
             $this->db->update('configuration', array('configuration_value' => $group_id), array('configuration_key' => 'DEFAULT_IMAGE_GROUP_ID'));
             //check transaction status
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
             }
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:60,代码来源:image_groups_model.php

示例7: save

 /**
  * Save the quantity unit classes
  *
  * @access public
  * @param $id
  * @param $data
  * @param $default
  * @return boolean
  */
 public function save($id = NULL, $data, $default = FALSE)
 {
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //editing or adding the unit class
     if (is_numeric($id)) {
         $unit_class_id = $id;
     } else {
         $result = $this->db->select_max('quantity_unit_class_id')->from('quantity_unit_classes')->get();
         $max_unit = $result->row_array();
         $result->free_result();
         $unit_class_id = $max_unit['quantity_unit_class_id'] + 1;
     }
     //languages
     foreach (lang_get_all() as $l) {
         //editing or adding the unit class
         if (is_numeric($id)) {
             $this->db->update('quantity_unit_classes', array('quantity_unit_class_title' => $data['unit_class_title'][$l['id']]), array('quantity_unit_class_id' => $unit_class_id, 'language_id' => $l['id']));
         } else {
             $this->db->insert('quantity_unit_classes', array('quantity_unit_class_id' => $unit_class_id, 'language_id' => $l['id'], 'quantity_unit_class_title' => $data['unit_class_title'][$l['id']]));
         }
         //check transaction status
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
             break;
         }
     }
     if ($error === FALSE) {
         if ($default === TRUE) {
             $this->db->update('configuration', array('configuration_value' => $unit_class_id), array('configuration_key' => 'DEFAULT_UNIT_CLASSES'));
         }
         //check transaction status
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:55,代码来源:unit_classes_model.php

示例8: save

 /**
  * Insert or update an article category
  *
  * @access public
  * @param $id
  * @param $data
  * @return boolean
  */
 public function save($id = NULL, $data)
 {
     $category_id = '';
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //article category
     $article_category = array('articles_categories_order' => $data['articles_order'], 'articles_categories_status' => $data['status']);
     if (is_numeric($id)) {
         $this->db->update('articles_categories', $article_category, array('articles_categories_id' => $id));
     } else {
         $this->db->insert('articles_categories', $article_category);
     }
     if ($this->db->trans_status() === TRUE) {
         $articles_category_id = is_numeric($id) ? $id : $this->db->insert_id();
         //languages
         foreach (lang_get_all() as $l) {
             $articles_category_description = array('articles_categories_name' => $data['name'][$l['id']], 'articles_categories_url' => $data['url'][$l['id']] == '' ? $data['name'][$l['id']] : $data['url'][$l['id']], 'articles_categories_page_title' => $data['page_title'][$l['id']], 'articles_categories_meta_keywords' => $data['meta_keywords'][$l['id']], 'articles_categories_meta_description' => $data['meta_description'][$l['id']]);
             if (is_numeric($id)) {
                 $this->db->update('articles_categories_description', $articles_category_description, array('articles_categories_id' => $articles_category_id, 'language_id' => $l['id']));
             } else {
                 $articles_category_description['articles_categories_id'] = $articles_category_id;
                 $articles_category_description['language_id'] = $l['id'];
                 $this->db->insert('articles_categories_description', $articles_category_description);
             }
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
                 break;
             }
         }
     }
     if ($error === FALSE) {
         //commit transaction
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:48,代码来源:articles_categories_model.php

示例9: save

 public function save($id = NULL, $data)
 {
     $this->db->trans_begin();
     //products
     $products_data = array('products_type' => $data['products_type'], 'products_sku' => $data['products_sku'], 'products_model' => $data['products_model'], 'products_price' => $data['price'], 'products_quantity' => $data['quantity'], 'products_moq' => $data['products_moq'], 'products_max_order_quantity' => $data['products_max_order_quantity'], 'order_increment' => $data['order_increment'], 'products_weight' => $data['weight'], 'products_weight_class' => $data['weight_class'], 'products_status' => $data['status'], 'products_tax_class_id' => $data['tax_class_id'], 'manufacturers_id' => $data['manufacturers_id'], 'quantity_discount_groups_id' => $data['quantity_discount_groups_id'], 'quantity_unit_class' => $data['quantity_unit_class'], 'products_last_modified' => date('Y-m-d'));
     if (date('Y-m-d') < $data['date_available']) {
         $products_data['products_date_available'] = $data['date_available'];
     } else {
         $products_data['products_date_available'] = NULL;
     }
     if (is_numeric($id)) {
         $products_data['products_last_modified'] = date('Y-m-d');
         $Qproducts = $this->db->where('products_id', $id)->update('products', $products_data);
     } else {
         $products_data['products_date_added'] = date('Y-m-d');
         $Qproducts = $this->db->insert('products', $products_data);
     }
     if ($this->db->trans_status() === TRUE) {
         if (is_numeric($id)) {
             $products_id = $id;
         } else {
             $products_id = $this->db->insert_id();
         }
         //products_to_categories
         $Qcategories = $this->db->delete('products_to_categories', array('products_id' => $products_id));
         if (isset($data['categories']) && !empty($data['categories'])) {
             foreach ($data['categories'] as $category_id) {
                 $products_to_categories = array('products_id' => $products_id, 'categories_id' => $category_id);
                 $Qp2c = $this->db->insert('products_to_categories', $products_to_categories);
             }
         }
     }
     //products_accessories
     if ($this->db->trans_status() === TRUE) {
         if (is_numeric($id)) {
             $Qdelete = $this->db->delete('products_accessories', array('products_id' => $products_id));
         }
         if (isset($data['accessories_ids']) && sizeof($data['accessories_ids']) > 0) {
             foreach ($data['accessories_ids'] as $accessories_id) {
                 $accessory_data = array('products_id' => $products_id, 'accessories_id' => $accessories_id);
                 $this->db->insert('products_accessories', $accessory_data);
             }
         }
     }
     //products_description
     if ($this->db->trans_status() === TRUE) {
         foreach (lang_get_all() as $l) {
             $products_description_data = array('products_name' => $data['products_name'][$l['id']], 'products_short_description' => $data['products_short_description'][$l['id']], 'products_description' => $data['products_description'][$l['id']], 'products_tags' => $data['products_tags'][$l['id']], 'products_url' => $data['products_url'][$l['id']], 'products_friendly_url' => $data['products_friendly_url'][$l['id']], 'products_page_title' => $data['products_page_title'][$l['id']], 'products_meta_keywords' => $data['products_meta_keywords'][$l['id']], 'products_meta_description' => $data['products_meta_description'][$l['id']]);
             if (is_numeric($id)) {
                 $this->db->update('products_description', $products_description_data, array('products_id' => $products_id, 'language_id' => $l['id']));
             } else {
                 $products_description_data['language_id'] = $l['id'];
                 $this->db->insert('products_description', $products_description_data);
             }
         }
     }
     //BEGIN: products images
     if ($this->db->trans_status() === TRUE) {
         $images = array();
         $image_path = ROOTPATH . 'images/products/_upload/' . $this->session->userdata('session_id') . '/';
         foreach ($this->directory_listing->getFiles() as $file) {
             @copy($image_path . $file['name'], ROOTPATH . 'images/products/originals/' . $file['name']);
             @unlink($image_path . $file['name']);
             $images[$file['name']] = -1;
         }
         delete_files($image_path);
         $default_flag = 1;
         $images_keys = array_keys($images);
         foreach ($images_keys as $image) {
             $image_data = array('products_id' => $products_id, 'default_flag' => $default_flag, 'sort_order' => 0, 'image' => '', 'date_added' => date('Y-m-d'));
             $this->db->insert('products_images', $image_data);
             $image_id = $this->db->insert_id();
             $images[$image] = $image_id;
             $new_image_name = $products_id . '_' . $image_id . '_' . $image;
             @rename(ROOTPATH . 'images/products/originals/' . $image, ROOTPATH . 'images/products/originals/' . $new_image_name);
             $this->db->update('products_images', array('image' => $new_image_name), array('id' => $image_id));
             foreach ($this->admin_image->getGroups() as $group) {
                 if ($group['id'] != '1') {
                     $this->admin_image->resize($new_image_name, $group['id'], 'products');
                 }
             }
             $default_flag = 0;
         }
     }
     //END: products images
     //BEGIN: products variants
     if ($this->db->trans_status() === TRUE) {
         //if edit product, delete variant first
         if (is_numeric($id)) {
             $Qvariants = $this->db->select('*')->from('products_variants')->where('products_id', $id)->order_by('products_variants_id')->get();
             $records = array();
             if ($Qvariants->num_rows() > 0) {
                 foreach ($Qvariants->result_array() as $product_variant) {
                     $Qentries = $this->db->select('products_variants_id, products_variants_groups_id, products_variants_values_id')->from('products_variants_entries')->where('products_variants_id', $product_variant['products_variants_id'])->order_by('products_variants_groups_id', 'products_variants_values_id')->get();
                     $variants_values = array();
                     if ($Qentries->num_rows() > 0) {
                         foreach ($Qentries->result_array() as $entry) {
                             $variants_values[] = $entry['products_variants_groups_id'] . '_' . $entry['products_variants_values_id'];
                         }
                     }
//.........这里部分代码省略.........
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:101,代码来源:products_model.php

示例10: save

 /**
  * Save an article
  *
  * @access public
  * @param $id
  * @param $data
  * @return boolean
  */
 public function save($id = NULL, $data)
 {
     //load libraries
     $this->load->library(array('image', 'upload'));
     //load helpers
     $this->load->helper(array('html_output', 'directory'));
     //flag to check errors
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //article information
     $article_info = array('articles_status' => $data['articles_status'], 'articles_order' => $data['articles_order'], 'articles_categories_id' => $data['articles_categories']);
     //editing article
     if (is_numeric($id)) {
         $article_info['articles_last_modified'] = date('Y-m-d H:i:s');
         $this->db->update('articles', $article_info, array('articles_id' => $id));
     } else {
         $article_info['articles_date_added'] = date('Y-m-d H:i:s');
         $article_info['articles_last_modified'] = date('Y-m-d H:i:s');
         $this->db->insert('articles', $article_info);
     }
     if ($this->db->trans_status() === FALSE) {
         $error = TRUE;
     } else {
         //get the article id as inserting the new article
         $articles_id = is_numeric($id) ? $id : $this->db->insert_id();
     }
     //articles images
     if ($error === FALSE && $data['delimage'] == 1) {
         $this->image->delete_articles_image($articles_id);
         $this->db->update('articles', array('articles_image' => NULL), array('articles_id' => $articles_id));
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
         }
     }
     //upload article image
     if ($error === FALSE) {
         //create the directory to store articles images
         if (!is_dir(ROOTPATH . 'images/articles')) {
             directory_make(ROOTPATH . 'images/articles');
             directory_make(ROOTPATH . 'images/articles/originals');
         }
         //check whether the uploaded image is existed
         if (isset($_FILES[$data['articles_image']]) && isset($_FILES[$data['articles_image']]['tmp_name']) && !empty($_FILES[$data['articles_image']]['tmp_name']) && is_uploaded_file($_FILES[$data['articles_image']]['tmp_name'])) {
             $config['upload_path'] = ROOTPATH . 'images/articles/originals';
             //only the gif, jpg, png, jpeg are allowed to be uploaded
             $config['allowed_types'] = 'gif|jpg|png|jpeg';
             $this->upload->initialize($config);
             //upload the image now
             if ($this->upload->do_upload($data['articles_image'])) {
                 //upload the articles image field in the database
                 $this->db->update('articles', array('articles_image' => $this->upload->data('file_name')), array('articles_id' => $articles_id));
                 if ($this->db->trans_status() === FALSE) {
                     $error = TRUE;
                 } else {
                     //resize the image for each image group
                     foreach ($this->image->get_groups() as $group) {
                         if ($group['id'] !== 1) {
                             $this->image->resize($this->upload->data('file_name'), $group['id'], 'articles');
                         }
                     }
                 }
             } else {
                 $error = TRUE;
             }
         }
     }
     //Process articles description for each language
     if ($error === FALSE) {
         foreach (lang_get_all() as $l) {
             $articles_description = array('articles_name' => $data['articles_name'][$l['id']], 'articles_url' => $data['articles_url'][$l['id']], 'articles_description' => $data['articles_description'][$l['id']], 'articles_page_title' => $data['page_title'][$l['id']], 'articles_meta_keywords' => $data['meta_keywords'][$l['id']], 'articles_meta_description' => $data['meta_description'][$l['id']]);
             //editing article
             if (is_numeric($id)) {
                 $this->db->update('articles_description', $articles_description, array('articles_id' => $articles_id, 'language_id' => $l['id']));
             } else {
                 $articles_description['articles_id'] = $articles_id;
                 $articles_description['language_id'] = $l['id'];
                 $this->db->insert('articles_description', $articles_description);
             }
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
                 break;
             }
         }
     }
     if ($error === FALSE) {
         //commit transaction
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
//.........这里部分代码省略.........
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:101,代码来源:articles_model.php

示例11: save

 /**
  * Save the orders_status
  *
  * @access public
  * @param $id
  * @param $data
  * @param $default
  * @return boolean
  */
 public function save($id = NULL, $data, $default = FALSE)
 {
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //editing or adding the order status
     if (is_numeric($id)) {
         $orders_status_id = $id;
     } else {
         $result = $this->db->select_max('orders_status_id')->from('orders_status')->get();
         $status = $result->row_array();
         $orders_status_id = $status['orders_status_id'] + 1;
         $result->free_result();
     }
     //languages
     foreach (lang_get_all() as $l) {
         //editing or adding the order status
         if (is_numeric($id)) {
             $this->db->update('orders_status', array('orders_status_name' => $data['name'][$l['id']], 'public_flag' => $data['public_flag']), array('orders_status_id' => $orders_status_id, 'language_id' => $l['id']));
         } else {
             $this->db->insert('orders_status', array('orders_status_id' => $orders_status_id, 'language_id' => $l['id'], 'orders_status_name' => $data['name'][$l['id']], 'public_flag' => $data['public_flag']));
         }
         //check transaction status
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
             break;
         }
     }
     if ($error === FALSE) {
         if ($default === TRUE) {
             $this->db->update('configuration', array('configuration_value' => $orders_status_id), array('configuration_key' => 'DEFAULT_ORDERS_STATUS_ID'));
             //check transaction status
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
             }
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:55,代码来源:orders_status_model.php

示例12: save

 /**
  * save the variants group
  *
  * @access public
  * @param $id
  * @param $data
  * @return boolean
  */
 public function save($id = NULL, $data)
 {
     $error = FALSE;
     //editing or adding the product variants group
     if (is_numeric($id)) {
         $group_id = $id;
     } else {
         $result = $this->db->select_max('products_variants_groups_id')->from('products_variants_groups')->get();
         $max_groups = $result->row_array();
         $result->free_result();
         $group_id = $max_groups['products_variants_groups_id'] + 1;
     }
     //start transaction
     $this->db->trans_begin();
     //process languages
     foreach (lang_get_all() as $l) {
         //editing or adding the product variants group
         if (is_numeric($id)) {
             $this->db->update('products_variants_groups', array('products_variants_groups_name' => $data['name'][$l['id']]), array('products_variants_groups_id' => $group_id, 'language_id' => $l['id']));
         } else {
             $this->db->insert('products_variants_groups', array('products_variants_groups_id' => $group_id, 'language_id' => $l['id'], 'products_variants_groups_name' => $data['name'][$l['id']]));
         }
         //check transaction status
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
             break;
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:45,代码来源:product_variants_model.php

示例13: get_data

 /**
  * Get the data of home page
  *
  * @access public
  * @return array
  */
 public function get_data()
 {
     $data = array();
     //process homepage info for each language
     foreach (lang_get_all() as $l) {
         $name = $l['name'];
         $code = strtoupper($l['code']);
         //check page title for language
         if (!defined('HOME_PAGE_TITLE_' . $code)) {
             $this->db->insert('configuration', array('configuration_title' => 'Homepage Page Title For ' . $name, 'configuration_key' => 'HOME_PAGE_TITLE_' . $code, 'configuration_value' => '', 'configuration_description' => 'the page title for the front page', 'configuration_group_id' => '6', 'sort_order' => '0', 'date_added' => date('Y-m-d H:i:s')));
             define('HOME_PAGE_TITLE_' . $code, '');
         }
         //check meta keywords for language
         if (!defined('HOME_META_KEYWORD_' . $code)) {
             $this->db->insert('configuration', array('configuration_title' => 'Homepage Meta Keywords For ' . $name, 'configuration_key' => 'HOME_META_KEYWORD_' . $code, 'configuration_value' => '', 'configuration_description' => 'the meta keywords for the front page', 'configuration_group_id' => '6', 'sort_order' => '0', 'date_added' => date('Y-m-d H:i:s')));
             define('HOME_META_KEYWORD_' . $code, '');
         }
         //check meta description for language
         if (!defined('HOME_META_DESCRIPTION_' . $code)) {
             $this->db->insert('configuration', array('configuration_title' => 'Homepage Meta Description For ' . $name, 'configuration_key' => 'HOME_META_DESCRIPTION_' . $code, 'configuration_value' => '', 'configuration_description' => 'the meta description for the front page', 'configuration_group_id' => '6', 'sort_order' => '0', 'date_added' => date('Y-m-d H:i:s')));
             define('HOME_META_DESCRIPTION_' . $code, '');
         }
         //process the index text
         $result = $this->db->select('*')->from('languages_definitions')->where(array('definition_key' => 'index_text', 'languages_id' => $l['id']))->get();
         if ($result->num_rows() > 0) {
             foreach ($result->result_array() as $homepage) {
                 $data['index_text[' . $l['id'] . ']'] = $homepage['definition_value'];
             }
         }
         $data['HOME_PAGE_TITLE[' . $code . ']'] = constant('HOME_PAGE_TITLE_' . $code);
         $data['HOME_META_KEYWORD[' . $code . ']'] = constant('HOME_META_KEYWORD_' . $code);
         $data['HOME_META_DESCRIPTION[' . $code . ']'] = constant('HOME_META_DESCRIPTION_' . $code);
     }
     return $data;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:41,代码来源:homepage_info_model.php

示例14: save

 /**
  * Save an customer group
  *
  * @access public
  * @param $id
  * @param $data
  * @return boolean
  */
 public function save($id = NULL, $data)
 {
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //editing or adding the customer group
     if (is_numeric($id)) {
         $this->db->update('customers_groups', array('customers_groups_discount' => $data['customers_groups_discount'], 'is_default' => $data['is_default']), array('customers_groups_id' => $id));
     } else {
         $this->db->insert('customers_groups', array('customers_groups_discount' => $data['customers_groups_discount'], 'is_default' => $data['is_default']));
     }
     //check transaction status
     if ($this->db->trans_status() === FALSE) {
         $error = TRUE;
     } else {
         $group_id = is_numeric($id) ? $id : $this->db->insert_id();
     }
     if ($error === FALSE) {
         //process languages
         foreach (lang_get_all() as $l) {
             //editing or adding the customer group
             if (is_numeric($id)) {
                 $this->db->update('customers_groups_description', array('customers_groups_name' => $data['customers_groups_name'][$l['id']]), array('customers_groups_id' => $group_id, 'language_id' => $l['id']));
             } else {
                 $this->db->insert('customers_groups_description', array('customers_groups_id' => $group_id, 'language_id' => $l['id'], 'customers_groups_name' => $data['customers_groups_name'][$l['id']]));
             }
             //check transaction status
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
                 break;
             }
         }
     }
     if ($error === FALSE) {
         //set the customer group as the default group
         if ($data['is_default'] == 1) {
             $this->db->update('customers_groups', array('is_default' => 0));
             if ($this->db->trans_status() === TRUE) {
                 $this->db->update('customers_groups', array('is_default' => 1), array('customers_groups_id' => $group_id));
             }
         }
         //check transaction status
         if ($this->db->trans_status() === FALSE) {
             $error = TRUE;
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:63,代码来源:customers_groups_model.php

示例15: save

 /**
  * Save the rating
  *
  * @access public
  * @param $id
  * @param $data
  * @return boolean
  */
 public function save($id = NULL, $data)
 {
     $error = FALSE;
     //start transaction
     $this->db->trans_begin();
     //editing or adding the rating
     if (is_numeric($id)) {
         $this->db->update('ratings', array('status' => $data['status']), array('ratings_id' => $id));
     } else {
         $this->db->insert('ratings', array('status' => $data['status']));
     }
     //check transaction status
     if ($this->db->trans_status() === TRUE) {
         $ratings_id = is_numeric($id) ? $id : $this->db->insert_id();
         //process languages
         foreach (lang_get_all() as $l) {
             //editing or adding the rating
             if (is_numeric($id)) {
                 $this->db->update('ratings_description', array('ratings_text' => $data['ratings_text'][$l['id']]), array('ratings_id' => $id, 'languages_id' => $l['id']));
             } else {
                 $this->db->insert('ratings_description', array('ratings_id' => $ratings_id, 'languages_id' => $l['id'], 'ratings_text' => $data['ratings_text'][$l['id']]));
             }
             //check transaction status
             if ($this->db->trans_status() === FALSE) {
                 $error = TRUE;
                 break;
             }
         }
     }
     if ($error === FALSE) {
         //commit
         $this->db->trans_commit();
         return TRUE;
     }
     //rollback
     $this->db->trans_rollback();
     return FALSE;
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:46,代码来源:ratings_model.php


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