/** * Returns enhanced media list * * @param null $where * @param array $filters * @param bool $addon_data * * @return array */ public function get_list($where = NULL, $filters = array(), $addon_data = TRUE) { // Pages $this->{$this->db_group}->select("group_concat(url.path separator ';') as page_paths"); $this->{$this->db_group}->join('page_media', 'page_media.id_media = ' . $this->table . '.id_media', 'left'); $this->{$this->db_group}->join('url', "url.id_entity = page_media.id_page AND url.type='page' and url.active=1 and url.lang='" . Settings::get_lang('default') . "'", 'left'); // Articles $this->{$this->db_group}->select("group_concat(url2.path separator ';') as article_paths"); $this->{$this->db_group}->join('article_media', 'article_media.id_media = ' . $this->table . '.id_media', 'left'); $this->{$this->db_group}->join('url as url2', "url2.id_entity = article_media.id_article AND url2.type='article' and url2.active=1 and url2.lang='" . Settings::get_lang('default') . "'", 'left'); // Filters if (in_array('alt_missing', $filters)) { $this->{$this->db_group}->join('media_lang', 'media_lang.id_media = ' . $this->table . '.id_media', 'left'); $this->{$this->db_group}->where("(media_lang.alt is null or media_lang.alt='')"); } if (in_array('used', $filters)) { $this->{$this->db_group}->where('(url.path is not null or url2.path is not null)'); } if (in_array('not_used', $filters)) { $this->{$this->db_group}->where('(url.path is null and url2.path is null)'); } $this->{$this->db_group}->group_by($this->table . '.id_media'); $this->{$this->db_group}->order_by($this->table . '.id_media', 'DESC'); $result = parent::get_list($where, $this->table); if ($addon_data) { $result = $this->_add_lang_data_to_media_list($result); } return $result; }
/** * @param null $parent * @param null $id_parent * * @return array|void * */ public function get_list($parent = NULL, $id_parent = NULL) { // Get tags from one parent if (!is_null($parent) && $this->table_exists($parent . '_tag')) { $this->{$this->db_group}->join($parent . '_tag', $parent . '_tag.id_tag = ' . $this->get_table() . '.id_tag and ' . $parent . '_tag.id_' . $parent . ' = ' . $id_parent, 'inner'); } return parent::get_list(array('order_by' => 'tag_name ASC')); }
public function get_panel_elements($id_company, $panel, $type = NULL) { $where = array('id_company' => $id_company, 'panel' => $panel, 'order_by' => 'ordering ASC'); if (!is_null($type)) { $where['type'] = $type; } return parent::get_list($where); }
public function get_list($params, $page = 0, $count = 20) { $this->load->model('problem_model'); $comments = parent::get_list($params, $page, $count); foreach ($comments as &$comment) { $comment['author'] = $this->user_model->get(array('id' => $comment['owner_id']))['nickname']; $comment['problem_title'] = $this->problem_model->get(array('id' => $comment['problem_id']))['title']; } return $comments; }
public function get_list($type, $page = 0, $count = 5) { $list = parent::get_list(array("s" => "", 'type' => $type), $page, $count); foreach ($list as $slide) { if (empty($slide['text'])) { break; } $slide['text'] = json_decode($slide['text']); } return $list; }
/** * Get array of articles * * For each article, set the article date. * The article date can be the creation date or the publish_on date if exists * * @access public * @param array An associative array * @return array Array of records * */ function get_list($where = FALSE) { $data = array(); $this->db->select($this->lang_table . '.*'); $this->db->join($this->lang_table, $this->lang_table . '.id_' . $this->table . ' = ' . $this->table . '.id_' . $this->table, 'inner'); $this->db->where($this->lang_table . '.lang', Settings::get_lang('default')); $data = parent::get_list($where); // Set the correct publish date foreach ($data as $key => $row) { $data[$key]['date'] = isDate($row['publish_on']) ? $row['publish_on'] : $row['created']; } return $data; }
public function get_list($id, $page = 0, $count = 5, $isJson = false, $site = false) { $where = $id == "all" ? array() : array('id' => $id); $list = parent::get_list($where, $page, $count); foreach ($list as $key => $item) { if (!$isJson) { $list[$key]['tags'] = $this->tag_model->get_tag_list($item['tags']); $list[$key]['site'] = $this->get_site_by_json($item['site']); $list[$key]['steps'] = $this->get_step_by_json($item['steps']); // $list[$key]['chapters'] = $this->get_chapter_by_json($item['chapters']); } else { if ($site) { $list[$key]['site'] = $this->get_site_by_json($item['site']); } } } return $list; }
/** * Returns all medias linked to one extend field * * @param $id_extend * @param $parent * @param $id_parent * @param null $lang * * @return array */ public function get_extend_media_list($id_extend, $parent, $id_parent, $lang = NULL) { $data = array(); self::$ci->load->model('extend_field_model', '', true); if (!$lang) { $lang = NULL; } $extend = self::$ci->extend_field_model->get_element_extend_field($id_extend, $parent, $id_parent, $lang); if (!empty($extend)) { $ids = strlen($extend['content']) > 0 ? explode(',', $extend['content']) : NULL; if (!empty($ids)) { $this->{$this->db_group}->select($this->get_table() . '.*', FALSE); $where = array('where_in' => array($this->get_table() . '.id_media' => $ids)); // Separated from $where due to $escape set to FALSE $this->{$this->db_group}->order_by('field(' . $this->get_table() . '.id_media, ' . $extend['content'] . ')', '', FALSE); if (!is_null($lang)) { $this->{$this->db_group}->select($this->get_lang_table() . '.*', FALSE); $this->{$this->db_group}->join($this->get_lang_table(), $this->get_lang_table() . '.' . $this->get_pk_name() . '=' . $this->get_table() . '.' . $this->get_pk_name() . ' AND ' . $this->get_lang_table() . '.lang = \'' . $lang . '\'', 'left'); } $data = parent::get_list($where, $this->get_table()); $data = $this->_add_medias_infos($data); } } return $data; }
function get_list($where = array()) { $where['order_by'] = 'ordering ASC'; return parent::get_list($where); }
public function get_fund_list($page) { $list = parent::get_list(array('type <=' => '1'), $page, 20); foreach ($list as &$item) { $item['ctime'] = date("H:i:s", strtotime($item['ctime'])); $item['tags'] = $this->tag_model->get_list_by_json($item['tags']); } return $list; }
public function get_context_list($context, $id_context = NULL, $parent = NULL, $id_parent = NULL, $id_extend_field_type = NULL) { $where = array('order_by' => 'ordering ASC'); if (!empty($parent)) { $where['parent'] = $parent; } if (!empty($id_parent)) { $where['id_parent'] = $id_parent; } // Extend Lang : Label $this->{$this->db_group}->select($this->get_lang_table() . '.label'); $this->{$this->db_group}->join($this->get_lang_table(), $this->get_lang_table() . '.' . $this->get_pk_name() . ' = ' . $this->get_table() . '.' . $this->get_pk_name() . ' AND ' . $this->get_lang_table() . '.lang = \'' . Settings::get_lang('default') . '\'', 'left'); // Add Extend Type info $this->_join_to_extend_types($id_extend_field_type); // Context $this->{$this->db_group}->select(self::$_CONTEXT_TABLE . '.context,' . self::$_CONTEXT_TABLE . '.id_context'); $this->_join_to_context($context, $id_context); // Extend Definition List $list = parent::get_list($where); return $list; }
/** * Returns all articles with all lang data * * @param array $where * @return array */ public function get_all_lang_list($where = array()) { $data = array(); $this->{$this->db_group}->select($this->lang_table . '.*'); $this->{$this->db_group}->join($this->lang_table, $this->lang_table . '.id_' . $this->table . ' = ' . $this->table . '.id_' . $this->table, 'inner'); // URLs $this->{$this->db_group}->select('url.canonical, url.path, url.path_ids, url.full_path_ids'); $this->{$this->db_group}->join($this->url_table . ' as url', $this->table . '.id_article = url.id_entity AND ' . '(' . 'url.active = 1 AND ' . "url.type = 'article' AND " . 'url.lang = ' . $this->lang_table . '.lang' . ')', 'left'); $this->{$this->db_group}->select("\r\n\t\t\tgroup_concat(page.id_page separator ';') as page_ids,\r\n\t\t\tpage_lang.title as page_title\r\n\t\t"); $this->{$this->db_group}->join('page_article', $this->table . '.id_article = page_article.id_article', 'left'); $this->{$this->db_group}->join('page', 'page.id_page = page_article.id_page', 'left'); $this->{$this->db_group}->join('page_lang', 'page_lang.id_page = page.id_page AND article_lang.lang = page_lang.lang', 'left'); $this->{$this->db_group}->group_by($this->table . '.id_article'); $this->{$this->db_group}->group_by($this->lang_table . '.lang'); $articles = parent::get_list($where); foreach ($articles as $article) { if (empty($data[$article['id_article']][$article['lang']])) { if (!isset($data[$article['id_article']])) { $data[$article['id_article']] = array(); } if ($article['lang'] == Settings::get_lang('default')) { $data[$article['id_article']]['data'] = $article; } $data[$article['id_article']][$article['lang']] = $article; } } return $data; }
private function _reorder($id_item_definition) { $cond = array('id_item_definition' => $id_item_definition, 'order_by' => 'ordering ASC, id_item DESC'); $items = parent::get_list($cond); foreach ($items as $key => $item) { $this->{$this->db_group}->where($this->pk_name, $item['id_item'])->update($this->table, array('ordering' => $key + 1)); } }
/** * @param array $where * * @return array */ public function get_list_with_role($where = array()) { $this->_join_role(); return parent::get_list($where); }
public function get_list($params = array(), $page = 0, $count = 3) { return parent::get_list($params, $page, $count); }
public function get_ionize_notifications() { $where = array('read' => '0', 'order_by' => 'date_creation DESC'); return parent::get_list($where, $this->get_table()); }