Exemple #1
0
    public function mostrar($datos = '')
    {
        $cabecera = array('titulo' => $this->titulo, 'estilo' => $this->estilo, 'javascript' => $this->javascript, 'nombre' => $this->session->userdata('nombre') . ' ' . $this->session->userdata('apellidos'), 'usuario' => $this->session->userdata('usuario'));
        $this->load->view('plantillas/cabecera_paginas.php', $cabecera);
        if (!isset($datos['backend'])) {
            $num = Profesor_model::numero();
            $profesores = Profesor_model::obtener('Nombre', 'asc', 0, $num);
            $data['profesores'] = array();
            if (!empty($profesores)) {
                foreach ($profesores as $profesor) {
                    $data['profesores'][$profesor->Codigo] = $profesor->Nombre . ' ' . $profesor->Apellido1 . ' ' . $profesor->Apellido2;
                }
            }
            $num = Asignatura_model::numero();
            $asignaturas = Asignatura_model::obtener('Nombre', 'asc', 0, $num);
            $data['asignaturas'] = array();
            if (!empty($asignaturas)) {
                foreach ($asignaturas as $asignatura) {
                    $data['asignaturas'][$asignatura->Codigo] = $asignatura->Nombre;
                }
            }
            $this->load->view('plantillas/header_paginas.php', $data);
            $this->load->view('paginas/' . $this->pagina, $datos);
            $this->load->view('plantillas/pie_paginas.php', $datos);
        } else {
            if ($this->uri->segment('1') != 'login') {
                $data = '';
                if ($this->uri->segment('2') != 'calendario') {
                    $preferencias = array('show_next_prev' => FALSE, 'start_day' => 'monday');
                    $preferencias['template'] = '
                        {table_open}<table class="calendario table table-condensed table-bordered hidden-sm">{/table_open}

                        {heading_row_start}<tr>{/heading_row_start}


                        {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}


                        {heading_row_end}</tr>{/heading_row_end}

                        {week_row_start}<tr>{/week_row_start}
                        {week_day_cell}<td >{week_day}</td>{/week_day_cell}
                        {week_row_end}</tr>{/week_row_end}

                        {cal_row_start}<tr>{/cal_row_start}
                        {cal_cell_start}<td>{/cal_cell_start}

                        {cal_cell_no_content}
                             <div >{day}</div>
                        {/cal_cell_no_content}

                        {cal_cell_no_content_today}
                             <div id="hoy">{day}</div>
                        {/cal_cell_no_content_today}

                        {cal_cell_blank}&nbsp;{/cal_cell_blank}

                        {cal_cell_end}</td>{/cal_cell_end}
                        {cal_row_end}</tr>{/cal_row_end}

                        {table_close}</table>{/table_close}
                    ';
                    $this->load->library('calendar', $preferencias);
                    $data['calendar'] = $this->calendar->generate();
                }
                if (is_array($this->javascript)) {
                    array_push($this->javascript, 'confirmacion');
                    $cabecera['javascript'] = $this->javascript;
                } else {
                    $cabecera['javascript'] = array($this->javascript, 'confirmacion');
                }
                $this->load->view('plantillas/header_backend.php', $cabecera);
                $this->load->view('plantillas/menu_lateral_admin.php', $data);
                if ($this->menu != '') {
                    $this->load->view('plantillas/' . $this->menu);
                }
            }
            $this->load->view('backend/' . $this->pagina, $datos);
        }
    }
