%PDF-1.4 404 Not Found
Sh3ll



Directory :  /var/www/vhosts/lautnusantara.com/httpdocs/mis/app/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Current File : /var/www/vhosts/lautnusantara.com/httpdocs/mis/app/Controllers/Menu_group.php
<?php

namespace App\Controllers;

use CodeIgniter\Controller;


// use App\Models\DashboardModel;
use App\Models\History_model;

use App\Models\Menu_Group_Model;

class Menu_group extends BaseController
{
    protected $History;
    protected $Menu_group_Model;
    protected $session;

    public function __construct()
    {
        $this->History = new History_model();
        $this->Menu_group_Model = new Menu_group_Model();

        $this->session = session();
        // $session		= session(); //\Config\Service::session();
    }

    public function index()
    {
        $user_id = session()->get('user_id');
        $username = session()->get('username');
        $firstname = session()->get('firstname');
        $lastname = session()->get('lastname');

        // $this->History->save([
        //     'user_id' 	=> $user_id,
        //     'username' 	=> $username,
        //     'name' 		=> $firstname.' '.$lastname,
        //     'kegiatan' 	=> 'Dashboard',
        //     'jenis_kegiatan' 	=> 'Login/Dashboard',
        //     'tanggal_waktu' 	=> date('Y-m-d H:i:s')
        // ]);

        // $this->data_dashboard = new DashboardModel();

        $data = array(
            'title' => 'MCS - Manajemen Compro System',
            'description' => 'Aplikasi MCS - Manajemen Compro System',
            'keywords' => 'MCS, Manajemen, Compro',
            'author' => 'SSN',
            'parent_id_menu' => '18',
            'parent_id_submenu' => '22',
            'id_menu' => '23',
            'page1' => 'Menu Group',
            'page2' => '',
            'link01' => base_url() . '/menu_group',
            'link02' => '',
            'data_menu_group' => $this->Menu_group_Model->get_menu_group()->getResultArray(),
            // 'data_member'	=> $this->data_dashboard->getjmlMember(),
            // 'data_customer' 	=> $this->data_dashboard->getjmlCustomer(),
            // 'data_order'    	=> $this->data_dashboard->getjmlOrder(),
            // 'data_jual'     	=> $this->data_dashboard->getjmlJual(),
            // 'popular_product'   => $this->data_dashboard->popular_product(),
            // 'invoice_terbaru'   => $this->data_dashboard->invoice_terbaru(),
            'componen' => 'theme/BeyondAdmin/halaman/setting/menu_group/daftar_menu_group'
        );
        echo view('layout', $data);
    }


    public function add()
    {
        $user_id = session()->get('user_id');
        $username = session()->get('username');
        $firstname = session()->get('firstname');
        $lastname = session()->get('lastname');

        // $this->History->save([
        //     'user_id'    => $user_id,
        //     'username'   => $username,
        //     'name'       => $firstname.' '.$lastname,
        //     'kegiatan'   => 'Dashboard',
        //     'jenis_kegiatan'     => 'Login/Dashboard',
        //     'tanggal_waktu'  => date('Y-m-d H:i:s')
        // ]);

        // $this->data_dashboard = new DashboardModel();



        $data = array(
            'title' => 'MCS - Manajemen Compro System',
            'description' => 'Aplikasi MCS - Manajemen Compro System',
            'keywords' => 'MCS, Manajemen, Compro',
            'author' => 'SSN',
            'parent_id_menu' => '18',
            'parent_id_submenu' => '22',
            'id_menu' => '23',
            'page1' => 'Add Menu Group',
            'page2' => 'Menu Group',
            'link01' => base_url() . '/menu_group/add',
            'link02' => base_url() . '/menu_group',
            'name' => old('name'),
            'description' => old('description'),
            'active' => 0,
            'id' => 0,
            'status' => 'add',
            'url_form' => base_url('menu_group/save'),

            'componen' => 'theme/BeyondAdmin/halaman/setting/menu_group/add_menu_group'
        );
        echo view('layout', $data);
    }

