Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function build_categories($module_name, $table_id) {
- $modules = $this->get_modules();
- //module exist
- if (in_array($module_name, array_keys($modules))) {
- //get current module categories
- $categories = $this->db
- ->select('c.id,c.p_id,c.status,c.img,ct.title,c.order')
- ->join('categories_translate ct', "ct.table_id = c.id and ct.lang = '$this->site_lang'", 'left')
- ->order_by('c.order')
- ->get_where('categories c', array('c.module_id' => $modules[$module_name]->id))
- ->result_array();
- if ($categories) {
- //setup assets
- $this->assets->add(array(
- 'css' => array(
- 'third_party/icheck/css/all.css'
- ),
- 'js' => array(
- 'third_party/icheck/icheck.min.js',
- 'js/admin_save_modules_categories.js'
- )
- ));
- //render view with data
- return $this->load->view(
- $this->template->path.DIRECTORY_SEPARATOR.$this->template->componets_path.DIRECTORY_SEPARATOR.'modules_categories',
- array(
- //build categories tree
- 'categories' => getTree($categories),
- 'module_id' => $modules[$module_name]->id,
- 'table_id' => $table_id,
- //get selected categories
- 'selected' => $this->selected_categories($modules[$module_name]->id, $table_id)
- ),
- true
- );
- }
- } else {
- log_message('error', "module {$module_name} not exist");
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement