<?php
/****************************************************************************************
 * DEV: CONTRALORIA DE ESTADOS
 * PROYECTO: SISTEMA INTEGRAL ADMINISTRATIVO DE CONTRALORIAS DE ESTADOS
 * MODULO: Parque Automotor
 * PROCESO: Listado de revisiones de vehículos
 * PROGRAMADORES:
 * | # |          NOMBRES Y APELLIDOS           |               CORREO                |          TELEFONO              |
 * | 1 |           José Pereda                  |dt.ait.programador2@cgesucre.gob.ve  |         04248040078            |
 * |   |                                        |                                     |                                |
 * |___|________________________________________|_____________________________________|________________________________|
 *
 * VERSION
 *
 * |          PROGRAMADOR                  |          FECHA          |       VERSION      |
 * |               #1                      |        09-07-2015       |         1.0        |
 * |                                       |                         |                    |
 * |_______________________________________|_________________________|____________________|
 *
 *****************************************************************************************/

class tiempoRecorridoControlador extends Controlador
{
    private $tiempoRecorridoModelo;

    public function __construct()
    {
        parent::__construct();
        Session::metAcceso();
        $this->tiempoRecorridoModelo = $this->metCargarModelo('tiempoRecorrido');
    }
	



    public function metIndex()
    {
        $complementosCss = array(
            'DataTables/jquery.dataTables',
            'DataTables/extensions/dataTables.colVis941e',
            'DataTables/extensions/dataTables.tableTools4029',
            'select2/select201ef',
            'jquery-ui-selectable/jquery-ui',
        );
        $complementosJs = array(
            'select2/select2.min',
            'DataTables/datatable',
            'mask/jquery.mask',
            'wizard/jquery.bootstrap.wizard.min',
            'jquery-ui-selectable/jquery-ui',);
        $js[] = 'materialSiace/core/demo/DemoTableDynamic';
        $js[] = 'Scripts/Form';

        $this->atVista->metCargarCssComplemento($complementosCss);
        $this->atVista->metCargarJsComplemento($complementosJs);
        $this->atVista->metCargarJs($js);
        $validar = array(
            'jquery-validation/dist/jquery.validate.min',
            'jquery-validation/dist/additional-metholistadods.min'
        );


        $tiemposRecorrido = $this->tiempoRecorridoModelo->metListarTiemposdeRecorrido();

        $this->atVista->assign('tiemposRecorrido', $tiemposRecorrido);

        /*$error = error_get_last();
        echo ' | error: ';
        print_r($error);*/

        /*echo '<pre>';
        print_r($tiemposRecorrido);
        echo '</pre>'*/;

        $this->atVista->metRenderizar('listado');
    }
    public function metOpenTiempoRecorrido($opcion = 'nuevo')
    {
        $complementosCss = array(
            'DataTables/jquery.dataTables',
            'wizard/wizardfa6c',
            'jquery-validation/dist/site-demo',
            'select2/select201ef',
            'bootstrap-datepicker/datepicker',
            'timeLine/timeline',
            'sweet-alert/sweet-alert.min'
        );
        $complementoJs = array(
            'jquery-validation/dist/jquery.validate.min',
            'jquery-validation/dist/additional-methods.min',
            'select2/select2.min',
            'wizard/jquery.bootstrap.wizard.min',
            'bootstrap-datepicker/bootstrap-datepicker',
            'ckeditor/ckeditor',
            'ckeditor/adapters/jquery',

            'sweet-alert/sweet-alert.min'



        );
        $js = array(//'materialSiace/core/demo/DemoTableDynamic',
            'materialSiace/core/demo/DemoFormWizard',
            'materialSiace/core/demo/DemoFormComponents',
            'materialSiace/core/demo/DemoFormEditors',
            'Scripts/Form'
        );
        $js[] = 'Aplicacion/appFunciones';
        $this->atVista->metCargarCssComplemento($complementosCss);
        $this->atVista->metCargarJsComplemento($complementoJs);
        $this->atVista->metCargarJs($js);

        $id = $_POST['id'];

        if($opcion == 'nuevo'){



        }elseif ($opcion == 'ver' || $opcion == 'modificar'){

            $tiempoRecorrido = $this->tiempoRecorridoModelo->metGetTiempoRecorrido($id);
            $this->atVista->assign('tiempoRecorrido',$tiempoRecorrido);

        }

        /*$error = error_get_last();
        echo ' | error: ';
        print_r($error);*/

         /*echo '<pre>';
           print_r($tipoCaracteristicasObjeto);
         echo '</pre>';*/


            $this->atVista->assign('id',$id);
            $this->atVista->assign('opcion',$opcion);

        $this->atVista->metRenderizar('crearModificar', 'modales');
    }
    function metInsertTiempoRecorrido(){
        $descripcion =$_POST['descripcion'];

        $insertTiempoRecorrido = $this->tiempoRecorridoModelo->metInsertTiempoRecorrido($descripcion);


        /*$error = error_get_last();
        echo ' | error: ';
        print_r($error);*/


    }
    function metUpdateTiempoRecorrido(){

        $id =$_POST['id'];
        $descripcion =$_POST['descripcion'];

        $updateTiempoRecorrido = $this->tiempoRecorridoModelo->metUpdateTiempoRecorrido($id,$descripcion);


        return $updateTiempoRecorrido;

    }



}