Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.71 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Main extends CI_Controller {
  5.     public function __construct() {
  6.         parent::__construct();
  7.        
  8.     }
  9.  
  10.     public function index() {
  11.         if ( ! $this->session->userdata('logged') ) redirect('/login');
  12.        
  13.         $this->load->view('main/index',array('conteudo'=>'index'));
  14.     }
  15.  
  16.     public function tabulacao() {
  17.         if ( ! $this->session->userdata('logged') ) redirect('/login');
  18.             $this->load->library('form_validation');
  19.  
  20.             $this->form_validation->set_rules('teste', 'TESTE', 'required');
  21.         $this->form_validation->set_message('required','Este campo é obrigatório.');
  22.             $this->form_validation->set_error_delimiters('', '');
  23.  
  24.  
  25.  
  26.         print("<h1>".$this->uri->segment(4)."</h1>");
  27.  
  28.             if ($this->form_validation->run() == True) {
  29.             print('oi');
  30.         }
  31.  
  32.  
  33.         $conteudo='tabulacao';
  34.         $this->load->view('tabulacao/index.php',array('conteudo'=>$conteudo));
  35.     }
  36.  
  37.  
  38.     public function cadastro() {
  39.         if ( ! $this->session->userdata('logged') ) redirect('/login');
  40.    
  41.  
  42.         switch ( $this->uri->segment(3) ) {
  43.             case 'status':
  44.                 $this->load->library('grocery_CRUD');    
  45.                 $crud=new grocery_CRUD();
  46.                 $crud->set_table('status');
  47.                 $output = $crud->render();
  48.                 $this->load->view('cadastro/status.php',$output);
  49.  
  50.             break;
  51.             default:
  52.                 $this->load->view('main/index.php',array('conteudo'=>'cadastro'));
  53.             break;
  54.         }
  55.     }
  56.  
  57.     public function relatorios() {
  58.         if ( ! $this->session->userdata('logged') ) redirect('/login');
  59.  
  60.  
  61.         $this->load->library('grocery_CRUD');    
  62.         $crud=new grocery_CRUD();
  63.         $crud->set_table('mailing');
  64.         $output = $crud->render();
  65.         $this->load->view('main/relatorios.php',$output);
  66.     }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement