Viewing file: Proveedor.php (2.03 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class proveedor extends CI_Controller {
function __construct() { parent::__construct(); $this->load->model('consultas_model'); /* Cargamos la base de datos */ $this->load->database(); $this->load->library('javascript'); $this->load->library('Grocery_Crud'); /* Cargamos la libreria*/ $this->load->library('session'); /* Añadimos el helper al controlador */ $this->load->helper('url'); error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); } public function index() { if($this->session->userdata('loginuser') == TRUE) { try{ /* Creamos el objeto */ $crud = new grocery_CRUD(); /* Seleccionamos el tema */ $crud->set_theme('datatables'); /* Seleccionmos el nombre de la tabla de nuestra base de datos*/ $crud->set_table('proveedores'); /* Le asignamos un nombre */ $crud->set_subject('Proveedores'); $crud->order_by('nombre','asc'); /* Asignamos el idioma español */ $crud->set_language('spanish'); /* Aqui le decimos a grocery que estos campos son obligatorios */ $crud->required_fields( 'id', 'nombre', 'razon_social', 'direccion', 'telefono', 'cuit' ); /* Aqui le indicamos que campos deseamos mostrar */ $crud->columns( 'nombre', 'razon_social', 'direccion', 'telefono', 'cuit', 'localidad', 'mail' ); /* Generamos la tabla */ $output = $crud->render(); $data = array("pepe"=>$output, "contenido" =>"cliente_view", "titulo" =>"ADMINISTRACION PROVEEDORES" ); /* La cargamos en la vista situada en /applications/views/productos/administracion.php */ $this->load->view('template',$data); }catch(Exception $e){ /* Si algo sale mal cachamos el error y lo mostramos */ show_error($e->getMessage().' --- '.$e->getTraceAsString()); } } else { redirect(base_url().'login', 'refresh'); } } }
|