/application/libraries/lib_category.php
public function _build() {
$this->categories = $this->CI->cms_base->get_categories(TRUE);
if ($this->categories) {
$this->create_path();
}
......
public function unsorted() {
if ($this->unsorted != FALSE) {
return $this->unsorted_arr;
}
// if (($cache = $this->CI->cache->fetch('categories_unsorted_array')) !== FALSE) {
// $this->unsorted_arr = &$cache;
//
// foreach ($this->unsorted_arr as $k => $v) {
// $this->unsorted_arr[$k] = $this->translate($this->unsorted_arr[$k]);
// }
//
// return $this->unsorted_arr;
// } else {
$key = 'categories_unsorted_array';
$this->categories = $this->CI->cms_base->get_categories();
$this->create_path();
$cats = [];
foreach ($this->categories as $category) {
$cats[$category['id']] = $category;
}
$this->CI->cache->store($key, $cats);
$this->unsorted_arr = &$cats;
foreach ($this->unsorted_arr as $k => $v) {
$this->unsorted_arr[$k] = $this->translate($this->unsorted_arr[$k]);
}
return $cats;
// }
}
/application/models/cms_admin.php
public function get_categories($adminEditCategory = FALSE) {
return $this->cms_base->get_categories($adminEditCategory);
}
/application/models/cms_base.php
public function get_categories($adminEditCategory = FALSE) {
/** Сетаеться только в pages->edit */
if ($this->getLocaleId() && !$adminEditCategory) {
$query = $this->db->select('*')
->from('category')
->join('category_translate', 'category.id = category_translate.alias', 'left')
->where('lang', $this->getLocaleId())
->order_by('position', 'ASC')
->get();
} else {
$this->db->order_by('position', 'ASC');
$query = $this->db->get('category');