コード例 #1
0
ファイル: Sso.php プロジェクト: soniibrol/package
 private function set_menu()
 {
     $tmp = [];
     foreach ($this->data as $v) {
         $tmp[] = $v;
     }
     $menu = data_recursive($tmp, 'mid', 'mpar');
     return $this->menu_tree($menu);
 }
コード例 #2
0
ファイル: Role.php プロジェクト: soniibrol/package
 public function create()
 {
     $this->load->helper('recursive');
     $this->menu->as_array();
     $recursive = data_recursive($this->menu->get_all(), 'menu_id', 'menu_parent');
     $this->data['menu'] = datagrid_recursive($recursive, 'menu_name');
     $this->action->as_array();
     $this->data['action'] = $this->action->get_all();
     $this->view = 'sso/role/create';
 }
コード例 #3
0
ファイル: Sso_new.php プロジェクト: soniibrol/package
 private function set_menu()
 {
     $tmp = [];
     foreach ($this->data as $v) {
         $tmp[] = $v;
     }
     $menu = data_recursive($tmp, 'menu_id', 'menu_parent');
     echo '<pre>';
     print_r($menu);
     die;
     return $this->menu_tree($menu);
 }
コード例 #4
0
ファイル: Menus.php プロジェクト: soniibrol/package
 public function form()
 {
     $this->cfg->script = ['list-icon-modal'];
     $this->_attr['data'] = [];
     if (!empty($this->_id)) {
         $this->mn->init($this->_id);
         $this->_attr['data'] = $this->mn->tdata;
     }
     $br3 = empty($this->_attr['data']) ? 'Insert' : 'Edit';
     $this->_attr['breadcrumb'] = [anchor('/', '<i class="fa fa-home"></i> Home'), anchor($this->cfg->page['mlnk'], $this->cfg->page['mnme']), $br3];
     $this->_attr['opt'] = data_recursive($this->mn->fmn(), 'mid', 'mpar');
     $this->template->load($this->cfg->template . '/default', 'sso/menu_form', $this->_attr);
     $this->load->view('sso/modal-list-icon');
 }
コード例 #5
0
ファイル: Test.php プロジェクト: soniibrol/package
 public function index()
 {
     $udata = data_recursive($this->mn->fmn(), 'mid', 'mpar');
     $recursive = datagrid_recursive($udata, 'mnme');
     /* $this->header['breadcrumb'] = array(anchor('/', '<i class="fa fa-home"></i> Home'), $this->page['mnme']); */
     $this->header['breadcrumb'] = array(anchor('/', '<i class="fa fa-home"></i> Home'), '');
     $page = $this->uri->segment(4) ? $this->uri->segment(4) : 0;
     $config['base_url'] = base_url('sso/menus/index/');
     $config['per_page'] = $this->perpage;
     $config['uri_segment'] = 4;
     $config['total_rows'] = count($recursive);
     $this->pagination->initialize($config);
     $data = array_slice($recursive, $page, $config['per_page']);
     $this->load->view('header', $this->header);
     $this->load->view('sso/test/indexlish', array('data' => $data, 'row' => count($recursive), 'links' => $this->pagination->create_links()));
     $this->load->view('footer', $this->footer);
 }
コード例 #6
0
 function data_recursive($data = [], $parent_name = NULL, $sub_name = NULL, $parent = 0)
 {
     if (empty($data)) {
         return;
     }
     $d = [];
     $dat = $data;
     if (!empty($dat)) {
         foreach ($dat as $key => $val) {
             $id = $val[$parent_name];
             $parent_id = $val[$sub_name];
             $parent_id = empty($parent_id) ? 0 : $parent_id;
             if ($parent == $parent_id) {
                 $d[$id]['data'] = $val;
                 unset($dat[$key]);
                 $d[$id]['sub'] = data_recursive($dat, $parent_name, $sub_name, $id);
             }
         }
     }
     return $d;
 }
コード例 #7
0
ファイル: role_form.php プロジェクト: soniibrol/package
                                <tr>
                                    <th class="text-center">#</th>
                                    <th class="text-center">Menu name</th>
                                    <?php 
foreach ($acc_key as $v) {
    ?>
                                        <th class="text-center"><?php 
    echo $v;
    ?>
</th>
                                        <?php 
}
?>
                                </tr>
                                <?php 
$mdata = data_recursive($mdata, 'mid', 'mpar');
$recursive = datagrid_recursive($mdata, 'mnme');
if (!empty($recursive)) {
    foreach ($recursive as $v) {
        if ($v['mpar'] == FALSE) {
            continue;
        }
        ?>
                                        <tr>
                                            <th class="text-center">
                                        <div class="checkbox all"><?php 
        echo form_label(form_checkbox('mid_' . $v['mid'], '', '', 'data-mid="' . $v['mid'] . '"'));
        ?>
</div>
                                        </th>
                                        <td><?php 
コード例 #8
0
ファイル: GN_Controller.php プロジェクト: soniibrol/package
 protected function index()
 {
     $this->load->library(['pagination', 'table']);
     $page = !empty($this->uri->segment(4)) ? $this->_perpage * ($this->uri->segment(4) - 1) : 0;
     $config['base_url'] = base_url($this->_base . '/index/');
     $config['total_rows'] = $this->{$this->router->fetch_class()}->count_all();
     $this->_set_datagrid_header(isset($this->data['recursive']) ? $this->data['recursive'][1] : NULL);
     $unshift = [$this->_primary_key => 'Primary Key'] + $this->data['datagrid_header'];
     $items = $this->_get_items();
     if (!empty($this->data['recursive'])) {
         $this->load->helper('recursive');
         $recursive = data_recursive($this->{$this->router->fetch_class()}->as_array()->get_all(), $this->data['recursive'][0], $this->data['recursive'][1]);
         foreach (datagrid_recursive($recursive, $this->data['recursive'][2]) as $index => $row) {
             foreach ($row as $k => $v) {
                 if (!empty($items) && array_key_exists($k, $items)) {
                     $row[$k] = empty($v) ? $v : $items[$k][$v];
                 }
             }
             $this->data['datagrid'][$index] = array_intersect_key($row, $unshift);
         }
         $this->data['datagrid'] = array_slice($this->data['datagrid'], $page, $this->_perpage);
         $this->data['datagrid'] = array_to_object($this->data['datagrid']);
     } else {
         $this->{$this->router->fetch_class()}->order_by($this->_primary_key, 'ASC');
         $this->{$this->router->fetch_class()}->limit($this->_perpage, $page);
         foreach ($this->{$this->router->fetch_class()}->get_all() as $index => $row) {
             $row = object_to_array($row);
             foreach ($row as $k => $v) {
                 if (!empty($items) && array_key_exists($k, $items)) {
                     $row[$k] = empty($v) ? $v : $items[$k][$v];
                 }
             }
             $row = array_intersect_key($row, $unshift);
             $this->data['datagrid'][$index] = array_to_object($row);
         }
     }
     $this->pagination->initialize($config);
     $this->data['links'] = $this->pagination->create_links();
 }