コード例 #1
0
ファイル: admin.php プロジェクト: jbgae/bareaarquitectos
 public function notificaciones()
 {
     if (!$this->input->is_ajax_request()) {
         redirect('404');
     } else {
         $notificaciones = array();
         $notificaciones['presupuestos'] = Presupuesto_model::numero_abiertos();
         $evento = new Evento_model();
         $notificaciones['eventos'] = count($evento->evento(date('Y-m-d'), $this->session->userdata('email')));
         $notificaciones['proyectos'] = Presupuesto_model::numero_aceptados();
         $notificaciones['tareas'] = Tarea_model::numeroTareasNuevas($this->session->userdata('email'), $this->session->userdata('ultimoAcceso'));
         $notificaciones['respuestas'] = Respuesta_model::numeroRespuestasNuevas($this->session->userdata('email'), $this->session->userdata('ultimoAcceso'));
         $notificaciones['notas'] = Notas_model::numeroNotasNuevas($this->session->userdata('email'), $this->session->userdata('ultimoAcceso'));
         $notificaciones['archivos'] = Archivo_model::numeroArchivosNuevos($this->session->userdata('email'), $this->session->userdata('ultimoAcceso'));
         $notificaciones['novedades'] = $notificaciones['presupuestos'] + $notificaciones['proyectos'] + $notificaciones['tareas'] + $notificaciones['respuestas'] + $notificaciones['notas'] + $notificaciones['archivos'];
         $notificaciones['chat'] = Chat_model::numero_mensajes_nuevos($this->session->userdata('ultimoAcceso'), $this->session->userdata('email'));
         echo json_encode($notificaciones);
     }
 }
