本文整理汇总了PHP中Base_model::get_lang_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_model::get_lang_list方法的具体用法?PHP Base_model::get_lang_list怎么用?PHP Base_model::get_lang_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_model
的用法示例。
在下文中一共展示了Base_model::get_lang_list方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IF
/**
* Get all the article_lang data + the page URL of the current language (page_url in the output array)
*
* @param string String to search
* @return array Array of articles
*
*/
function get_articles($realm)
{
$realm = '\'%' . $realm . '%\'';
$this->set_table('article');
$this->set_lang_table('article_lang');
$this->set_pk_name('id_article');
$lang = Settings::get_lang();
// Page_Article table
$this->{$this->db_group}->select($this->parent_table . '.*', FALSE);
$this->{$this->db_group}->join($this->parent_table, $this->parent_table . '.id_article = ' . $this->table . '.id_article', 'left');
// Page table
$this->{$this->db_group}->select('page.online');
$this->{$this->db_group}->join($this->page_table, $this->page_table . '.id_page = ' . $this->parent_table . '.id_page', 'left');
// Page lang table
$this->{$this->db_group}->select('page_lang.lang');
$this->{$this->db_group}->join($this->page_lang_table, $this->page_lang_table . '.id_page = ' . $this->page_table . '.id_page', 'left');
// Menu table
$this->{$this->db_group}->select('menu.id_menu, menu.name as menu_name');
$this->{$this->db_group}->join($this->menu_table, $this->menu_table . '.id_menu = ' . $this->page_table . '.id_menu', 'left');
// URL table : For Article's URL building
$this->{$this->db_group}->select('url.path');
$this->{$this->db_group}->join($this->url_table, $this->url_table . '.id_entity = ' . $this->table . '.id_article' . ' AND ' . $this->url_table . '.active=1 ' . ' AND ' . $this->url_table . '.lang = \'' . $lang . '\'', 'left');
// Published filter
$this->filter_on_published(self::$publish_filter, $lang);
// Add the 'date' field to the query
$this->{$this->db_group}->select('IF(article.logical_date !=0, article.logical_date, IF(article.publish_on !=0, article.publish_on, article.created )) AS date');
// Search where
$this->{$this->db_group}->where('(' . ' article_lang.title LIKE ' . $realm . ' OR article_lang.subtitle LIKE ' . $realm . ' OR article_lang.content LIKE ' . $realm . ')');
$where = array("page.online" => 1, "article.indexed" => 1, "page_article.online" => 1, "page_article.main_parent" => 1, "article_lang.online" => 1, "article_lang.lang" => $lang, "page_lang.lang" => $lang);
// Base_model->get_lang_list()
$articles = parent::get_lang_list($where, $lang);
return $articles;
}
示例2:
function get_lang_list($where = false, $lang = NULL)
{
// Order by ordering field
$this->{$this->db_group}->order_by($this->table . '.level', 'ASC');
$this->{$this->db_group}->order_by($this->table . '.ordering', 'ASC');
// Filter on published
$this->filter_on_published(self::$publish_filter, $lang);
return parent::get_lang_list($where, $lang);
}
示例3: get_detailled_lang_list
/**
* Returns list of extend fields, with extend_field data
*
*/
public function get_detailled_lang_list($where = array(), $lang = NULL)
{
$this->{$this->db_group}->select(self::$_EXTEND . '.name,' . self::$_EXTEND . '.type,' . self::$_EXTEND . '.description,' . self::$_EXTEND . '.ordering,' . self::$_EXTEND . '.value as default_value,' . self::$_EXTEND . '.main');
$this->{$this->db_group}->join(self::$_EXTEND, self::$_EXTEND . '.id_extend_field = ' . $this->get_table() . '.id_extend_field', 'inner');
$this->_join_to_extend_types();
if (!is_null($lang)) {
// Add extend_field label
$this->{$this->db_group}->select(self::$_EXTEND_LANG . '.label');
$this->{$this->db_group}->join(self::$_EXTEND_LANG, self::$_EXTEND_LANG . '.id_extend_field = ' . $this->get_table() . '.id_extend_field' . ' AND ' . self::$_EXTEND_LANG . '.lang = \'' . $lang . '\'', 'left');
// Limit extend_fields to the asked lang
$this->{$this->db_group}->where("(" . $this->get_table() . ".lang = '" . $lang . "' OR " . $this->get_table() . ".lang is NULL OR " . $this->get_table() . ".lang =''" . ")");
}
return parent::get_lang_list($where);
}
示例4: get_lang_list
/**
* @param array $where
* @param null $lang
* @param null $filter
*
* @return array
*/
public function get_lang_list($where = array(), $lang = NULL, $filter = NULL)
{
// Correction on $where['id_media']
if (is_array($where) && isset($where['id_media'])) {
$where[$this->table . '.id_media'] = $where['id_media'];
unset($where['id_media']);
}
// Correction on all non declared parent tables
foreach ($where as $key => $val) {
if (!is_array($val) && strpos($val, 'id_media') === 0) {
$val = $this->table . '.' . $val;
$where[$key] = $val;
}
}
if (!is_null($filter)) {
$this->_set_filter($filter);
}
return parent::get_lang_list($where, $lang);
}
示例5: array
function get_lang_list($where = array(), $lang)
{
$where['order_by'] = 'ordering ASC';
return parent::get_lang_list($where, $lang);
}
示例6: get_lang_list
/**
* @param array $where
* @param string [$lang]
* @return array
*/
public function get_lang_list($where = array(), $lang = NULL)
{
$this->_join_to_extend_types();
if (!isset($where['order_by'])) {
$where['order_by'] = 'ordering ASC';
}
$list = parent::get_lang_list($where, $lang);
return $list;
}
示例7: get_lang_list
/**
* Get article list with lang data
* Used by front-end to get the posts with lang data
*
* @param array $where
* @param string $lang
* @param bool|string $filter SQL filter
* @return array Array of articles
*/
public function get_lang_list($where = array(), $lang = NULL, $filter = FALSE)
{
// Page_Article table
$this->{$this->db_group}->select($this->parent_table . '.*', FALSE);
$this->{$this->db_group}->select($this->parent_table . '.online as online_in_page', FALSE);
$this->{$this->db_group}->join($this->parent_table, $this->parent_table . '.id_article = ' . $this->table . '.id_article', 'left');
// Page table
$this->{$this->db_group}->select('article_list_view, article_view');
$this->{$this->db_group}->join($this->page_table, $this->page_table . '.id_page = ' . $this->parent_table . '.id_page', 'left');
// Menu table
$this->{$this->db_group}->select('menu.id_menu, menu.name as menu_name');
$this->{$this->db_group}->join($this->menu_table, $this->menu_table . '.id_menu = ' . $this->page_table . '.id_menu', 'left');
// Default ordering
if (empty($where['order_by'])) {
$where['order_by'] = $this->parent_table . '.ordering ASC';
}
// Correction on $where['id_page']
if (is_array($where) && isset($where['id_page'])) {
$where[$this->parent_table . '.id_page'] = $where['id_page'];
unset($where['id_page']);
}
// Correction on $where['where_in']
if (isset($where['where_in'])) {
foreach ($where['where_in'] as $key => $value) {
if ($key == 'id_page') {
$where['where_in'][$this->parent_table . '.id_page'] = $value;
unset($where['where_in']['id_page']);
}
}
}
// Published filter
$this->filter_on_published(self::$publish_filter, $lang);
// User's filter (tags)
if ($filter !== FALSE) {
$this->_set_filter($filter);
}
// Add the 'date' field to the query
$this->{$this->db_group}->select('IF(article.logical_date !=0, article.logical_date, IF(article.publish_on !=0, article.publish_on, article.created )) AS date');
// Add Type to query
$this->{$this->db_group}->select($this->type_table . '.type, ' . $this->type_table . '.type_flag');
$this->{$this->db_group}->join($this->type_table, $this->parent_table . '.id_type = ' . $this->type_table . '.id_type', 'left');
// Base_model->get_lang_list()
$articles = parent::get_lang_list($where, $lang);
$this->add_categories($articles, $lang);
$this->add_tags($articles);
return $articles;
}
示例8: get_lang_list
/**
* @param null|string $where
* @param null|string [$lang] lang code
* @return array
*/
public function get_lang_list($where = NULL, $lang = NULL)
{
// Order by ordering field
$this->{$this->db_group}->order_by($this->table . '.level', 'ASC');
$this->{$this->db_group}->order_by($this->table . '.ordering', 'ASC');
// Filter on published
$this->filter_on_published(self::$publish_filter, $lang);
// Add Url to the request
if ($lang == NULL) {
$lang = Settings::get_lang('default');
}
// URL paths
$this->{$this->db_group}->select('url.path, url.path_ids, url.full_path_ids');
$this->{$this->db_group}->join($this->url_table . ' as url', $this->table . '.id_page = url.id_entity AND ' . '(' . "url.type = 'page' AND " . 'url.active = 1 AND ' . "url.lang = '" . $lang . "'" . ')', 'left');
// Lang URL paths
$this->{$this->db_group}->select("group_concat(url2.path separator ';') as url_paths");
$this->{$this->db_group}->select("group_concat(url2.lang separator ';') as url_langs");
$this->{$this->db_group}->join($this->url_table . ' as url2', $this->table . ".id_page = url2.id_entity AND " . '(' . "url2.type = 'page' AND " . 'url2.active = 1 ' . ')', 'left');
$this->{$this->db_group}->group_by($this->table . '.id_page');
return parent::get_lang_list($where, $lang);
}