application/controllers/Cms.php
/**
     * Crud multy level menu.
     *
     * @return HTML
     **/
Crud multy level menu.
@return HTML
Crud multy level menu . @return HTML
public function crud_menu()
    {
        if ($this->uri->segment(4) == 'delete') {
            $id_menu = $this->uri->segment(5);
            $this->db->where('id_menu', $id_menu);
            $this->db->delete('menu');
            $this->db->where('id_menu', $id_menu);
            $this->db->delete('groups_menu');
            $this->db->where('parent_id', $id_menu);
            $get_groups = $this->db->get('menu')->result();
            foreach ($get_groups as $menu) {
                $this->db->where('id_menu', $menu->id_menu);
                $this->db->delete('menu');
            }
            $this->db->where('parent_id', $id_menu);
            $this->db->delete('menu');
            $this->sort_menu_callback(0, $id_menu);
            redirect('cms/menu/'.$this->uri->segment(3));
        } else {
            $type = urldecode(str_replace('-', ' ', $this->uri->segment(3)));
            echo $type;
        }
    }
public function crud_menu ( ) { if ( $ this -> uri -> segment ( 4 ) == 'delete' ) { $ id_menu = $ this -> uri -> segment ( 5 ) ; $ this -> db -> where ( 'id_menu' , $ id_menu ) ; $ this -> db -> delete ( 'menu' ) ; $ this -> db -> where ( 'id_menu' , $ id_menu ) ; $ this -> db -> delete ( 'groups_menu' ) ; $ this -> db -> where ( 'parent_id' , $ id_menu ) ; $ get_groups = $ this -> db -> get ( 'menu' ) -> result ( ) ; foreach ( $ get_groups as $ menu ) { $ this -> db -> where ( 'id_menu' , $ menu -> id_menu ) ; $ this -> db -> delete ( 'menu' ) ; } $ this -> db -> where ( 'parent_id' , $ id_menu ) ; $ this -> db -> delete ( 'menu' ) ; $ this -> sort_menu_callback ( 0 , $ id_menu ) ; redirect ( 'cms/menu/' . $ this -> uri -> segment ( 3 ) ) ; } else { $ type = urldecode ( str_replace ( '-' , ' ' , $ this -> uri -> segment ( 3 ) ) ) ; echo $ type ; } }
Crud multy level menu.
Crud multy level menu .
// Delete Children