コード例 #2
0
ファイル: evento.php プロジェクト: jbgae/bareaarquitectos
 private function _cargarFechas($eventos, $year, $month, $day = '', $proyecto = '')
 {
     if ($proyecto == '') {
         if ($this->session->userdata('usuario') == 'admin') {
             $proyectoFechas = Proyecto_model::obtenerFechas($year, $month, $day);
             $tareasFechas = Tarea_model::obtenerFechas($year, $month, $day);
         } else {
             $proyectoFechas = Proyecto_model::obtenerFechas($year, $month, $day, $this->session->userdata('email'));
             $tareasFechas = Tarea_model::obtenerFechas($year, $month, $day, $this->session->userdata('email'));
         }
     } else {
         $proyectoAux = new Proyecto_model();
         $datosProyecto = $proyectoAux->datos($proyecto);
         if ($proyectoAux->pertenece($this->session->userdata('email'))) {
             $proyectoFechas = array();
             array_push($proyectoFechas, $datosProyecto);
             if ($this->session->userdata('usuario') == 'admin') {
                 $tareasFechas = Tarea_model::obtenerFechas($year, $month, $day, '', $proyecto);
             } else {
                 $tareasFechas = Tarea_model::obtenerFechas($year, $month, $day, $this->session->userdata('email'), $proyecto);
             }
         }
     }
     if ($day == '') {
         foreach ($proyectoFechas as $proyecto) {
             if ($this->_mismoMes($proyecto->FechaComienzo, $year, $month)) {
                 $diaI = substr($proyecto->FechaComienzo, 8, 2);
                 if ($diaI < 10) {
                     $diaI = $diaI % 10;
                 }
                 $asuntoI = $proyecto->NombreProyecto;
                 if (array_key_exists($diaI, $eventos)) {
                     if (is_array($eventos[$diaI])) {
                         array_push($eventos[$diaI], '<div class="event"><span class="text-info inicio">' . $asuntoI . '</span></div>');
                     } else {
                         $aux = $eventos[$diaI];
                         $eventos[$diaI] = array();
                         array_push($eventos[$diaI], $aux);
                         array_push($eventos[$diaI], '<div class="event"><span class="text-info inicio">' . $asuntoI . '</span></div>');
                     }
                 } else {
                     $eventos[$diaI] = '<div class="event"><span class="text-info inicio">' . $asuntoI . '</span></div>';
                 }
             }
             if ($this->_mismoMes($proyecto->FechaFinPrevista, $year, $month)) {
                 $diaF = substr($proyecto->FechaFinPrevista, 8, 2);
                 if ($diaF < 10) {
                     $diaF = $diaI % 10;
                 }
                 $asuntoF = $proyecto->NombreProyecto;
                 if (array_key_exists($diaF, $eventos)) {
                     if (is_array($eventos[$diaF])) {
                         array_push($eventos[$diaF], '<div class="event"><span class="text-info fin">' . $asuntoF . '</span></div>');
                     } else {
                         $aux = $eventos[$diaF];
                         $eventos[$diaF] = array();
                         array_push($eventos[$diaF], $aux);
                         array_push($eventos[$diaF], '<div class="event"><span class="text-info fin">' . $asuntoF . '</span></div>');
                     }
                 } else {
                     $eventos[$diaF] = '<div class="event"><span class="text-info fin">' . $asuntoF . '</span></div>';
                 }
             }
         }
         foreach ($tareasFechas as $tarea) {
             if ($this->_mismoMes($tarea->FechaCreacion, $year, $month)) {
                 $diaI = substr($tarea->FechaCreacion, 8, 2);
                 if ($diaI < 10) {
                     $diaI = $diaI % 10;
                 }
                 $asuntoI = $tarea->Titulo;
                 if (array_key_exists($diaI, $eventos)) {
                     if (is_array($eventos[$diaI])) {
                         array_push($eventos[$diaI], '<div class="event"><span class="text-info tareaInicio">' . $asuntoI . '</span></div>');
                     } else {
                         $aux = $eventos[$diaI];
                         $eventos[$diaI] = array();
                         array_push($eventos[$diaI], $aux);
                         array_push($eventos[$diaI], '<div class="event"><span class="text-info tareaInicio">' . $asuntoI . '</span></div>');
                     }
                 } else {
                     $eventos[$diaI] = '<div class="event"><span class="text-info tareaInicio">' . $asuntoI . '</span></div>';
                 }
             }
             if ($this->_mismoMes($tarea->FechaLimite, $year, $month)) {
                 $diaF = substr($tarea->FechaLimite, 8, 2);
                 if ($diaF < 10) {
                     $diaF = $diaF % 10;
                 }
                 $asuntoF = $tarea->Titulo;
                 if (array_key_exists($diaF, $eventos)) {
                     if (is_array($eventos[$diaF])) {
                         array_push($eventos[$diaF], '<div class="event"><span class="text-info tareaFin">' . $asuntoF . '</span></div>');
                     } else {
                         $aux = $eventos[$diaF];
                         $eventos[$diaF] = array();
                         array_push($eventos[$diaF], $aux);
                         array_push($eventos[$diaF], '<div class="event"><span class="text-info tareaFin">' . $asuntoF . '</span></div>');
                     }
                 } else {
                     $eventos[$diaF] = '<div class="event"><span class="text-info tareaFin">' . $asuntoF . '</span></div>';
                 }
             }
         }
     } else {
         foreach ($proyectoFechas as $proyecto) {
             if (date("Y-m-d", strtotime($proyecto->FechaComienzo)) == date("Y-m-d", strtotime("{$year}-{$month}-{$day}"))) {
                 array_push($eventos, '<div class="span5 inicioProyecto"> Se ha registrado el proyecto: ' . ucfirst($proyecto->NombreProyecto) . '</div>');
             }
             if (date("Y-m-d", strtotime($proyecto->FechaFinPrevista)) == date("Y-m-d", strtotime("{$year}-{$month}-{$day}"))) {
                 array_push($eventos, '<div class="span5 finProyecto"> Está previsto que el proyecto ' . ucfirst($proyecto->NombreProyecto) . ' termine hoy</div>');
             }
         }
         foreach ($tareasFechas as $tarea) {
             if (date("Y-m-d", strtotime($tarea->FechaLimite)) == date("Y-m-d", strtotime("{$year}-{$month}-{$day}"))) {
                 array_push($eventos, '<div class="span5 inicioTarea"> Se ha registrado la tarea: ' . ucfirst($tarea->Titulo) . '</div>');
             }
             if (date("Y-m-d", strtotime($tarea->FechaLimite)) == date("Y-m-d", strtotime("{$year}-{$month}-{$day}"))) {
                 array_push($eventos, '<div class="span5 finTarea"> Está previsto que la tarea ' . ucfirst($tarea->Titulo) . ' termine hoy</div>');
             }
         }
     }
     return $eventos;
 }
