public function getExam() { $exam = null; if (is_int($this->extExam)) { $exam = ExamDAL::findById($this->extExam); $this->extExam = $exam; } else { if (is_a($this->extExam, "Exam")) { $exam = $this->extExam; } } return $exam; }
public function setRetryExam($retryExam) { if (is_string($retryExam)) { $retryExam = (int) $retryExam; $this->retryExam = ExamDAL::findById($retryExam); } else { if (is_int($retryExam)) { $this->retryExam = ExamDAL::findById($retryExam); } else { if (is_a($retryExam, "Exam")) { $this->retryExam = $retryExam; } } } }
echo "Insertion Assignment OK (id:" . $newAssignment->getId() . ", label:" . $newAssignment->getLabel() . ")"; } else { echo "ECHEC insertion assignment, good luck"; } //********CREATION EXAM********** //création de l'exam (qu'il faudra liée au module créer plutot) $validExamLabel = filter_input(INPUT_POST, 'examLabel', FILTER_SANITIZE_STRING); if ($validExamLabel != null) { $newExam->setLabel($validExamLabel); } $validExamDescription = filter_input(INPUT_POST, 'examDescription', FILTER_SANITIZE_STRING); if ($validExamDescription != null) { $newExam->setDescription($validExamDescription); } $validExamDatePassage = filter_input(INPUT_POST, 'examDate', FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => $myregex))); if ($validExamDatePassage != null) { $newExam->setDatePassage($validExamDatePassage); } $validExamPrixRetry = filter_input(INPUT_POST, 'examRetryPrice', FILTER_SANITIZE_NUMBER_INT); if ($validExamPrixRetry != null) { $newExam->setPrixRattrapage($validExamPrixRetry); } $newExam->setAffiche(1); //insertion de l'exam dans la table $validInsertExam = ExamDAL::insertOnDuplicate($newExam, $moduleId); if ($validInsertExam != null) { echo "Insertion Exam OK (id:" . $newExam->getId() . ", label:" . $newExam->getLabel() . ")"; } else { echo "ECHEC insertion exam, good luck"; } echo '<META HTTP-EQUIV="Refresh" Content="0; URL=../../?page=module_list&modification=success">';
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require_once '../../model/class/Exam.php'; require_once '../../model/DAL/ExamDAL.php'; require_once '../../model/class/Assignment.php'; require_once '../../model/DAL/AssignmentDAL.php'; require_once '../../model/class/Module.php'; require_once '../../model/DAL/ModuleDAL.php'; $validExamId = filter_input(INPUT_GET, 'exam_id', FILTER_SANITIZE_STRING); $validExamId = (int) $validExamId; $exam = ExamDAL::findById($validExamId); $validModuleId = filter_input(INPUT_GET, 'module_id', FILTER_SANITIZE_STRING); $validModuleId = (int) $validModuleId; $validLabel = filter_input(INPUT_GET, 'exam_label', FILTER_SANITIZE_STRING); $exam->setLabel($validLabel); $validDesc = filter_input(INPUT_GET, 'exam_desc', FILTER_SANITIZE_STRING); $exam->setDescription($validDesc); ExamDAL::insertOnDuplicate($exam, $validModuleId); echo '<META HTTP-EQUIV="Refresh" Content="0; URL=../../?page=module&modification=success&module_id=' . $validModuleId . '">';