本文整理汇总了PHP中lang_id函数的典型用法代码示例。如果您正苦于以下问题:PHP lang_id函数的具体用法?PHP lang_id怎么用?PHP lang_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lang_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_review
/**
* Save review
*
* @access public
* @param $data
* @return boolean
*/
function save_review($data)
{
if (is_array($data['rating'])) {
$total = 0;
foreach ($data['rating'] as $value) {
$total += $value;
}
$reviews_rating = $total / count($data['rating']);
} else {
$reviews_rating = $data['rating'];
}
//review data
$reviews = array('products_id' => $data['products_id'], 'customers_id' => $data['customer_id'], 'customers_name' => $data['customer_name'], 'reviews_rating' => $reviews_rating, 'languages_id' => lang_id(), 'reviews_text' => $data['review'], 'reviews_status' => 1);
$this->db->insert('reviews', $reviews);
//rating data
if (is_array($data['rating'])) {
//get insert id
$reviews_id = $this->db->insert_id();
foreach ($data['rating'] as $ratings_id => $value) {
//order data
$rating = array('ratings_id' => $ratings_id, 'customers_id' => $data['customer_id'], 'reviews_id' => $reviews_id, 'ratings_value' => $value);
$this->db->insert('customers_ratings', $rating);
}
}
}
示例2: query
private function query($categories_id)
{
if (!empty($categories_id)) {
$categories_id = end(explode('_', $categories_id));
$sub_categories = array();
$this->category_tree->get_children($categories_id, $sub_categories);
$categories = array();
if (!empty($sub_categories)) {
foreach ($sub_categories as $category) {
$categories[] = $category['id'];
}
}
$categories[] = $categories_id;
$Qproducts_ids = $this->db->select('products_id')->from('products_to_categories')->where_in('categories_id', $categories)->group_by('products_id')->get();
$products_ids = array();
if ($Qproducts_ids->num_rows() > 0) {
foreach ($Qproducts_ids->result_array() as $product) {
$products_ids[] = $product['products_id'];
}
}
$Qproducts_ids->free_result();
}
$this->db->select('p.products_id, pd.products_name, p.products_quantity')->from('products p')->join('products_description pd', 'p.products_id = pd.products_id')->where(array('pd.language_id' => lang_id(), 'p.products_quantity <=' => STOCK_REORDER_LEVEL));
if (isset($products_ids) && !empty($products_ids)) {
$this->db->where_in('p.products_id', $products_ids);
}
}
示例3: get_data
/**
* Get email template data
*
* @access public
* @return mixed
*/
public function get_data($template_name)
{
$result = $this->db->select('et.email_templates_status, etd.email_title, etd.email_content')->from('email_templates as et')->join('email_templates_description as etd', 'et.email_templates_id = etd.email_templates_id', 'inner')->where('et.email_templates_name', $template_name)->where('etd.language_id', lang_id())->get();
if ($result->num_rows() > 0) {
return $result->row_array();
}
return NULL;
}
示例4: get_categories
/**
* Get the categories
*
* @access public
* @param $categories_id
* @return mixed
*/
public function get_categories($categories_id)
{
$result = $this->db->select('cd.categories_name, c.parent_id, cd.categories_id')->from('categories c')->join('categories_description cd', 'c.categories_id = cd.categories_id')->where(array('c.parent_id' => $categories_id, 'cd.language_id' => lang_id()))->get();
if ($result->num_rows() > 0) {
return $result->result_array();
}
return NULL;
}
示例5: get_articles
/**
* Get Articles
*
* @access public
* @param int $articles_categories_id articles categories id
* @param int $count number of articles to be displayed
* @return array new products array
*/
public function get_articles($articles_categories_id, $count)
{
$result = $this->db->select('a.articles_id, ad.articles_name, ad.articles_url')->from('articles a')->join('articles_description ad', 'a.articles_id = ad.articles_id', 'inner')->where('a.articles_status', 1)->where('a.articles_categories_id', $articles_categories_id)->where('ad.language_id', lang_id())->order_by('articles_order', 'desc')->limit($count)->get();
if ($result->num_rows() > 0) {
return $result->result_array();
}
return NULL;
}
示例6: get_new_products
/**
* Get Latest Products
*
* @access public
* @param int $count number of products to be displayed
* @return array new products array
*/
public function get_new_products($count)
{
$result = $this->db->select('p.*, pd.*, m.*, i.image, s.specials_new_products_price as specials_price, f.products_id as featured_products_id')->from('products as p')->join('products_description as pd', 'p.products_id = pd.products_id and pd.language_id =' . lang_id(), 'inner')->join('products_to_categories as p2c', 'p.products_id = p2c.products_id', 'inner')->join('products_frontpage as f', 'p.products_id = f.products_id', 'left')->join('products_images as i', 'p.products_id = i.products_id and i.default_flag = 1', 'left')->join('categories as c', 'p2c.categories_id = c.categories_id', 'inner')->join('specials as s', 'p.products_id = s.products_id and s.status = 1 and s.start_date <= now() and s.expires_date >= now()', 'left')->join('manufacturers as m', 'p.manufacturers_id = m.manufacturers_id', 'left')->join('manufacturers_info as mi', 'm.manufacturers_id = mi.manufacturers_id and mi.languages_id = ' . lang_id(), 'left')->where('p.products_status', 1)->order_by('p.products_id', 'desc')->limit($count)->get();
if ($result->num_rows() > 0) {
return $result->result_array();
}
return NULL;
}
示例7: get_groups
/**
* Get the image groups
*
* @access public
* @return mixed
*/
public function get_groups()
{
$result = $this->db->select('*')->from('products_images_groups')->where('language_id', lang_id())->get();
if ($result->num_rows() > 0) {
return $result->result_array();
}
return NULL;
}
示例8: get_specials
/**
* Get Special Products
*
* @access public
* @param int $count number of products to be displayed
* @return array special products array
*/
public function get_specials($count)
{
$result = $this->db->select('p.products_id, p.products_price, p.products_tax_class_id, pd.products_name, pd.products_keyword, pd.products_short_description as short_description, s.specials_new_products_price as special_price, i.image')->from('products p')->join('products_images i', 'p.products_id = i.products_id', 'left')->join('products_description pd', 'p.products_id = pd.products_id', 'inner')->join('specials s', 's.products_id = p.products_id', 'inner')->where('p.products_status = 1')->where('pd.language_id', lang_id())->where('i.default_flag', 1)->where('s.status', 1)->order_by('s.specials_date_added', 'desc')->limit($count)->get();
if ($result->num_rows() > 0) {
return $result->result_array();
}
return NULL;
}
示例9: get_slides
/**
* Get Slides
*
* @access public
* @param string $group the slides group to be displayed
* @return array slides array
*/
public function get_slides($group)
{
$result = $this->db->select('image, image_url, description')->from('slide_images')->where('language_id', lang_id())->where('group', $group)->where('status', 1)->order_by('sort_order')->get();
$slides = array();
if ($result->num_rows() > 0) {
$slides = $result->result_array();
}
return $slides;
}
示例10: get_special_products
/**
* Get special products
*
* @access public
* @return array
*/
public function get_special_products()
{
$result = $this->db->select('p.products_id, p.products_price, p.products_tax_class_id, pd.products_name, pd.products_keyword, s.specials_new_products_price as special_price, i.image ')->from('products p')->join('products_images i', 'p.products_id = i.products_id', 'left')->join('products_description pd', 'p.products_id = pd.products_id', 'inner')->join('specials s', 's.products_id = p.products_id', 'inner')->where('p.products_status = 1')->where('pd.language_id', lang_id())->where('i.default_flag = 1')->where('s.status = 1')->order_by('s.specials_date_added desc')->limit(config('MAX_DISPLAY_SPECIAL_PRODUCTS'))->get();
$products = array();
if ($result->num_rows() > 0) {
$products = $result->result_array();
}
return $products;
}
示例11: load
/**
* Get the languages resources for specified group
*
* @access public
* @param $group
* @return array
*/
public function load($group = 'general')
{
$result = $this->db->select('*')->from('languages_definitions')->where('languages_id', lang_id())->where('content_group', $group)->get();
$definitions = array();
foreach ($result->result() as $key => $row) {
$definitions[$row->definition_key] = $row->definition_value;
}
return $definitions;
}
示例12: get_banner
/**
* Get Banner
*
* @access public
* @param string $group the image group to be displayed
* @return array slide array
*/
public function get_banner($group)
{
$result = $this->db->select('image, image_url, description')->from('slide_images')->where('language_id', lang_id())->where('group', $group)->where('status', 1)->order_by('sort_order')->get();
if ($result->num_rows() > 0) {
$result_array = $result->result_array();
//randomizes the order of the slides
shuffle($result_array);
//return the first element
return $result_array[0];
}
return NULL;
}
示例13: get_ratings
/**
* Get the ratings
*
* @access public
* @return mixed
*/
public function get_ratings($start = NULL, $limit = NULL)
{
$this->db->select('r.ratings_id, r.status, rd.ratings_text')->from('ratings r')->join('ratings_description rd', 'r.ratings_id = rd.ratings_id')->where('rd.languages_id', lang_id());
if ($start !== NULL && $limit !== NULL) {
$this->db->limit($limit, $start);
}
$result = $this->db->get();
if ($result->num_rows() > 0) {
return $result->result_array();
}
return NULL;
}
示例14: get_articles
/**
* Get the articles
*
* @access public
* @param $start
* @param $limit
* @return mixed
*/
public function get_articles($start = NULL, $limit = NULL)
{
$this->db->select('a.articles_id, a.articles_status, a.articles_order, ad.articles_name, acd.articles_categories_name')->from('articles a')->join('articles_description ad', 'a.articles_id = ad.articles_id')->join('articles_categories_description acd', 'acd.articles_categories_id = a.articles_categories_id and acd.language_id = ad.language_id')->where(array('acd.articles_categories_id' => 1, 'ad.language_id' => lang_id()));
if ($start !== NULL && $limit !== NULL) {
$this->db->limit($limit, $start);
}
$result = $this->db->get();
if ($result->num_rows() > 0) {
return $result->result_array();
}
return NULL;
}
示例15: create_news
public function create_news()
{
$this->db->insert($this->_table_blank, array('news_name' => $this->input->post('news_name', true)));
$id = $this->db->insert_id();
if ($this->config->item('multi_language_enable') === true and count($this->config->item('multi_language')) > 0) {
$languages = $this->config->item('multi_language');
foreach ($languages as $key => $value) {
$this->db->insert($this->_table_image_content, array('news_id' => $id, 'news_text' => '', 'news_title' => '', 'news_date' => '', 'news_time' => '', 'img_full_path' => '', 'img_lang' => $key));
}
} else {
$this->db->insert($this->_table_image_content, array('news_id' => $id, 'news_text' => '', 'news_title' => '', 'news_date' => '', 'news_time' => '', 'img_full_path' => '', 'img_lang' => lang_id()));
}
}