コード例 #3
0
ファイル: tarea.php プロジェクト: jbgae/bareaarquitectos
 private function _permisosTareas($codigoProyecto, $codigoTarea)
 {
     $aux = FALSE;
     if (Proyecto_model::existe($codigoProyecto)) {
         if (Tarea_model::existe($codigoTarea)) {
             if (Tarea_model::existeEmpleado($codigoTarea, $this->session->userdata('email'))) {
                 $aux = TRUE;
             } else {
                 if ($this->session->userdata('usuario') == 'admin') {
                     $aux = TRUE;
                 }
             }
         }
     }
     return $aux;
 }
コード例 #4
0
ファイル: proyecto.php プロジェクト: jbgae/bareaarquitectos
 public function informe($codigo)
 {
     $this->permisos('admin');
     $proyecto = new Proyecto_model();
     $proyecto->datos($codigo);
     $presupuesto = new Presupuesto_model();
     $presupuesto->datos($proyecto->codigoPresupuesto());
     $tareas = Tarea_model::obtener($this->session->userdata('email'), $codigo);
     $empleados = Proyecto_model::empleadosProyecto($codigo);
     $pdf = new Proyectopdf();
     $pdf->AddPage();
     $pdf->SetMargins(20, 25, 30);
     $pdf->SetAutoPageBreak(true, 25);
     $pdf->AliasNbPages();
     $pdf->SetFont('Times', '', 12);
     $pdf->Cabecera($proyecto->NombreProyecto);
     $pdf->Cuerpo($proyecto, $presupuesto, $tareas, $empleados);
     $pdf->Pie();
     $pdf->Output();
 }
コード例 #5
0
ファイル: archivo.php プロジェクト: jbgae/bareaarquitectos
 public function descargar($codigo)
 {
     if (Archivo_model::existe($codigo)) {
         $aux = FALSE;
         $archivo = new Archivo_model();
         $archivo->datos($codigo);
         $file = str_replace('http://localhost', realpath(__DIR__ . '/../../../'), $archivo->ruta($codigo));
         if ($archivo->codigoTarea() != NULL || $archivo->codigoRespuesta() != NULL) {
             if ($this->session->userdata('usuario') == 'admin' || Tarea_model::existeEmpleado($archivo->codigoTarea($codigo), $this->session->userdata('email'))) {
                 $aux = TRUE;
             }
         } else {
             if ($this->session->userdata('usuario') == 'admin' || $archivo->emailEmpleado() == $this->session->userdata('email') || Proyecto_model::existeEmpleado($archivo->codigoProyecto($codigo), $this->session->userdata('email'))) {
                 $aux = TRUE;
             } elseif ($this->session->userdata('usuario') == 'cliente') {
                 if ($archivo->CodigoProyecto != NULL) {
                     $proyecto = new Proyecto_model();
                     $codigoP = $proyecto->codigoPresupuesto($archivo->CodigoProyecto);
                     $presupuesto = new Presupuesto_model();
                     if ($codigoP != '') {
                         if ($presupuesto->email($codigoP) == $this->session->userdata('email')) {
                             $aux = TRUE;
                         }
                     }
                 } else {
                     $codigoP = $archivo->codigoPresupuesto($codigo);
                     $presupuesto = new Presupuesto_model();
                     if ($codigoP != '') {
                         if ($presupuesto->email($codigoP) == $this->session->userdata('email')) {
                             $aux = TRUE;
                         }
                     }
                 }
             }
         }
         if ($aux) {
             if (file_exists($file)) {
                 $extension = $archivo->Extension;
                 if ($extension == 'pdf') {
                     header('Content-type: application/pdf');
                 } elseif ($extension == 'jpg' || $extension == 'png' || $extension == 'jpeg') {
                     header('Content-type: application/jpg');
                 }
                 header('Content-Disposition: attachment; filename=' . basename($file));
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate');
                 header('Pragma: public');
                 header('Content-Length: ' . filesize($file));
                 ob_clean();
                 flush();
                 readfile($file);
             } else {
                 echo "El archivo no existe";
             }
         } else {
             echo 'No puedes descargar el archivo';
         }
     } else {
         echo 'El archivo no existe';
     }
 }