<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
include_once GROCERY_CRUD;
class Fluxo extends Grocery{
	
	protected $crud;
	function __construct()
	{
		parent::__construct();
		$this->load->model('administrativo/admin_model');
		
	}
	

    function quadros()
	{			
		try{
		    //$this->ini_method();
			$crud = new grocery_CRUD();
			//$this->valida_acoes($crud);
			
			$crud->set_theme('bootstrap');
			
			$crud->set_table('flx_quadro');
			$crud->set_subject('flx_quadro');
			
			$stateInfo = $crud->getStateInfo();
			$state = $crud->getState();
			
			if($state == 'list')
			    $crud->set_relation_n_n('sequencia', 'flx_quadro_rel_lista', 'flx_lista', 'id_quadro', 'id_lista', 'lista','sequencia');
			else
			    $crud->set_relation_n_n('sequencia', 'flx_quadro_rel_lista', 'flx_lista', 'flx_quadro_rel_lista.id_quadro', 'id_lista', 'lista','sequencia');
			
			
			$output = $crud->render();
			
			$this->_example_output($output);
			
		}catch(Exception $e){
			show_error($e->getMessage().' --- '.$e->getTraceAsString());
		}
	}
    function listas()
	{			
		try{
		    //$this->ini_method();
			$crud = new grocery_CRUD();
			//$this->valida_acoes($crud);
			
			$crud->set_theme('bootstrap');
			
			$crud->set_table('flx_lista');
			$crud->set_subject('flx_lista');
			
			$crud->set_relation('id_quadro','flx_quadro','quadro');
			
			$crud->set_relation_n_n('Permição', 'flx_lista_rel_perfil', 'sys_perfil', 'id_lista', 'id_perfil', 'perfil');
			
			$stateInfo = $crud->getStateInfo();
			$state = $crud->getState();
			
			$output = $crud->render();
			
			$this->_example_output($output);
			
		}catch(Exception $e){
			show_error($e->getMessage().' --- '.$e->getTraceAsString());
		}
	}
    function cards()
	{			
		try{
		    //$this->ini_method();
			$crud = new grocery_CRUD();
			//$this->valida_acoes($crud);
			
			$crud->set_theme('bootstrap');
			
			$crud->set_table('flx_card');
			$crud->set_subject('flx_card');
			
			$crud->set_relation('id_lista','flx_lista','lista');
			//$crud->set_relation('id_quadro','flx_quadro','quadro');
			
			$stateInfo = $crud->getStateInfo();
			$state = $crud->getState();
			
			$output = $crud->render();
			
			$this->_example_output($output);
			
		}catch(Exception $e){
			show_error($e->getMessage().' --- '.$e->getTraceAsString());
		}
	}
	
	
}