    public function edit($id)
    {
        $user_id = session()->get('user_id');
        $username = session()->get('username');
        $firstname = session()->get('firstname');
        $lastname = session()->get('lastname');

        // $this->History->save([
        //     'user_id'    => $user_id,
        //     'username'   => $username,
        //     'name'       => $firstname.' '.$lastname,
        //     'kegiatan'   => 'Dashboard',
        //     'jenis_kegiatan'     => 'Login/Dashboard',
        //     'tanggal_waktu'  => date('Y-m-d H:i:s')
        // ]);

        // $this->data_dashboard = new DashboardModel();
        $dt_menu_group = $this->Menu_group_Model->get_menu_group($id)->getResult();

        $data = array(
            'title' => 'MCS - Manajemen Compro System',
            'description' => 'Aplikasi MCS - Manajemen Compro System',
            'keywords' => 'MCS, Manajemen, Compro',
            'author' => 'SSN',
            'parent_id_menu' => '18',
            'parent_id_submenu' => '22',
            'id_menu' => '23',
            'page1' => 'Edit Menu Group',
            'page2' => 'Menu Group',
            'link01' => base_url() . '/menu_group/edit',
            'link02' => base_url() . '/menu_group',
            'name' => $dt_menu_group[0]->name,
            'description' => $dt_menu_group[0]->description,
            'active' => $dt_menu_group[0]->active,
            'id' => $dt_menu_group[0]->id,
            'status' => 'edit',
            'url_form' => base_url('menu_group/update'),

            'componen' => 'theme/BeyondAdmin/halaman/setting/menu_group/add_menu_group'
        );
        echo view('layout', $data);
    }

    public function save()
    {
        if (
            !$this->validate([
                'name' => [
                    'rules' => 'required|min_length[3]',
                    'error' => [
                        'required' => 'Nama Group Harus diisi'
                    ]
                ]
            ])
        ) {
            session()->setFlashdata('error', $this->validator->listErrors());
            return redirect()->back()->withinput();
        } else {

            $active = 0;
            // $this->request->getVar('active');
            if (!is_null($this->request->getVar('active'))) {
                $active = 1;
            }

            $data = array(
                'name' => $this->request->getVar('name'),
                'description' => $this->request->getVar('description'),
                'active' => $active,
            );

            $this->Menu_group_Model->save_menu_group($data);

            return redirect()->to(base_url('menu_group'));
        }
    }

    public function update()
    {
        if (
            !$this->validate([
                'name' => [
                    'rules' => 'required|min_length[3]',
                    'error' => [
                        'required' => 'Nama Group Harus diisi'
                    ]
                ]
            ])
        ) {
            session()->setFlashdata('error', $this->validator->listErrors());
            return redirect()->back()->withinput();
        } else {

            $active = 0;
            if (!is_null($this->request->getVar('active'))) {
                $active = 1;
            }
            $id = $this->request->getVar('id');

            $data = array(
                'name' => $this->request->getVar('name'),
                'description' => $this->request->getVar('description'),
                'active' => $active,
            );

            $this->Menu_group_Model->update_menu_group($data, $id);

            return redirect()->to(base_url('menu_group'));
        }
    }

    public function delete($id)
    {
        $data = array(
            'trash' => 1,
        );

        $this->Menu_group_Model->update_menu_group($data, $id);

        return redirect()->to(base_url('menu_group'));
    }

    function edit_active()
    {

        $id = $this->request->getVar('ids');

        $active = 0;
        if (!is_null($this->request->getVar('active'))) {
            $active = 1;
        }


        $data = array(
            'active' => $active,
        );

        //return redirect()->to(base_url());		
        var_dump($data);
        die;

        $this->Menu_group_Model->update_menu_group($data, $id);

        // return redirect()->to(base_url('menu_group'));
    }

    function simpan_active()
    {

        $id = $this->request->getVar('ids');

        $active = $this->request->getVar('cek');

        $data = array(
            'active' => $active,
        );


        $this->Menu_group_Model->update_menu_group($data, $id);


    }

}
?>

WonXd677 Sh3LL