diff --git a/orif/plafor/Config/PlaforConfig.php b/orif/plafor/Config/PlaforConfig.php index e53ad6d9..ac97aeab 100644 --- a/orif/plafor/Config/PlaforConfig.php +++ b/orif/plafor/Config/PlaforConfig.php @@ -1,8 +1,8 @@ findall() as $courseplan) + foreach (CoursePlanModel::getInstance()->withDeleted(true)->findall() as $courseplan) $coursesList[$courseplan['id']]=$courseplan; - $courses = UserCourseModel::getInstance()->findall(); + $courses = UserCourseModel::getInstance()->withDeleted(true)->findall(); }else{ + $apprentices=[]; + if (count(TrainerApprenticeModel::getInstance()->where('fk_trainer', $trainer_id)->findall())) $apprentices = User_Model::getInstance()->whereIn('id', array_column(TrainerApprenticeModel::getInstance()->where('fk_trainer', $trainer_id)->findall(), 'fk_apprentice'))->findall(); - $coursesList=[]; - foreach (CoursePlanModel::getInstance()->findall() as $courseplan) - $coursesList[$courseplan['id']]=$courseplan; - $courses = UserCourseModel::getInstance()->findall(); + $coursesList=[]; + foreach (CoursePlanModel::getInstance()->withDeleted(true)->findall() as $courseplan) + $coursesList[$courseplan['id']]=$courseplan; + $courses = UserCourseModel::getInstance()->withDeleted(true)->findall(); } @@ -116,15 +128,15 @@ public function view_apprentice($apprentice_id = null) } $user_course_status=[]; - foreach (UserCourseStatusModel::getInstance()->findAll() as $usercoursetatus) + foreach (UserCourseStatusModel::getInstance()->withDeleted(true)->findAll() as $usercoursetatus) $user_course_status[$usercoursetatus['id']] = $usercoursetatus; $course_plans=[]; - foreach (CoursePlanModel::getInstance()->findall() as $courseplan) + foreach (CoursePlanModel::getInstance()->withDeleted(true)->findall() as $courseplan) $course_plans[$courseplan['id']] = $courseplan; $trainers = []; - foreach (User_model::getInstance()->where('fk_user_type',User_type_model::getInstance()->where('name',lang('plafor_lang.title_trainer'))->first()['id'])->findall() as $trainer) + foreach (User_model::getInstance()->where('fk_user_type',User_type_model::getInstance()->where('name',lang('plafor_lang.title_trainer'))->first()['id'])->withDeleted(true)->findall() as $trainer) $trainers[$trainer['id']]= $trainer; $links = []; @@ -169,6 +181,7 @@ public function save_user_course($id_apprentice = null,$id_user_course = 0){ ); if ($id_user_course > 0) { //update + //when we update the userCourse see if the courseplan is changed UserCourseModel::getInstance()->update($id_user_course, $user_course); } else if (UserCourseModel::getInstance()->where('fk_user', $id_apprentice)->where('fk_course_plan', $fk_course_plan)->first() == null) { //insert @@ -372,7 +385,7 @@ public function view_acquisition_status($acquisition_status_id = null){ * Changes an acquisition status for an apprentice * * @param int $acquisition_status_id = ID of the acquisition status to change - * @return void + * @return Response|ResponseInterface */ public function save_acquisition_status($acquisition_status_id = 0) { $acquisitionStatus = AcquisitionStatusModel::getInstance()->find($acquisition_status_id); @@ -393,14 +406,27 @@ public function save_acquisition_status($acquisition_status_id = 0) { $acquisitionLevels[$acquisitionLevel['id']]=$acquisitionLevel['name']; // Check if data was sent + if (!empty($_POST)) { $acquisitionLevel = $this->request->getPost('field_acquisition_level'); - $acquisitionStatus = [ - 'fk_acquisition_level' => $acquisitionLevel - ]; + $acquisitionStatus=AcquisitionStatusModel::getInstance()->find($acquisition_status_id); + $acquisitionStatus['fk_acquisition_level'] = $acquisitionLevel; + //check if opcomp and compdom is avtive + + $objective=ObjectiveModel::getInstance()->find($acquisitionStatus['fk_objective']); + $opeationalCompetence=ObjectiveModel::getOperationalCompetence($objective['fk_operational_competence']); + //verify if op comp is disabled + if ($opeationalCompetence==null||$opeationalCompetence['archive']!=null){ + return $this->response->setContentType('application/json')->setStatusCode(409)->setBody(json_encode(['error'=>lang('plafor_lang.associated_op_comp_disabled')])); + } + //if not verify if competence domain is active + else{ + $competenceDomain=OperationalCompetenceModel::getCompetenceDomain($opeationalCompetence['fk_competence_domain']); + if ($competenceDomain==null|$competenceDomain['archive']!=null){ + return $this->response->setContentType('application/json')->setStatusCode(409)->setBody(json_encode(['error'=>lang('plafor_lang.associated_comp_dom_disabled')])); + } + } AcquisitionStatusModel::getInstance()->update($acquisition_status_id, $acquisitionStatus); - - if (AcquisitionStatusModel::getInstance()->errors()==null) { //if ok @@ -440,7 +466,7 @@ public function add_comment($acquisition_status_id = null, $comment_id = null){ if (CommentModel::getInstance()->errors()==null) { //if ok - return redirect()->to(base_url('plafor/courseplan/view_acquisition_status/'.$acquisition_status['id'])); + return redirect()->to(base_url('plafor/apprentice/view_acquisition_status/'.$acquisition_status['id'])); } } @@ -460,7 +486,7 @@ public function add_comment($acquisition_status_id = null, $comment_id = null){ public function delete_comment($comment_id = 0, $acquisition_status_id = 0) { CommentModel::getInstance()->delete($comment_id); - return redirect()->to(base_url('plafor/courseplan/view_acquisition_status/'.$acquisition_status_id)); + return redirect()->to(base_url('plafor/apprentice/view_acquisition_status/'.$acquisition_status_id)); } @@ -561,4 +587,61 @@ public function view_user_course($id_user_course = null){ $this->display_view('\Plafor\user_course/view',$output); } + /** + * Delete or deactivate a user depending on $action + * + * @param integer $user_id = ID of the user to affect + * @param integer $action = Action to apply on the user: + * - 0 for displaying the confirmation + * - 1 for deactivating (soft delete) + * - 2 for deleting (hard delete) + * @return void + */ + public function delete_user($user_id, $action = 0) + { + if ($_SESSION['user_access'] == config('\User\Config\UserConfig')->access_lvl_admin) { + $user = User_model::getInstance()->withDeleted()->find($user_id); + if (is_null($user)) { + return redirect()->to(base_url('/user/admin/list_user')); + } + + switch ($action) { + case 0: // Display confirmation + $output = array( + 'user' => $user, + 'title' => lang('user_lang.title_user_delete') + ); + $this->display_view('\User\admin\delete_user', $output); + break; + case 1: // Deactivate (soft delete) user + if ($_SESSION['user_id'] != $user['id']) { + User_model::getInstance()->delete($user_id, FALSE); + } + return redirect()->to('/user/admin/list_user'); + case 2: // Delete user + if ($_SESSION['user_id'] != $user['id']) { + //here we have to delete associated infos + foreach(TrainerApprenticeModel::getInstance()->where('fk_apprentice',$user['id'])->orWhere('fk_trainer',$user['id'])->findAll() as $trainerApprentice) + $trainerApprentice==null?:TrainerApprenticeModel::getInstance()->delete($trainerApprentice['id']); + if (count(UserCourseModel::getUser($user['id']))>0){ + foreach(UserCourseModel::getInstance()->where('fk_user',$user['id'])->findAll() as $userCourse){ + foreach(UserCourseModel::getAcquisitionStatus($userCourse['id']) as $acquisitionStatus){ + + foreach (CommentModel::getInstance()->where('fk_acquisition_status',$acquisitionStatus['id']) as $comment){ + $comment==null?:CommentModel::getInstance()->delete($comment['id'],true); + } + AcquisitionStatusModel::getInstance()->delete($acquisitionStatus['id'],true); + } + UserCourseModel::getInstance()->delete($userCourse['id'],true); + } + + } + User_model::getInstance()->delete($user_id, TRUE); + } + return redirect()->to('/user/admin/list_user'); + default: // Do nothing + return redirect()->to('/user/admin/list_user'); + } + } + } } \ No newline at end of file diff --git a/orif/plafor/Controllers/CoursePlan.php b/orif/plafor/Controllers/CoursePlan.php index 149d6ff6..bbc25932 100644 --- a/orif/plafor/Controllers/CoursePlan.php +++ b/orif/plafor/Controllers/CoursePlan.php @@ -1,5 +1,11 @@ [operationalCompetence id, name, etc...],[:competencedomainid]=>[operationalCompetence id, name, etc...] - $operationalCompetences[$competence_domain['id']] = CompetenceDomainModel::getOperationalCompetences($competence_domain['id']); - //get all objectives assiociated with an operational_competence in an array($objectives) which format is [[operationalcompetenceid]=>[objectives id,fkop, symbol, etc...] - try { - foreach ($operationalCompetences as list($operationalCompetence)) { - $objectives[$operationalCompetence['id']] = OperationalCompetenceModel::getObjectives($operationalCompetence['id']); - } - } catch (\Exception $e) { - }; - - } - //get all ids - $competenceDomainIds = array_column($competenceDomains, 'id'); - foreach ($objectives as list($objective)) { - $objectiveIds[] = $objective['id']; - - } - - - count($objectiveIds) > 0 ? ObjectiveModel::getInstance()->whereIn('id', $objectiveIds)->delete() : null; - count($competenceDomainIds) > 0 ? OperationalCompetenceModel::getInstance()->whereIn('fk_competence_domain', $competenceDomainIds)->delete() : null; - CompetenceDomainModel::getInstance()->where('fk_course_plan', $course_plan_id); - CoursePlanModel::getInstance()->delete($course_plan_id, FALSE); + CoursePlanModel::getInstance()->delete($course_plan_id); return redirect()->to('/plafor/courseplan/list_course_plan'); break; case 3: - //Reactiver le plan de formation + //Reactiver le plan de formation et ses competence et objectifs associés CoursePlanModel::getInstance()->withDeleted()->update($course_plan_id, ['archive' => null]); + return redirect()->to(base_url('plafor/courseplan/list_course_plan')); break; default: @@ -152,7 +132,7 @@ public function delete_course_plan($course_plan_id, $action = 0) * @param integer $competence_domain_id = The id of the course plan to modify, leave blank to create a new one * @return void */ - public function save_competence_domain($competence_domain_id = 0, $course_plan_id = 0) + public function save_competence_domain($course_plan_id = 0,$competence_domain_id = 0) { if ($_SESSION['user_access'] >= config('\User\Config\UserConfig')->access_lvl_admin) { @@ -226,14 +206,6 @@ public function delete_competence_domain($competence_domain_id = null, $action = $this->display_view('\Plafor/competence_domain/delete', $output); break; case 1: // Deactivate (soft delete) competence domain - $operationalCompetenceIds = []; - foreach (CompetenceDomainModel::getOperationalCompetences($competence_domain_id) as $operational_competence) { - $operationalCompetenceIds[] = $operational_competence['id']; - } - - if (count($operationalCompetenceIds)) - ObjectiveModel::getInstance()->whereIn('fk_operational_competence', $operationalCompetenceIds)->delete(); - OperationalCompetenceModel::getInstance()->where('fk_competence_domain', $competence_domain_id)->delete(); $courseplanId = CompetenceDomainModel::getInstance()->find($competence_domain_id)['fk_course_plan']; CompetenceDomainModel::getInstance()->delete($competence_domain_id); @@ -242,7 +214,6 @@ public function delete_competence_domain($competence_domain_id = null, $action = case 3: //Reactiver le domaine de compétences - CompetenceDomainModel::getInstance()->withDeleted()->update($competence_domain_id, ['archive' => null]); return redirect()->to(base_url('plafor/courseplan/view_course_plan/' . $competence_domain['fk_course_plan'])); break; @@ -288,7 +259,7 @@ public function save_operational_competence($operational_competence_id = 0, $com if (OperationalCompetenceModel::getInstance()->errors() == null) { //when it's ok - return redirect()->to(base_url('plafor/courseplan/view_competence_domain/' . $competence_domain_id)); + return redirect()->to(base_url('plafor/courseplan/view_competence_domain/' . $operational_competence['fk_competence_domain'])); } } $competenceDomains = []; @@ -336,7 +307,6 @@ public function delete_operational_competence($operational_competence_id, $actio $this->display_view('\Plafor\operational_competence/delete', $output); break; case 1: // Deactivate (soft delete) operational competence - ObjectiveModel::getInstance()->where('fk_operational_competence', $operational_competence_id)->delete(); OperationalCompetenceModel::getInstance()->delete($operational_competence_id, FALSE); return redirect()->to(base_url('plafor/courseplan/view_competence_domain/' . $operational_competence['fk_competence_domain'])); break; @@ -421,7 +391,19 @@ public function save_objective($objective_id = 0, $operational_competence_id = 0 ObjectiveModel::getInstance()->update($objective_id, $objective); } else { //insert - ObjectiveModel::getInstance()->insert($objective); + $objective_id=ObjectiveModel::getInstance()->insert($objective); + //when we add objective we have to update all students acquisition_status whene operationnal + $userCourses=CoursePlanModel::getUserCourses( + OperationalCompetenceModel::getCompetenceDomain( + ObjectiveModel::getOperationalCompetence( + $objective['fk_operational_competence'] + )['fk_competence_domain'] + )['fk_course_plan'] + ); + foreach($userCourses as $userCourse){ + AcquisitionStatusModel::getInstance()->insert(['fk_objective'=>$objective_id,'fk_user_course'=>$userCourse['id'],'fk_acquisition_level'=>1]); + + } } if (ObjectiveModel::getInstance()->errors() == null) { //if ok @@ -499,8 +481,9 @@ public function delete_objective($objective_id, $action = 0) * * @return void */ - public function list_course_plan($id_apprentice = null, bool $with_archived=false) + public function list_course_plan($id_apprentice = null, $with_archived=false) { + $this->request->getGet('wa')!=null?$with_archived=$this->request->getGet('wa'):null; $id_apprentice==0?$id_apprentice = null:null; $coursePlanModel=new CoursePlanModel(); $userCourseModel=new UserCourseModel(); @@ -539,6 +522,7 @@ public function list_course_plan($id_apprentice = null, bool $with_archived=fals */ public function view_course_plan($course_plan_id = null) { + $with_archived=$this->request->getGet('wa')!=null?$this->request->getGet('wa'):false; if(!isset($course_plan_id)) { // Back to course plans list return redirect()->to(base_url('plafor/courseplan/list_course_plan')); @@ -550,7 +534,7 @@ public function view_course_plan($course_plan_id = null) } } - $competence_domains=CoursePlanModel::getCompetenceDomains($course_plan_id); + $competence_domains=CoursePlanModel::getCompetenceDomains($course_plan_id,$with_archived); // Format date $date_begin = Time::createFromFormat('Y-m-d', $course_plan['date_begin']); @@ -584,6 +568,7 @@ public function view_competence_domain($competence_domain_id = null) return redirect()->to(base_url('plafor/courseplan/list_course_plan')); } } + $with_archived=$this->request->getGet('wa')!=null?$this->request->getGet('wa'):false; $course_plan = CompetenceDomainModel::getCoursePlan($competence_domain['fk_course_plan'], true); @@ -595,6 +580,7 @@ public function view_competence_domain($competence_domain_id = null) 'title' =>lang('plafor_lang.title_view_competence_domain'), 'course_plan' =>$course_plan, 'competence_domain' => $competence_domain, + 'with_archived'=>$with_archived, ); return $this->display_view('\Plafor/competence_domain/view',$output); @@ -612,6 +598,7 @@ public function view_operational_competence($operational_competence_id = null) if($operational_competence == null){ return redirect()->to(base_url('plafor/courseplan/list_course_plan/')); } + $with_archived=$this->request->getGet('wa')!=null?$this->request->getGet('wa'):false; $competence_domain=null; $course_plan=null; @@ -621,7 +608,7 @@ public function view_operational_competence($operational_competence_id = null) }catch (Exception $exception){ } - $objectives=OperationalCompetenceModel::getObjectives($operational_competence['id']); + $objectives=OperationalCompetenceModel::getObjectives($operational_competence['id'],$with_archived); $output = array( 'title'=>lang('plafor_lang.title_view_operational_competence'), 'operational_competence' => $operational_competence, diff --git a/orif/plafor/Controllers/Migration.php b/orif/plafor/Controllers/Migration.php index 1356e592..38298395 100644 --- a/orif/plafor/Controllers/Migration.php +++ b/orif/plafor/Controllers/Migration.php @@ -1,5 +1,12 @@ db->disableForeignKeyChecks(); $this->forge->createTable('acquisition_status'); $seeder = \Config\Database::seeder(); - $seeder->call('\Plafor\Database\Seeds\addAcquisitionStatusDatas'); } diff --git a/orif/plafor/Database/Migrations/2021-06-14-090828_AddComment.php b/orif/plafor/Database/Migrations/2021-06-14-090828_AddComment.php index 75e63146..c9e2404c 100644 --- a/orif/plafor/Database/Migrations/2021-06-14-090828_AddComment.php +++ b/orif/plafor/Database/Migrations/2021-06-14-090828_AddComment.php @@ -1,4 +1,11 @@ '1','fk_objective' => '1','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '2','fk_objective' => '2','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '3','fk_objective' => '3','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '4','fk_objective' => '4','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '5','fk_objective' => '5','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '6','fk_objective' => '6','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '7','fk_objective' => '7','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '8','fk_objective' => '8','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '9','fk_objective' => '9','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '10','fk_objective' => '10','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '11','fk_objective' => '11','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '12','fk_objective' => '12','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '13','fk_objective' => '13','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '14','fk_objective' => '14','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '15','fk_objective' => '15','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '16','fk_objective' => '16','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '17','fk_objective' => '17','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '18','fk_objective' => '18','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '19','fk_objective' => '19','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '20','fk_objective' => '20','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '21','fk_objective' => '21','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '22','fk_objective' => '22','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '23','fk_objective' => '23','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '24','fk_objective' => '24','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '25','fk_objective' => '25','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '26','fk_objective' => '26','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '27','fk_objective' => '27','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '28','fk_objective' => '28','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '29','fk_objective' => '29','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '30','fk_objective' => '30','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '31','fk_objective' => '31','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '32','fk_objective' => '32','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '33','fk_objective' => '33','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '34','fk_objective' => '34','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '35','fk_objective' => '35','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '36','fk_objective' => '36','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '37','fk_objective' => '37','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '38','fk_objective' => '38','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '39','fk_objective' => '39','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '40','fk_objective' => '40','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '41','fk_objective' => '41','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '42','fk_objective' => '42','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '43','fk_objective' => '43','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '44','fk_objective' => '44','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '45','fk_objective' => '45','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '46','fk_objective' => '46','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '47','fk_objective' => '47','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '48','fk_objective' => '48','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '49','fk_objective' => '49','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '50','fk_objective' => '50','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '51','fk_objective' => '51','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '52','fk_objective' => '52','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '53','fk_objective' => '53','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '54','fk_objective' => '54','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '55','fk_objective' => '55','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '56','fk_objective' => '56','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '57','fk_objective' => '57','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '58','fk_objective' => '58','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '59','fk_objective' => '59','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '60','fk_objective' => '60','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '61','fk_objective' => '61','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '62','fk_objective' => '62','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '63','fk_objective' => '63','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '64','fk_objective' => '64','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '65','fk_objective' => '65','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '66','fk_objective' => '66','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '67','fk_objective' => '67','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '68','fk_objective' => '68','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '69','fk_objective' => '69','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '70','fk_objective' => '70','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '71','fk_objective' => '71','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '72','fk_objective' => '72','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '73','fk_objective' => '73','fk_user_course' => '1','fk_acquisition_level' => '1'), - array('id' => '74','fk_objective' => '177','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '75','fk_objective' => '178','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '76','fk_objective' => '179','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '77','fk_objective' => '180','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '78','fk_objective' => '181','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '79','fk_objective' => '182','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '80','fk_objective' => '183','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '81','fk_objective' => '184','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '82','fk_objective' => '185','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '83','fk_objective' => '186','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '84','fk_objective' => '187','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '85','fk_objective' => '188','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '86','fk_objective' => '189','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '87','fk_objective' => '190','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '88','fk_objective' => '191','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '89','fk_objective' => '192','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '90','fk_objective' => '193','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '91','fk_objective' => '194','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '92','fk_objective' => '195','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '93','fk_objective' => '196','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '94','fk_objective' => '197','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '95','fk_objective' => '198','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '96','fk_objective' => '199','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '97','fk_objective' => '200','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '98','fk_objective' => '201','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '99','fk_objective' => '202','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '100','fk_objective' => '203','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '101','fk_objective' => '204','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '102','fk_objective' => '205','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '103','fk_objective' => '206','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '104','fk_objective' => '207','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '105','fk_objective' => '208','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '106','fk_objective' => '209','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '107','fk_objective' => '210','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '108','fk_objective' => '211','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '109','fk_objective' => '212','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '110','fk_objective' => '213','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '111','fk_objective' => '214','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '112','fk_objective' => '215','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '113','fk_objective' => '216','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '114','fk_objective' => '217','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '115','fk_objective' => '218','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '116','fk_objective' => '219','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '117','fk_objective' => '220','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '118','fk_objective' => '221','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '119','fk_objective' => '222','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '120','fk_objective' => '223','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '121','fk_objective' => '224','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '122','fk_objective' => '225','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '123','fk_objective' => '226','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '124','fk_objective' => '227','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '125','fk_objective' => '228','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '126','fk_objective' => '229','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '127','fk_objective' => '230','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '128','fk_objective' => '231','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '129','fk_objective' => '232','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '130','fk_objective' => '233','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '131','fk_objective' => '234','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '132','fk_objective' => '235','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '133','fk_objective' => '236','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '134','fk_objective' => '237','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '135','fk_objective' => '238','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '136','fk_objective' => '239','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '137','fk_objective' => '240','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '138','fk_objective' => '241','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '139','fk_objective' => '242','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '140','fk_objective' => '243','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '141','fk_objective' => '244','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '142','fk_objective' => '245','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '143','fk_objective' => '246','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '144','fk_objective' => '247','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '145','fk_objective' => '248','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '146','fk_objective' => '249','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '147','fk_objective' => '250','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '148','fk_objective' => '251','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '149','fk_objective' => '252','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '150','fk_objective' => '253','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '151','fk_objective' => '254','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '152','fk_objective' => '255','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '153','fk_objective' => '256','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '154','fk_objective' => '257','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '155','fk_objective' => '258','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '156','fk_objective' => '259','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '157','fk_objective' => '260','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '158','fk_objective' => '261','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '159','fk_objective' => '262','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '160','fk_objective' => '263','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '161','fk_objective' => '264','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '162','fk_objective' => '265','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '163','fk_objective' => '266','fk_user_course' => '2','fk_acquisition_level' => '1'), - array('id' => '164','fk_objective' => '267','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '165','fk_objective' => '268','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '166','fk_objective' => '269','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '167','fk_objective' => '270','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '168','fk_objective' => '271','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '169','fk_objective' => '272','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '170','fk_objective' => '273','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '171','fk_objective' => '274','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '172','fk_objective' => '275','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '173','fk_objective' => '276','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '174','fk_objective' => '277','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '175','fk_objective' => '278','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '176','fk_objective' => '279','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '177','fk_objective' => '280','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '178','fk_objective' => '281','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '179','fk_objective' => '282','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '180','fk_objective' => '283','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '181','fk_objective' => '284','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '182','fk_objective' => '285','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '183','fk_objective' => '286','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '184','fk_objective' => '287','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '185','fk_objective' => '288','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '186','fk_objective' => '289','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '187','fk_objective' => '290','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '188','fk_objective' => '291','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '189','fk_objective' => '292','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '190','fk_objective' => '293','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '191','fk_objective' => '294','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '192','fk_objective' => '295','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '193','fk_objective' => '296','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '194','fk_objective' => '297','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '195','fk_objective' => '298','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '196','fk_objective' => '299','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '197','fk_objective' => '300','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '198','fk_objective' => '301','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '199','fk_objective' => '302','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '200','fk_objective' => '303','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '201','fk_objective' => '304','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '202','fk_objective' => '305','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '203','fk_objective' => '306','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '204','fk_objective' => '307','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '205','fk_objective' => '308','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '206','fk_objective' => '309','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '207','fk_objective' => '310','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '208','fk_objective' => '311','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '209','fk_objective' => '312','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '210','fk_objective' => '313','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '211','fk_objective' => '314','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '212','fk_objective' => '315','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '213','fk_objective' => '316','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '214','fk_objective' => '317','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '215','fk_objective' => '318','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '216','fk_objective' => '319','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '217','fk_objective' => '320','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '218','fk_objective' => '321','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '219','fk_objective' => '322','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '220','fk_objective' => '323','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '221','fk_objective' => '324','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '222','fk_objective' => '325','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '223','fk_objective' => '326','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '224','fk_objective' => '327','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '225','fk_objective' => '328','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '226','fk_objective' => '329','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '227','fk_objective' => '330','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '228','fk_objective' => '331','fk_user_course' => '3','fk_acquisition_level' => '1'), - array('id' => '229','fk_objective' => '332','fk_user_course' => '3','fk_acquisition_level' => '1') - ); - foreach ($acquisition_status as $acquisitionStatuse){ - $this->db->table('acquisition_status')->insert($acquisitionStatuse); - } - - - } - -} \ No newline at end of file diff --git a/orif/plafor/Database/Seeds/addCoursePlan2021Datas.php b/orif/plafor/Database/Seeds/addCoursePlan2021Datas.php index 4cfc900a..412ad9f8 100644 --- a/orif/plafor/Database/Seeds/addCoursePlan2021Datas.php +++ b/orif/plafor/Database/Seeds/addCoursePlan2021Datas.php @@ -6,9 +6,9 @@ class addCoursePlan2021Datas extends Seeder{ public function run(){ $course_plans = array( - array('id' => '5','formation_number' => '88611','official_name' => ' Informaticienne / Informaticien Sys','date_begin' => '2020-11-19','archive' => NULL), - array('id' => '6','formation_number' => '88611','official_name' => ' Informaticienne / Informaticien Dev','date_begin' => '2020-11-19','archive' => NULL), - array('id' => '7','formation_number' => '88614','official_name' => ' Informaticienne d\'entreprise, Informaticien d\'entreprise','date_begin' => '0000-00-00','archive' => NULL) + array('id' => '5','formation_number' => '88611','official_name' => 'Informaticienne / Informaticien avec CFC, orientation exploitation et infrastructure','date_begin' => '2021-08-01','archive' => NULL), + array('id' => '6','formation_number' => '88611','official_name' => 'Informaticienne / Informaticien avec CFC, orientation développement d\'applications','date_begin' => '2021-08-01','archive' => NULL), + array('id' => '7','formation_number' => '88614','official_name' => 'Informaticienne d\'entreprise, Informaticien d\'entreprise avec CFC','date_begin' => '2021-08-01','archive' => NULL) ); foreach ($course_plans as $course_plan){ $this->db->table('course_plan')->insert($course_plan); diff --git a/orif/plafor/Database/Seeds/addCoursePlanDatas.php b/orif/plafor/Database/Seeds/addCoursePlanDatas.php index 0fe256ba..67410d22 100644 --- a/orif/plafor/Database/Seeds/addCoursePlanDatas.php +++ b/orif/plafor/Database/Seeds/addCoursePlanDatas.php @@ -12,10 +12,10 @@ public function run() { //course_plan// $course_plan = array( - array('id' => '1','formation_number' => '88601','official_name' => ' Informaticien/-ne CFC Développement d\'applications','date_begin' => '2014-08-01','archive' => NULL), - array('id' => '2','formation_number' => '88602','official_name' => ' Informaticien/-ne CFC Informatique d\'entreprise','date_begin' => '2014-08-01','archive' => NULL), - array('id' => '3','formation_number' => '88603','official_name' => ' Informaticien/-ne CFC Technique des systèmes','date_begin' => '2014-08-01','archive' => NULL), - array('id' => '4','formation_number' => '88605','official_name' => ' Opératrice en informatique / Opérateur en informatique CFC','date_begin' => '2018-08-01','archive' => NULL) + array('id' => '1','formation_number' => '88601','official_name' => '[2014-2020] Informaticienne, Informaticien avec CFC, orientation développement d\'applications','date_begin' => '2014-08-01','archive' => NULL), + array('id' => '2','formation_number' => '88602','official_name' => '[2014-2020] Informaticienne, Informaticien avec CFC, orientation informatique d\'entreprise','date_begin' => '2014-08-01','archive' => NULL), + array('id' => '3','formation_number' => '88603','official_name' => '[2014-2020] Informaticienne, Informaticien avec CFC, orientation technique des systèmes','date_begin' => '2014-08-01','archive' => NULL), + array('id' => '4','formation_number' => '88605','official_name' => 'Opératrice en informatique / Opérateur en informatique avec CFC','date_begin' => '2018-08-01','archive' => NULL) ); foreach ($course_plan as $course_plan){ diff --git a/orif/plafor/Database/Seeds/addUserDatas.php b/orif/plafor/Database/Seeds/addUserDatas.php deleted file mode 100644 index a759d59f..00000000 --- a/orif/plafor/Database/Seeds/addUserDatas.php +++ /dev/null @@ -1,76 +0,0 @@ - '1', - 'fk_user_type' => '1', - 'username' => 'admin', - 'password' => '$2y$10$tUB5R1MGgbO.zD//WArnceTY8IgnFkVVsudIdHBxIrEXJ2z3WBvcK', - 'archive' => NULL, - 'date_creation' => '2020-07-09 08:11:05', - ), - array ( - 'id' => '2', - 'fk_user_type' => '2', - 'username' => 'FormateurDev', - 'password' => '$2y$10$Q3H8WodgKonQ60SIcu.eWuVKXmxqBw1X5hMpZzwjRKyCTB1H1l.pe', - 'archive' => NULL, - 'date_creation' => '2020-07-09 13:15:24', - ), - array ( - 'id' => '3', - 'fk_user_type' => '2', - 'username' => 'FormateurSysteme', - 'password' => '$2y$10$Br7mIRYfLufWkrSpi2SyB.Wz0vHZQp7dQf7f2bKy5i/CkhHomSvli', - 'archive' => NULL, - 'date_creation' => '2020-07-09 13:15:47', - ), - array ( - 'id' => '4', - 'fk_user_type' => '3', - 'username' => 'ApprentiDev', - 'password' => '$2y$10$6TLaMd5ljshybxANKgIYGOjY0Xur9EgdzcEPy1bgy2b8uyWYeVoEm', - 'archive' => NULL, - 'date_creation' => '2020-07-09 13:16:05', - ), - array ( - 'id' => '5', - 'fk_user_type' => '3', - 'username' => 'ApprentiSysteme', - 'password' => '$2y$10$0ljkGcDQpTc0RDaN7Y2XcOhS8OB0t0QIhquLv9NcR79IVO9rCR/0.', - 'archive' => NULL, - 'date_creation' => '2020-07-09 13:16:27', - ), - array ( - 'id' => '6', - 'fk_user_type' => '2', - 'username' => 'FormateurOperateur', - 'password' => '$2y$10$SbMYPxqnngLjxVGlG4hW..lrc.pr5Dd74nY.KqdANtEESIvmGRpWi', - 'archive' => NULL, - 'date_creation' => '2020-07-09 13:24:22', - ), - array ( - 'id' => '7', - 'fk_user_type' => '3', - 'username' => 'ApprentiOperateur', - 'password' => '$2y$10$jPNxV2ZZ6Il2LiBQ.CWhNOoud6NsMRFILwHN8kpD410shWeiGpuxK', - 'archive' => NULL, - 'date_creation' => '2020-07-09 13:24:45', - ), - ]; - foreach ($users as $user){ - $this->db->table('user')->insert($user); - } - } - -} \ No newline at end of file diff --git a/orif/plafor/Filters/LoginFilter.php b/orif/plafor/Filters/LoginFilter.php index eb0cda87..bd5951e2 100644 --- a/orif/plafor/Filters/LoginFilter.php +++ b/orif/plafor/Filters/LoginFilter.php @@ -1,9 +1,18 @@ initialized!=false) { $session = service('session'); @@ -33,6 +43,8 @@ public function before(RequestInterface $request, $arguments = null) }catch (\mysqli_sql_exception $e){ } + return $this->redirectToPlaforDeleteUser(); + } @@ -41,6 +53,17 @@ public function before(RequestInterface $request, $arguments = null) */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { - // TODO: Implement after() method. + } + + /** + *This function permit to delete user from plafor/apprentice/delete_user instead + *of using user/admin/delete_user + * @return RedirectResponse + */ + private function redirectToPlaforDeleteUser(){ + if((boolean)strpos($_SERVER['REQUEST_URI'],'user/admin/delete_user')){ + $value=str_replace('plafor/public/user/admin/delete_user','plafor/apprentice/delete_user',$_SERVER['REQUEST_URI']); + return redirect()->to(base_url($value)); + } } } \ No newline at end of file diff --git a/orif/plafor/Language/fr/plafor_lang.php b/orif/plafor/Language/fr/plafor_lang.php index 74097b0a..61f6206a 100644 --- a/orif/plafor/Language/fr/plafor_lang.php +++ b/orif/plafor/Language/fr/plafor_lang.php @@ -1,4 +1,12 @@ -'Le plan de formation sélectionné n\'existe pas', 'msg_err_course_plan_not_unique' =>'Ce plan de formation est déjà utilisé, merci d\'en choisir un autre', + 'associated_op_comp_disabled' =>'La compétence opérationnelle associée à cet objectif est désactivée', + 'associated_comp_dom_disabled' =>'Le domaine de compétence associé est désactivé', // Other texts 'course_plan' =>'Plan de formation', @@ -238,6 +248,7 @@ 'course_status' =>'Status des formations', 'status' =>'Statut de la formation', 'form_number_not_unique' =>'Le numéro du plan de formation existe déjà', + 'with_status' =>'Avec le statut', 'course_plan_enable_explanation' =>'Toutes les informations concernant ce plan de formation (domaines de compétences, compétences oppérationnelles et objectifs) seront réactivées.', 'competence_domain_enable_explanation' =>'Toutes les informations concernant ce domaine de compétence (symbole, nom, compétences oppérationnelles et objectifs) seront réactivées.', @@ -246,4 +257,6 @@ 'user_course_enable_explanation' =>'Toutes les informations concernant cette formation liée seront réactivées.', 'apprentice_link_enable_explanation' =>'Toutes les informations concernant le lien entre cette apprenti et ce formateur seront réactivées.', 'acquisition_status_enable_explanation' =>'Toutes les informations concernant le statut d\'acquisition seront réactivées.', + + 'apprentices_already_assigned_to_course_plan' => 'Les apprentis suivants sont déjà associés au plan de formation' ]; \ No newline at end of file diff --git a/orif/plafor/Models/AcquisitionLevelModel.php b/orif/plafor/Models/AcquisitionLevelModel.php index 9f99fb2c..26ebf8b5 100644 --- a/orif/plafor/Models/AcquisitionLevelModel.php +++ b/orif/plafor/Models/AcquisitionLevelModel.php @@ -1,4 +1,11 @@ -where('fk_course_plan',$coursePlanId)->findAll(); + public static function getCompetenceDomains($coursePlanId,$with_archived=0){ + return CompetenceDomainModel::getInstance()->where('fk_course_plan',$coursePlanId)->withDeleted($with_archived)->findAll(); } /** @@ -66,7 +73,7 @@ public static function getCompetenceDomains($coursePlanId){ * @return array */ public static function getUserCourses($coursePlanId){ - return UserCourseModel::getInstance()->where('fk_course_plan',$coursePlanId)->findAll(); + return UserCourseModel::getInstance()->where('fk_course_plan',$coursePlanId)->withDeleted(true)->findAll(); } /** * @param $userId //is the apprentice id @@ -79,8 +86,8 @@ public function getCoursePlanProgress($userId){ $coursePlanAssociated=[]; function getCoursePlansDatas($userid){ $coursplans=[]; - foreach (UserCourseModel::getInstance()->where('fk_user',$userid)->findAll() as $userCourse){ - $coursplans[$userCourse['fk_course_plan']]=UserCourseModel::getCoursePlan($userCourse['fk_course_plan']); + foreach (UserCourseModel::getInstance()->where('fk_user',$userid)->withDeleted(true)->findAll() as $userCourse){ + $coursplans[$userCourse['fk_course_plan']]=UserCourseModel::getCoursePlan($userCourse['fk_course_plan'],true); $coursplans[$userCourse['fk_course_plan']]['fk_acquisition_status']=$userCourse['fk_status']; } return $coursplans; diff --git a/orif/plafor/Models/ObjectiveModel.php b/orif/plafor/Models/ObjectiveModel.php index 56002038..9ac1917c 100644 --- a/orif/plafor/Models/ObjectiveModel.php +++ b/orif/plafor/Models/ObjectiveModel.php @@ -1,5 +1,11 @@ where('fk_operational_competence',$operationalCompetenceId)->findAll(); + public static function getObjectives($operationalCompetenceId,$with_archived=0){ + return ObjectiveModel::getInstance()->withDeleted($with_archived)->where('fk_operational_competence',$operationalCompetenceId)->findAll(); } public static function getOperationalCompetences($with_archived = false, $competence_domain_id = 0) { diff --git a/orif/plafor/Models/TrainerApprenticeModel.php b/orif/plafor/Models/TrainerApprenticeModel.php index b2e42276..0c3db249 100644 --- a/orif/plafor/Models/TrainerApprenticeModel.php +++ b/orif/plafor/Models/TrainerApprenticeModel.php @@ -1,5 +1,11 @@ find($fkUserId); + return User_model::getInstance()->withDeleted()->find($fkUserId); } /** * @param $fkCoursePlanId * @return array */ - public static function getCoursePlan($fkCoursePlanId){ - return CoursePlanModel::getInstance()->find($fkCoursePlanId); + public static function getCoursePlan($fkCoursePlanId,$with_archived=0){ + return CoursePlanModel::getInstance()->withDeleted($with_archived)->find($fkCoursePlanId); } /** diff --git a/orif/plafor/Models/UserCourseStatusModel.php b/orif/plafor/Models/UserCourseStatusModel.php index 28e0d72f..0660c8ce 100644 --- a/orif/plafor/Models/UserCourseStatusModel.php +++ b/orif/plafor/Models/UserCourseStatusModel.php @@ -1,5 +1,11 @@ +
=lang('plafor_lang.details_acquisition_status')?>
=lang('plafor_lang.field_objective_taxonomy')?>
- =$objective['taxonomy']?> + =$objective['taxonomy']?>=lang('plafor_lang.field_acquisition_level')?>
diff --git a/orif/plafor/Views/apprentice/delete.php b/orif/plafor/Views/apprentice/delete.php index 9b29d8d6..189b5ef6 100644 --- a/orif/plafor/Views/apprentice/delete.php +++ b/orif/plafor/Views/apprentice/delete.php @@ -1,4 +1,13 @@ +=lang('plafor_lang.title_view_course_plan')?>
@@ -26,34 +36,51 @@=lang('plafor_lang.title_view_operational_competence_linked')?>
=lang('plafor_lang.symbol')?> | -=lang('plafor_lang.operational_competence')?> | - get('user_access')>=config('\User\Config\UserConfig')->access_lvl_admin):?> -- | - - |
---|---|---|---|
=$operational_competence['symbol']?> | -=$operational_competence['name']?> | - get('user_access')>=config('\User\Config\UserConfig')->access_lvl_admin):?> -- | - - |
= lang('plafor_lang.field_course_plan_official_name'); ?> | -- | - | - |
---|---|---|---|
= $course_plan['formation_number']?>= $course_plan['official_name']; ?> | -= lang('common_lang.btn_details')?> | -= lang('common_lang.btn_edit')?> | -- |
=lang('plafor_lang.title_view_competence_domains_linked')?>
=lang('plafor_lang.symbol')?> | -=lang('plafor_lang.competence_domain')?> | - get('user_access')>=config('\User\Config\UserConfig')->access_lvl_admin):?> -- | - - |
---|---|---|---|
=$competence_domain['symbol']?> | -=$competence_domain['name']?> | - get('user_access')>=config('\User\Config\UserConfig')->access_lvl_admin):?> -- | - - |