function validar() { if ($this->getParam('Login') == true) { Sesion::obtenerInstancia()->crearSesion(); $user = $this->getParam('user'); $password = $this->getParam('pass'); $usuario = new User_Model(); if ($usuario->esValido($user, $password)) { //Aqui va la pr<<óxima vista $userID = $usuario->getUserID($user, $password); // $usuario->won($userID); $dataU = $usuario->getData($user, $password); $content_view = $this->view->fetch('menu_view', array('data' => $dataU, 'msgerror' => '')); } else { $content_view = $this->view->fetch('user_view', array('msgerror' => 'Invalid User')); } } else { if ($this->getParam('Register') == true) { $this->view->assign('type', "user"); $content_view = $this->view->fetch('register_view', array('msgerror' => '')); } } $this->view->display('layout_view', array('content' => $content_view)); }
public function index($userID = NULL) { $this->load->model('User_model', 'Curriculum_model'); $this->load->helper('url'); //Loader user from passed ID and advisor from session ID // If the session id isn't the passed user or an advisor for the user, immediantly fail. $user = new User_Model(); $user->loadPropertiesFromPrimaryKey($userID); $advisor = new User_Model(); if (!isset($_SESSION["UserID"])) { redirect('login'); } $advisor->loadPropertiesFromPrimaryKey($_SESSION["UserID"]); $flag = TRUE; foreach ($advisor->getAdvisees() as $student) { if ($student->getUserID() == $userID) { $flag = FALSE; } } if ($advisor->getUserID() == $user->getUserID()) { $flag = FALSE; } if ($flag == TRUE) { echo "YOU DON'T HAVE PERMISSION TO ACCESS THIS USER'S INFORMATION"; exit; } $curriculums = $user->getCurriculums(); $degree = FALSE; foreach ($curriculums as $c) { if ($c->getCurriculumType() == Curriculum_model::CURRICULUM_TYPE_DEGREE) { $degree = TRUE; } } if (!$degree) { echo "ERROR NO CURRICULUM SET FOR USER"; exit; } //Create excel file $Excel = new PHPExcel(); $Excel->getProperties()->setCreator("CSC 404 - 2015 App")->setLastModifiedBy("CSC 404 - 2015 App")->setTitle($user->getName() . " Checklist")->setSubject("Advising Checklist")->setDescription("Auto Generated Checklist")->setCategory("Advisee checklist file"); //Set global defaults $Excel->getDefaultStyle()->getFont()->setSize(10)->setName('Arial'); $Excel->removeSheetByIndex(0); //Generate course sheets $sheetnumber = 0; foreach ($curriculums as $c) { if ($c->getCurriculumType() == Curriculum_model::CURRICULUM_TYPE_DEGREE) { //Generate Checklist $checklist = $Excel->createSheet(NULL, $sheetnumber++); $checklist->setTitle("Checklist"); $this->generatechecklist($checklist, $user, $c, $curriculums); //Generate Quarter View $qview = $Excel->createSheet(NULL, $sheetnumber++); $qview->setTitle("Quarter View"); $this->generate_quarter_view($qview, $user, $c); break; } } //Generate advisor checklist sheet $advcheck = $Excel->createSheet(NULL, $sheetnumber++); $advcheck->setTitle("Advisor Checklist"); $this->generateadvchecklist($advcheck); //Download file object (PDF or XLS) $Excel->setActiveSheetIndex(0); $objWriter = PHPExcel_IOFactory::createWriter($Excel, 'Excel5'); header("Content-type: application/vnd.ms-exel"); header("Content-Disposition: attachment; filename=\"" . $user->getName() . " Checklist.xls\""); $objWriter->save('php://output'); }