Exemple #2
0
 public function buscar($campo = 'Nombre', $orden = 'asc', $limit = '5', $busqueda = '', $offset = 0)
 {
     $this->pagina = 'profesores';
     $this->titulo = 'buscar profesor';
     $this->menu = 'menu_profesor';
     $this->estilo = array('backend', 'tablas');
     $this->javascript = array('marcar_checkbox');
     $datos['busqueda'] = TRUE;
     $datos['backend'] = TRUE;
     if ($busqueda != '') {
         $datos['buscador'] = array('class' => 'search-query input-medium', 'type' => 'text', 'name' => 'buscador', 'placeholder' => 'Buscar', 'value' => urldecode($busqueda), 'autofocus' => 'autofocus');
     } else {
         $datos['buscador'] = array('class' => 'search-query input-medium', 'type' => 'text', 'name' => 'buscador', 'placeholder' => 'Buscar', 'value' => $this->input->post('buscador'), 'autofocus' => 'autofocus');
     }
     $datos['boton'] = array('class' => 'btn', 'id' => 'buscador', 'name' => 'button', 'value' => 'Buscar');
     $datos['borrar'] = array('class' => 'btn btn-danger', 'id' => 'borrar', 'value' => 'Borrar selección', 'data-confirm' => "¿Estás seguro?");
     $datos['fields'] = array('Nombre' => 'Nombre', 'Email' => 'Email', 'DNI' => 'DNI', 'FechaNacimiento' => 'F. nacimiento', 'FechaAlta' => 'Alta', 'FechaUltimoAcceso' => 'Último acceso');
     if ($this->_validarBusqueda() == FALSE) {
         if ($busqueda != '') {
             $busqueda = urldecode($busqueda);
             $busq_cant = Profesor_model::busqueda_cantidad($busqueda);
             $opciones = $this->seleccion($busq_cant);
             $datos['opciones'] = $opciones;
             if ($this->input->post('cantidad') != '') {
                 if ($opciones[$this->input->post('cantidad')] == 'Todo') {
                     $limit = $busq_cant;
                 } else {
                     $limit = $opciones[$this->input->post('cantidad')];
                 }
             }
             $datos['elementos'] = $limit;
             if ($this->input->post('cantidad') != '') {
                 $datos['limit'] = $this->input->post('cantidad');
             } else {
                 $aux = 0;
                 if ($limit % 5 != 0) {
                     $aux = 1;
                 }
                 $datos['limit'] = floor($limit / 5) - 1 + $aux;
             }
             $datos['busq'] = $busqueda;
             $datos['profesores'] = Profesor_model::buscar($busqueda, $campo, $orden, $offset, $limit);
             $datos['numero'] = $busq_cant;
             $config = array();
             $config['base_url'] = base_url() . "admin/profesores/buscar/" . $campo . "/" . $orden . "/" . $limit . "/" . $busqueda . "/";
             $config['total_rows'] = $busq_cant;
             $config['per_page'] = $limit;
             $config['uri_segment'] = 8;
             $config['prev_link'] = 'anterior';
             $config['next_link'] = 'siguiente';
             $config['first_link'] = '<<';
             $config['last_link'] = '>>';
             $config['num_tag_open'] = '<li>';
             $config['num_tag_close'] = '</li>';
             $config['cur_tag_open'] = '<li class="disabled"><a href="#">';
             $config['cur_tag_close'] = '</a></li>';
             $config['prev_tag_open'] = '<li>';
             $config['prev_tag_close'] = '</li>';
             $config['next_tag_open'] = '<li>';
             $config['next_tag_close'] = '</li>';
             $config['first_tag_open'] = '<li>';
             $config['first_tag_close'] = '</li>';
             $config['last_tag_open'] = '<li>';
             $config['last_tag_close'] = '</li>';
             $this->pagination->initialize($config);
             $datos['links'] = $this->pagination->create_links();
             $datos['campo'] = $campo;
             $datos['orden'] = $orden;
         } else {
             $datos['numero'] = 0;
             $datos['opciones'] = array(0);
             $datos['campo'] = $campo;
             $datos['orden'] = $orden;
             $datos['buscar'] = '';
             $datos['limit'] = 0;
             $datos['elementos'] = 0;
             $datos['busq'] = '';
             $datos['vacio'] = TRUE;
         }
         $this->mostrar($datos);
     } else {
         $busqueda = $this->input->post('buscador');
         $busq_cant = Profesor_model::busqueda_cantidad($busqueda);
         $opciones = $this->seleccion($busq_cant);
         $datos['opciones'] = $opciones;
         if ($this->input->post('cantidad') != '') {
             if ($opciones[$this->input->post('cantidad')] == 'Todo') {
                 $limit = Profesor_model::numero();
             } else {
                 $limit = $opciones[$this->input->post('cantidad')];
             }
         }
         $datos['elementos'] = $limit;
         if ($this->input->post('cantidad') != '') {
             $datos['limit'] = $this->input->post('cantidad');
         } else {
             $aux = 0;
             if ($limit % 5 != 0) {
                 $aux = 1;
             }
             $datos['limit'] = floor($limit / 5) - 1 + $aux;
         }
         $datos['busq'] = $busqueda;
         $datos['profesores'] = Profesor_model::buscar($busqueda, $campo, $orden, $offset, $limit);
         $datos['numero'] = $busq_cant;
         $config = array();
         $config['base_url'] = base_url() . "admin/profesores/buscar/" . $campo . "/" . $orden . "/" . $limit . "/" . $busqueda . "/";
         $config['total_rows'] = $busq_cant;
         $config['per_page'] = $limit;
         $config['uri_segment'] = 7;
         $config['prev_link'] = 'anterior';
         $config['next_link'] = 'siguiente';
         $config['first_link'] = '<<';
         $config['last_link'] = '>>';
         $config['num_tag_open'] = '<li>';
         $config['num_tag_close'] = '</li>';
         $config['cur_tag_open'] = '<li class="disabled"><a href="#">';
         $config['cur_tag_close'] = '</a></li>';
         $config['prev_tag_open'] = '<li>';
         $config['prev_tag_close'] = '</li>';
         $config['next_tag_open'] = '<li>';
         $config['next_tag_close'] = '</li>';
         $config['first_tag_open'] = '<li>';
         $config['first_tag_close'] = '</li>';
         $config['last_tag_open'] = '<li>';
         $config['last_tag_close'] = '</li>';
         $this->pagination->initialize($config);
         $datos['links'] = $this->pagination->create_links();
         $datos['campo'] = $campo;
         $datos['orden'] = $orden;
         $this->mostrar($datos);
     }
 }