Admin.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Admin extends CI_Controller {
  3. public function __construct()
  4. {
  5. parent::__construct();
  6. if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != 'admin' || $_SERVER['PHP_AUTH_PW'] != 'Fernando1') {
  7. header('WWW-Authenticate: Basic realm="Acceso a Administrador"');
  8. header('HTTP/1.0 401 Unauthorized');
  9. die('Access Denied');
  10. }
  11. $this->load->database();
  12. $this->load->helper('url');
  13. $this->load->library('grocery_CRUD');
  14. }
  15. public function _example_output($output = null)
  16. {
  17. $this->load->view('example.php',(array)$output);
  18. }
  19. public function offices()
  20. {
  21. $output = $this->grocery_crud->render();
  22. $this->_example_output($output);
  23. }
  24. public function index()
  25. {
  26. $this->_example_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
  27. }
  28. public function deptos()
  29. {
  30. $crud = new grocery_CRUD();
  31. $crud->set_table('datos_x_depto');
  32. $output = $crud->render();
  33. $this->_example_output($output);
  34. }
  35. public function distribuidoras()
  36. {
  37. $crud = new grocery_CRUD();
  38. $crud->set_table('distribuidoras');
  39. $output = $crud->render();
  40. $this->_example_output($output);
  41. }
  42. public function datospanel()
  43. {
  44. $crud = new grocery_CRUD();
  45. $crud->set_table('datosPanel');
  46. $output = $crud->render();
  47. $this->_example_output($output);
  48. }
  49. }