Guest User

Untitled

a guest
Feb 23rd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') or exit('No direct script access allowed');
  3.  
  4. class MY_Controller extends CI_Controller
  5. {
  6. /*****************************************************************************/
  7. public function __construct()
  8. {
  9. parent::__construct();
  10.  
  11. define('base', rtrim(base_url(), '/'));
  12. $this->data['base'] = base;
  13. $this->data['tahun'] = date('Y');
  14. $this->data['CI_VERSION'] = CI_VERSION;
  15. $this->data['site_title'] = 'Contoh';
  16.  
  17. if (isset($_SESSION['user_info'])) {
  18. $this->data['user_info'] = $_SESSION['user_info'];
  19. $this->data['is_login'] = 'is_login';
  20. $this->data['is_logout'] = 'hidden';
  21. $this->data['is_admin'] = $_SESSION['user_info'][0]->user_level == 2 ? 'is_admin' : 'hidden';
  22. $this->_is_admin = $_SESSION['user_info'][0]->user_level == 2 ? true : false;
  23. $this->_is_login = true;
  24. } else {
  25. $this->data['user_info'] = array();
  26. $this->data['is_login'] = 'hidden';
  27. $this->data['is_admin'] = 'hidden';
  28. $this->data['is_logout'] = 'is_logout';
  29. $this->_is_admin = false;
  30. $this->_is_login = false;
  31. }
  32. }
  33. /*****************************************************************************/
  34. }
  35.  
  36. /* End of file MY_Controller.php */
  37. /* Location: ./application/core/MY_Controller.php */
Add Comment
Please, Sign In to add comment