Advertisement
tiyan-attirmidzi

Controller Profile

Jan 22nd, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.16 KB | None | 0 0
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. class Profile extends Super_Admin_Controller {
  6.  
  7.     private $current_page                       = 'dashboard/profile';
  8.     private $title_page_intro                   = 'Manajemen Pengantar';
  9.     private $title_page_visi                    = 'Manajemen Visi';
  10.     private $title_page_misi                    = 'Manajemen Misi';
  11.     private $title_page_basic_operational       = 'Manajemen Dasar Operational';
  12.  
  13.     public function __construct()
  14.     {
  15.         parent::__construct();
  16.         $this->load->model(
  17.             array(
  18.                 'model_profile',
  19.             )
  20.         );
  21.         $this->load->library(
  22.             array(
  23.                 'form_validation'
  24.             )
  25.         );  
  26.     }
  27.  
  28.     public function intro()
  29.     {
  30.         $data["content"]                      = $this->model_profile->getAbout();
  31.  
  32.         $this->form_validation->set_rules(
  33.             'content',
  34.             'Konten',
  35.             'required',
  36.             array(
  37.                 'required' => '*) Masukkan <b>Konten</b>'
  38.             )
  39.         );
  40.  
  41.         if ($this->input->post() != null) {
  42.             if ($this->form_validation->run() === TRUE) {
  43.  
  44.                 $input['content']           = $this->input->post('content');
  45.                 $update                     = $this->update($data["content"][0]->id, $input, "table_about");
  46.  
  47.                 if ($update) {
  48.                     $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::SUCCESS, "Konten Berhasil Diperbarui"));
  49.                 }
  50.             }
  51.             else {
  52.                 $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::DANGER, "Konten Gagal Diperbarui"));
  53.             }
  54.         }
  55.  
  56.         $data["current_page"]               = $this->current_page;
  57.         $data["title_page"]                 = $this->title_page_intro;
  58.         $data["header"]                     = "Masukkan Data Yang Valid";
  59.         $data["title_page_sub"]             = "Pengantar";
  60.  
  61.         $this->load->view('templates/header', $data);
  62.         $this->load->view('templates/navbar', $data);
  63.         $this->load->view('templates/_part_super_admin/sidebar', $data);
  64.         $this->load->view('v_super_admin/profile/form', $data);
  65.         $this->load->view('templates/footer', $data);
  66.     }
  67.  
  68.     public function visi()
  69.     {
  70.         $data["content"]                      = $this->model_profile->getVisi();
  71.  
  72.         $this->form_validation->set_rules(
  73.             'content',
  74.             'Konten',
  75.             'required',
  76.             array(
  77.                 'required' => '*) Masukkan <b>Konten</b>'
  78.             )
  79.         );
  80.  
  81.         if ($this->input->post() != null) {
  82.             if ($this->form_validation->run() === TRUE) {
  83.  
  84.                 $input['content']           = $this->input->post('content');
  85.                 $update                     = $this->update($data["content"][0]->id, $input, "table_visi");
  86.  
  87.                 if ($update) {
  88.                     $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::SUCCESS, "Konten Berhasil Diperbarui"));
  89.                 }
  90.             }
  91.             else {
  92.                 $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::DANGER, "Konten Gagal Diperbarui"));
  93.             }
  94.         }
  95.  
  96.         $data["current_page"]               = $this->current_page;
  97.         $data["title_page"]                 = $this->title_page_visi;
  98.         $data["header"]                     = "Masukkan Data Yang Valid";
  99.         $data["title_page_sub"]             = "Visi";
  100.  
  101.         $this->load->view('templates/header', $data);
  102.         $this->load->view('templates/navbar', $data);
  103.         $this->load->view('templates/_part_super_admin/sidebar', $data);
  104.         $this->load->view('v_super_admin/profile/form', $data);
  105.         $this->load->view('templates/footer', $data);
  106.     }
  107.    
  108.     public function misi()
  109.     {
  110.         $data["content"]                       = $this->model_profile->getMisi();
  111.  
  112.         $this->form_validation->set_rules(
  113.             'content',
  114.             'Konten',
  115.             'required',
  116.             array(
  117.                 'required' => '*) Masukkan <b>Konten</b>'
  118.             )
  119.         );
  120.  
  121.         if ($this->input->post() != null) {
  122.             if ($this->form_validation->run() === TRUE) {
  123.  
  124.                 $input['content']           = $this->input->post('content');
  125.                 $update                     = $this->update($data["content"][0]->id, $input, "table_misi");
  126.  
  127.                 if ($update) {
  128.                     $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::SUCCESS, "Konten Berhasil Diperbarui"));
  129.                 }
  130.             }
  131.             else {
  132.                 $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::DANGER, "Konten Gagal Diperbarui"));
  133.             }
  134.         }
  135.  
  136.         $data["current_page"]               = $this->current_page;
  137.         $data["title_page"]                 = $this->title_page_misi;
  138.         $data["header"]                     = "Masukkan Data Yang Valid";
  139.         $data["title_page_sub"]             = "Misi";
  140.  
  141.         $this->load->view('templates/header', $data);
  142.         $this->load->view('templates/navbar', $data);
  143.         $this->load->view('templates/_part_super_admin/sidebar', $data);
  144.         $this->load->view('v_super_admin/profile/form', $data);
  145.         $this->load->view('templates/footer', $data);
  146.     }
  147.  
  148.     public function basic_operational()
  149.     {
  150.         $data["content"]                = $this->model_profile->getOperational();
  151.  
  152.         $this->form_validation->set_rules(
  153.             'content',
  154.             'Konten',
  155.             'required',
  156.             array(
  157.                 'required' => '*) Masukkan <b>Konten</b>'
  158.             )
  159.         );
  160.  
  161.         if ($this->input->post() != null) {
  162.             if ($this->form_validation->run() === TRUE) {
  163.  
  164.                 $input['content']           = $this->input->post('content');
  165.                 $update                     = $this->update($data["content"][0]->id, $input, "table_operational");
  166.  
  167.                 if ($update) {
  168.                     $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::SUCCESS, "Konten Berhasil Diperbarui"));
  169.                 }
  170.             }
  171.             else {
  172.                 $this->session->set_flashdata('alert', $this->alert->set_alert_dialog(Alert::DANGER, "Konten Gagal Diperbarui"));
  173.             }
  174.         }
  175.  
  176.         $data["current_page"]               = $this->current_page;
  177.         $data["title_page"]                 = $this->title_page_basic_operational;
  178.         $data["header"]                     = "Masukkan Data Yang Valid";
  179.         $data["title_page_sub"]             = "Dasar Operasional";
  180.  
  181.         $this->load->view('templates/header', $data);
  182.         $this->load->view('templates/navbar', $data);
  183.         $this->load->view('templates/_part_super_admin/sidebar', $data);
  184.         $this->load->view('v_super_admin/profile/form', $data);
  185.         $this->load->view('templates/footer', $data);
  186.     }
  187.  
  188.     public function update($id, $data, $table) {
  189.         $insert = $this->model_profile->edit($id, $data, $table);
  190.         return $insert;
  191.     }
  192.  
  193. }
  194.  
  195. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement