/**
  * carga la vista de crear proyecto y recibe los datos post para crear proyecto
  * @return \Zend\View\Model\ViewModel
  */
 public function crearAction()
 {
     if ($this->getRequest()->isPost()) {
         $datos = $this->getRequest()->getPost();
         $project = new proyecto();
         $proyecto_e = new ProyectoEducacion();
         $estado = $this->em()->getRepository('\\Login\\Model\\Entity\\Estado')->find(1);
         $eje = $this->em()->getRepository('\\Login\\Model\\Entity\\Eje')->find(2);
         $project->setEstado($estado);
         $project->setEje($eje);
         $project->setProyectoPathfotos('pendiente');
         $project->setProyectoAnio($datos["vigencia"]);
         $project->setProyectoPresupuesto($datos["valProj"]);
         $proyecto_e->setProyecto($project);
         $proyecto_e->setProyectoeducacionEjecutor($datos["ejecutorP"]);
         $fecha = \DateTime::createFromFormat('d/m/Y', $datos["fechaIni"]);
         $proyecto_e->setProyectoeducacionFechainicio($fecha);
         $proyecto_e->setProyectoeducacionNumero($datos["numeroP"]);
         $proyecto_e->setProyectoeducacionNombre($datos["nombreP"]);
         $proyecto_e->setProyectoeducacionPlazoejecucion($datos["plazoEjec"]);
         $proyecto_e->setProyectoeducacionObjetivo($datos["objetivo"]);
         $proyecto_e->setProyectoeducacionPerfilbeneficiario($datos["perfilBen"]);
         $proyecto_e->setProyectoeducacionCupos($datos["cupos"]);
         $this->dbh()->insertObj($proyecto_e);
         $files = $this->getRequest()->getFiles()->toArray();
         $ruta = './public/fotografias/' . $project->getProyectoId() . '/';
         if (!file_exists($ruta)) {
             mkdir($ruta);
         }
         $filter = new \Zend\Filter\File\RenameUpload($ruta);
         $filter->setUseUploadName(true);
         foreach ($files['proyecto-fotos'] as $file) {
             $filter->filter($file);
         }
         return $this->forward()->dispatch('Educacion\\Controller\\index', array('action' => 'ver', 'educacion' => $proyecto_e));
     } else {
         $this->layout('layout/educacion');
         $this->layout()->titulo = '.::Crear Proyecto:.';
         $adapter = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
         $formEducacion = new FormularioEducacion($adapter);
         return new ViewModel(array('formEducacion' => $formEducacion));
     }
 }
 public function delete()
 {
     $obj = new proyecto();
     $p = $obj->delete($_GET['id']);
     if ($p[0]) {
         header('Location: index.php?controller=proyecto');
     } else {
         $data = array();
         $view = new View();
         $data['msg'] = $p[1];
         $data['url'] = 'index.php?controller=proyecto';
         $view->setData($data);
         $view->setTemplate('../view/_Error_App.php');
         $view->setLayout('../template/Layout.php');
         $view->render();
     }
 }