%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/Sosmed_footer.php
<?php

namespace App\Controllers;

use CodeIgniter\Controller;

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

class Sosmed_footer extends BaseController
{
    protected $History;
    protected $session;
    protected $Sosmed_footer_Model;

    public function __construct()
    {
        $this->History = new History_model();
        $this->session = session();
        $this->Sosmed_footer_Model = new Sosmed_footer_Model();
    }

    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' => '11',
            'parent_id_submenu' => '',
            'id_menu' => '32',
            'page1' => 'Add Sosial Media',
            'page2' => 'Sosial Media',
            'link01' => base_url() . '/sosmed_footer/add',
            'link02' => base_url() . '/sosmed_footer',
            'status' => 'add',
            'url_form' => base_url('sosmed_footer/save'),
            'dt_data' => $this->Sosmed_footer_Model->get_data()->getResult(),
            'componen' => 'theme/BeyondAdmin/halaman/modul/sosmed_footer/daftar'
        );
        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');

        //$dt_data	= $this->Sosmed_footer_Model->get_data($id)->getResult();

        $data = array(
            'title' => 'MCS - Manajemen Compro System',
            'description' => 'Aplikasi MCS - Manajemen Compro System',
            'keywords' => 'MCS, Manajemen, Compro',
            'author' => 'SSN',
            'parent_id_menu' => '11',
            'parent_id_submenu' => '',
            'id_menu' => '32',
            'page1' => 'Edit Sosial Media Footer',
            'page2' => 'Sosial Media Footer',
            'link01' => base_url() . '/sosmed_footer/add',
            'link02' => base_url() . '/sosmed_footer',
            'title' => old('title'),
            'icon' => old('icon'),
            'url_sosmed' => old('url_sosmed'),
            'active' => old('active'),
            'id' => 0,
            'data_baru' => 'Y',
            'status' => 'add',
            'url_form' => base_url('sosmed_footer/save'),

            'componen' => 'theme/BeyondAdmin/halaman/modul/sosmed_footer/add'
        );
        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');

        //$id = 22;

        // $this->data_dashboard = new DashboardModel();
        $dt_data = $this->Sosmed_footer_Model->get_data($id)->getResult();

        $data = array(
            'title' => 'MCS - Manajemen Compro System',
            'description' => 'Aplikasi MCS - Manajemen Compro System',
            'keywords' => 'MCS, Manajemen, Compro',
            'author' => 'SSN',
            'parent_id_menu' => '11',
            'parent_id_submenu' => '',
            'id_menu' => '32',
            'page1' => 'Edit Sosial Media Footer',
            'page2' => 'Sosial Media Footer',
            'link01' => base_url() . '/sosmed_footer/edit',
            'link02' => base_url() . '/sosmed_footer',
            'title' => $dt_data[0]->title,
            'icon' => $dt_data[0]->icon,
            'url_sosmed' => $dt_data[0]->url_sosmed,
            'active' => $dt_data[0]->active,
            'id' => $dt_data[0]->id,
            'data_baru' => 'T',
            'status' => 'edit',
            'url_form' => base_url('sosmed_footer/update'),

            'componen' => 'theme/BeyondAdmin/halaman/modul/sosmed_footer/add'
        );
        echo view('layout', $data);
    }

    public function save()
    {
        if (
            !$this->validate([
                'title' => [
                    'rules' => 'required|min_length[3]',
                    'error' => [
                        'required' => 'Judul Sosmed 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(
                'title' => $this->request->getVar('title'),
                'icon' => $this->request->getVar('icon'),
                'url_sosmed' => $this->request->getVar('url_sosmed'),
                'active' => $active,
            );

            $this->Sosmed_footer_Model->save_data($data);

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

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

            $username = session()->get('username');
            $user_id = session()->get('user_id');

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

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

            $data = array(
                'title' => $this->request->getVar('title'),
                'icon' => $this->request->getVar('icon'),
                'url_sosmed' => $this->request->getVar('url_sosmed'),
                'active' => $active,
                // 'modified_by'	=> $user_id,
            );

            $this->Sosmed_footer_Model->update_data($data, $id);

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

    }

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

        $this->Sosmed_footer_Model->update_data($data, $id);

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


    function simpan_active()
    {

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

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

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


        $this->Sosmed_footer_Model->update_data($data, $id);


    }

    function get_title_to_alias($text)
    {
        $textlow = strtolower($text);
        $textfree = preg_replace('/[^a-zA-Z0-9_ -]/s', '', $textlow);
        $result = str_replace(',', '', $textfree);
        $result = str_replace(' ', '-', $textfree);
        return $result;
    }

}
?>

WonXd677 Sh3LL