diff --git a/README.md b/README.md index 0036eb1..f6aeb7b 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ Puis effectuer les changement suivants - Renommer sso/filtres/nineskeletor.ini en sso/filtres/nineXXXX.ini - Renommer sso/filtres/nineskeletor_apps.ini en sso/filtres/nineXXXX_apps.ini - Modifier sso/filtres/nineXXXX_apps.ini et remplacer tout les nineskeletor en nineXXXX +- Renommer tmpl/nineskeletor.cron en tmpl/nineXXXX.cron +- Modifier tmpl/nineXXXX.cron et remplacer tout les nineskeletor en nineXXXX - Renommer tmpl/nineskeletor-apache.conf en tmpl/nineXXXX-apache.conf - Modifier tmpl/nineXXXX-apache.conf et remplacer tout les nineskeletor en nineXXXX - Renommer tmpl/nineskeletor-db.yml en tmpl/nineXXXX-db.yml @@ -21,6 +23,7 @@ Puis effectuer les changement suivants - Modifier src/webpack.config.js et remplacer tout les nineskeletor en nineXXXX - Renommer tmpl/nineskeletor-proxy.sh en tmpl/nineXXXX-proxy.sh - Modifier Makefile et remplacer tout les nineskeletor en nineXXXX +- Remplacer logo public/images/logo.png 2= Compilier les asset installer npm diff --git a/src/nineskeletor-1.0/config/packages/doctrine_migrations.yaml b/src/nineskeletor-1.0/config/packages/doctrine_migrations.yaml index 3bf0fbc..49c3517 100644 --- a/src/nineskeletor-1.0/config/packages/doctrine_migrations.yaml +++ b/src/nineskeletor-1.0/config/packages/doctrine_migrations.yaml @@ -1,5 +1,3 @@ doctrine_migrations: - dir_name: '%kernel.project_dir%/src/Migrations' - # namespace is arbitrary but should be different from App\Migrations - # as migrations classes should NOT be autoloaded - namespace: DoctrineMigrations + migrations_paths: + 'DoctrineMigrations': '%kernel.project_dir%/src/Migrations' \ No newline at end of file diff --git a/src/nineskeletor-1.0/config/routes.yaml b/src/nineskeletor-1.0/config/routes.yaml index 8299d64..b429c86 100644 --- a/src/nineskeletor-1.0/config/routes.yaml +++ b/src/nineskeletor-1.0/config/routes.yaml @@ -3,6 +3,10 @@ app_home: path: / defaults: { _controller: App\Controller\HomeController:home } +app_admin: + path: /admin/home + defaults: { _controller: App\Controller\HomeController:admin } + app_ckeditor_upload: path: /user/activity/upload defaults: { _controller: App\Controller\HomeController:upload } @@ -105,103 +109,3 @@ app_group_delete: app_group_select: path: /user/group/select defaults: { _controller: App\Controller\GroupController:select } - -#== Activity ======================================================================================================== -app_activity: - path: /user/activity - defaults: { _controller: App\Controller\ActivityController:list } - -app_activity_submit: - path: /master/activity/submit - defaults: { _controller: App\Controller\ActivityController:submit } - -app_activity_update: - path: /master/activity/update/{id} - defaults: { _controller: App\Controller\ActivityController:update } - -app_activity_delete: - path: /master/activity/delete/{id} - defaults: { _controller: App\Controller\ActivityController:delete } - -app_activity_archive: - path: /master/activity/archive/{id} - defaults: { _controller: App\Controller\ActivityController:archive } - -app_activity_activeactivity: - path: /user/activity/activeactivity - defaults: { _controller: App\Controller\ActivityController:activeactivity } - -#== Answer ======================================================================================================== -app_answer_update: - path: /user/answer/update/{id} - defaults: { _controller: App\Controller\AnswerController:update } - -app_answer_view: - path: /master/answer/view/{id} - defaults: { _controller: App\Controller\AnswerController:view } - -app_answer_select: - path: /master/answer/select - defaults: { _controller: App\Controller\AnswerController:select } - -#== Document ======================================================================================================== -app_document_upload: - path: /user/document/{entity}/{id}/upload - defaults: { _controller: App\Controller\DocumentController:upload } - -app_document_record: - path: /user/document/{entity}/{id}/record - defaults: { _controller: App\Controller\DocumentController:record } - -app_document_recordupload: - path: /user/document/{entity}/{id}/recordupload - defaults: { _controller: App\Controller\DocumentController:recordupload } - -app_document_listmaster: - path: /user/document/{entity}/{id}/listmaster - defaults: { _controller: App\Controller\DocumentController:list, master: true } - -app_document_listuser: - path: /user/document/{entity}/{id}/listuser - defaults: { _controller: App\Controller\DocumentController:list, master: false } - -app_document_view: - path: /user/document/{entity}/{id}/view - defaults: { _controller: App\Controller\DocumentController:view } - -app_document_show: - path: /user/document/{entity}/{id}/show - defaults: { _controller: App\Controller\DocumentController:show } - -app_document_update: - path: /user/document/{entity}/{id}/update - defaults: { _controller: App\Controller\DocumentController:update } - -app_document_delete: - path: /user/document/{entity}/{id}/delete - defaults: { _controller: App\Controller\DocumentController:delete } - -#== Message ======================================================================================================== -app_message_unread: - path: /user/message/unread - defaults: { _controller: App\Controller\MessageController:unread } - -app_message: - path: /user/message/{id} - defaults: { _controller: App\Controller\MessageController:message } - -app_message_load: - path: /user/message/{id}/load - defaults: { _controller: App\Controller\MessageController:load } - -app_message_delete: - path: /user/message/{id}/delete - defaults: { _controller: App\Controller\MessageController:delete } - -app_message_submit: - path: /user/message/{id}/submit - defaults: { _controller: App\Controller\MessageController:submit } - -app_message_group: - path: /master/message/{id}/group - defaults: { _controller: App\Controller\MessageController:messagegroup } diff --git a/src/nineskeletor-1.0/public/images/logo.png b/src/nineskeletor-1.0/public/images/logo.png index 7596de6..db76093 100644 Binary files a/src/nineskeletor-1.0/public/images/logo.png and b/src/nineskeletor-1.0/public/images/logo.png differ diff --git a/src/nineskeletor-1.0/src/Controller/ActivityController.php b/src/nineskeletor-1.0/src/Controller/ActivityController.php deleted file mode 100755 index 06d9d24..0000000 --- a/src/nineskeletor-1.0/src/Controller/ActivityController.php +++ /dev/null @@ -1,397 +0,0 @@ -mail = $mail; } - - public function list(Request $request) - { - $em = $this->getDoctrine()->getManager(); - $user=$this->getUser(); - $activeactivity=$this->get('session')->get('activeactivity'); - - // View master - if ($user->hasRole('ROLE_ADMIN')||$user->hasRole('ROLE_MASTER')) { - $datas = $em->getRepository($this->entity)->findAllMasterActivityActive($user,$activeactivity); - - return $this->render($this->render.'list.html.twig',[ - $this->data."s" => $datas, - "useheader" => true, - "usesidebar" => ($this->getUser()->hasRole("ROLE_ADMIN")), - ]); - } - // View student - elseif($user->hasRole('ROLE_STUDENT')) { - $user=$this->getUser(); - - // Recherche de l'ensemble des activités distribuées des groupes de l'utilisateur - $datas=new ArrayCollection(); - foreach($user->getGroups() as $group) { - $activitys = $em->getRepository($this->entity)->findAllGroupActivityActive($group,$activeactivity); - - foreach($activitys as $activity) { - if($activeactivity&&$activity->getStatus()==10) continue; - if(!$activeactivity&&$activity->getStatus()<10) continue; - - - // Recherche d'une réponse pour l'utilistaeur - $answer=$em->getRepository("App:Answer")->findOneBy(["user"=>$user, "activity" => $activity]); - - // Si pas de réponse on initialise une réponse à vue - if(!$answer) { - $answer=new Answer(); - $answer->setStatus(0); - $answer->setUser($user); - $answer->setActivity($activity); - $em->persist($answer); - $em->flush(); - } - - // Si réponse non vu on la place en vu - if($answer->getStatus()==-1) { - $answer->setStatus(0); - $em->persist($answer); - $em->flush(); - - // Message - $message = new Message; - $message->setMessage("Vu"); - $message->setDeletable(false); - $message->setUser($user); - $message->setAnswer($answer); - $message->addReader($user); - $em->persist($message); - $em->flush(); - } - - $activity->setAnsweruser($answer); - $datas->add($activity); - } - } - return $this->render('Answer/list.html.twig',[ - $this->data."s" => $datas, - "useheader" => true, - "usesidebar" => ($this->getUser()->hasRole("ROLE_ADMIN")), - ]); - } - } - - public function submit(Request $request) - { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data = new Entity(); - $data->setStatus(0); - - // Création du formulaire - $form = $this->createForm(Form::class,$data,array("mode"=>"submit","status"=>$data->getStatus())); - - // Récupération des data du formulaire - $form->handleRequest($request); - - // Sur erreur - $this->getErrorForm(null,$form,$request,$data,"submit"); - - // Sur validation - if ($form->get('submit')->isClicked() && $form->isValid()) { - $data = $form->getData(); - $data->setUser($this->getUser()); - $em->persist($data); - $em->flush(); - - // Retour à la liste - return $this->redirectToRoute($this->route."_update",["id"=>$data->getId()]); - } - - // Affichage du formulaire - return $this->render($this->render.'edit.html.twig', [ - 'useheader' => true, - 'usesidebar' => ($this->getUser()->hasRole("ROLE_ADMIN")), - $this->data => $data, - 'mode' => 'submit', - 'form' => $form->createView() - ]); - } - - public function update($id,Request $request) - { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - // Controle accès - if(!$data) - return $this->redirectToRoute($this->route); - else { - if(!$this->getUser()->Hasrole("ROLE_ADMIN")&&$this->getUser()!=$data->getUser()) - return $this->redirectToRoute($this->route); - } - - // Création du formulaire - $form = $this->createForm(Form::class,$data,array("mode"=>"update","status"=>$data->getStatus())); - - // Récupération des data du formulaire - $form->handleRequest($request); - - // Sur erreur - $this->getErrorForm(null,$form,$request,$data,"update"); - - $valid=false; - if($form->isSubmitted()&&$form->isValid()) { - if($form->get('submit')->isClicked()) - $valid=true; - - if ($form->has('distribution') && $form->get('distribution')->isClicked()) - $valid=true; - - if ($form->has('archiving') && $form->get('archiving')->isClicked()) - $valid=true; - } - - // Sur validation - if ($valid) { - $data = $form->getData(); - - // Distribution de l'activité - if ($form->has('distribution') && $form->get('distribution')->isClicked()) { - // Si réouverture - if($data->getStatus()==10) { - // Message - foreach($data->getAnswers() as $answer) { - $message=new Message; - $message->setMessage("Réouverture de l'Activité"); - $message->setDeletable(false); - $message->setUser($data->getUser()); - $message->setAnswer($answer); - $message->addReader($data->getUser()); - $em->persist($message); - $em->flush(); - - // Notification par mail de la distribution de l'activité - $to = $answer->getUser()->getEmail(); - $from = $data->getUser()->getEmail(); - $subject="Nineschool : Réouverture de l'activité"; - $body ="Activité = ".$data->getName()."
"; - $body.="Professeur = ".$data->getUser()->getDisplayname()."
"; - $body.="Matière = ".$data->getSubject()."
"; - $body.="Url = ".$this->generateUrl('app_answer_update', ["id"=>$answer->getId()], UrlGeneratorInterface::ABSOLUTE_URL); - - $this->mail->sendEmail($subject, $body, $to, $from); - } - } - - // Passage à distribuer - $data->setStatus(1); - } - - // Archivage de l'activité - if ($form->has('archiving') && $form->get('archiving')->isClicked()) { - $data->setStatus(10); - - // Message - foreach($data->getAnswers() as $answer) { - $message=new Message; - $message->setMessage("Archivage de l'Activité"); - $message->setDeletable(false); - $message->setUser($data->getUser()); - $message->setAnswer($answer); - $message->addReader($data->getUser()); - $message->addReader($answer->getUser()); - $em->persist($message); - $em->flush(); - - } - } - - $em->persist($data); - $em->flush(); - - // On initialise une réponse pour l'ensemble des élèves - if($data->getStatus()>0&&$data->getStatus()<10) - $this->initAnswer($data); - - // Retour à la liste - return $this->redirectToRoute($this->route); - } - - // Affichage du formulaire - return $this->render($this->render.'edit.html.twig', [ - 'useheader' => true, - 'usesidebar' => ($this->getUser()->hasRole("ROLE_ADMIN")), - $this->data => $data, - 'mode' => 'update', - 'form' => $form->createView() - ]); - } - - public function delete($id,Request $request) - { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - // Controle accès - if(!$data) - return $this->redirectToRoute($this->route); - else { - if(!$this->getUser()->Hasrole("ROLE_ADMIN")&&$this->getUser()!=$data->getUser()) - return $this->redirectToRoute($this->route); - } - - // Controle avant suppression - $haveerror=false; - if($data->getStatus()!=0&&$data->getStatus()!=10) { - $request->getSession()->getFlashBag()->add("error", 'Cette activité a été distribué vous ne pouvez plus la supprimer'); - $haveerror=true; - } - - if($haveerror) { - return $this->redirectToRoute($this->route."_update",["id"=>$id]); - } - else { - $em->remove($data); - $em->flush(); - - // Retour à la liste - return $this->redirectToRoute($this->route); - } - } - - public function archive($id,Request $request) - { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - // Controle accès - if(!$data) - return $this->redirectToRoute($this->route); - else { - if(!$this->getUser()->Hasrole("ROLE_ADMIN")&&$this->getUser()!=$data->getUser()) - return $this->redirectToRoute($this->route); - } - - // Message - foreach($data->getAnswers() as $answer) { - $message=new Message; - $message->setMessage("Archivage de l'Activité"); - $message->setDeletable(false); - $message->setUser($data->getUser()); - $message->setAnswer($answer); - $message->addReader($data->getUser()); - $message->addReader($answer->getUser()); - $em->persist($message); - $em->flush(); - } - - $data->setStatus(10); - $em->persist($data); - $em->flush(); - - // Retour à la liste - return $this->redirectToRoute($this->route); - } - - protected function initAnswer($activity) { - $em = $this->getDoctrine()->getManager(); - - // Pour chaque élève - $group=$activity->getGroup(); - foreach($group->getUsers() as $user) { - // Existe-t-il une réponse pour l'élève - if($user->hasRole("ROLE_STUDENT")) { - $answer=$em->getRepository("App:Answer")->findOneBy(["user"=>$user,"activity"=>$activity]); - if(!$answer) { - $answer=new Answer; - $answer->setActivity($activity); - $answer->setUser($user); - $answer->setStatus(-1); - - $em->persist($answer); - $em->flush(); - - // Message - $message=new Message; - $message->setMessage("Distribution de l'Activité"); - $message->setDeletable(false); - $message->setUser($activity->getUser()); - $message->setAnswer($answer); - $message->addReader($activity->getUser()); - - $em->persist($message); - $em->flush(); - - // Notification par mail de la distribution de l'activité - $to = $user->getEmail(); - $from = $activity->getUser()->getEmail(); - $subject="Nineschool : Nouvelle Activité à réaliser"; - $body ="Activité = ".$activity->getName()."
"; - $body.="Professeur = ".$activity->getUser()->getDisplayname()."
"; - $body.="Matière = ".$activity->getSubject()."
"; - $body.="Url = ".$this->generateUrl('app_answer_update', ["id"=>$answer->getId()], UrlGeneratorInterface::ABSOLUTE_URL); - - $this->mail->sendEmail($subject, $body, $to, $from); - } - } - } - } - - public function activeactivity() { - $this->get('session')->set('activeactivity',!$this->get('session')->get('activeactivity')); - return $this->redirectToRoute($this->route); - } - - protected function getErrorForm($id,$form,$request,$data,$mode) { - if ($form->get('submit')->isClicked()&&$mode=="delete") { - } - - if ($form->get('submit')->isClicked() && $mode=="submit") { - } - - if ($form->has('archiving') && $form->get('archiving')->isClicked()) { - // On s'assure que l'ensemble des réponses sont corrigés sinon message de conformation - $ok=true; - foreach($data->getAnswers() as $answer) { - if($answer->getStatus()!=15) { - $ok=false; - } - } - if(!$ok) { - $url=$this->generateUrl('app_activity_archive', ["id"=>$data->getId()]); - $form->addError(new FormError("L'ensemble des activités non pas été corrigées. Souhaitez-vous archiver l'activité malgré tout ?
Forcer l'Archivage")); - } - } - - if (($form->get('submit')->isClicked() || ($form->has('archiving') && $form->get('archiving')->isClicked()) ) && !$form->isValid()) { - $this->get('session')->getFlashBag()->clear(); - - $errors = $form->getErrors(); - foreach( $errors as $error ) { - $request->getSession()->getFlashBag()->add("error", $error->getMessage()); - } - } - } -} diff --git a/src/nineskeletor-1.0/src/Controller/AnswerController.php b/src/nineskeletor-1.0/src/Controller/AnswerController.php deleted file mode 100755 index 62e2d97..0000000 --- a/src/nineskeletor-1.0/src/Controller/AnswerController.php +++ /dev/null @@ -1,283 +0,0 @@ -mail = $mail; } - - public function update($id,Request $request) - { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - // Controle accès - if(!$data) - return $this->redirectToRoute($this->route); - else { - if(!$this->getUser()->Hasrole("ROLE_ADMIN")&&$this->getUser()!=$data->getActivity()->getUser()&&$this->getUser()!=$data->getUser()) - return $this->redirectToRoute($this->route); - } - - // Passer la réponse en cours si l'utilisateur en cours est l'élève - if($this->getUser()==$data->getUser()&&$data->getStatus()==0) { - $data->setStatus(1); - $em->persist($data); - $em->flush(); - - // Message - $message = new Message; - $message->setMessage("En cours"); - $message->setDeletable(false); - $message->setUser($data->getUser()); - $message->setAnswer($data); - $message->addReader($data->getUser()); - $em->persist($message); - $em->flush(); - } - - // Création du formulaire - $form = $this->createForm(Form::class,$data,array("mode"=>"update","status"=>$data->getStatus(),"activitystatus"=>$data->getActivity()->getStatus())); - - // Récupération des data du formulaire - $form->handleRequest($request); - - // Sur erreur - $this->getErrorForm(null,$form,$request,$data,"update"); - - $valid=false; - if($form->isSubmitted()&&$form->isValid()) { - if($form->get('submit')->isClicked()) - $valid=true; - - if ($form->has('returned') && $form->get('returned')->isClicked()) - $valid=true; - } - - // Sur validation - if ($valid) { - $data = $form->getData(); - - // Retour de la réponse - if ($form->has('returned') && $form->get('returned')->isClicked()){ - $data->setStatus(10); - - // Message - $message=new Message; - $message->setMessage("Activité rendue"); - $message->setDeletable(false); - $message->setUser($data->getUser()); - $message->setAnswer($data); - $message->addReader($data->getUser()); - - $em->persist($message); - $em->flush(); - - // Notification par mail du rendu de l'activité - $to = $data->getActivity()->getUser()->getEmail(); - $from = $data->getUser()->getEmail(); - $subject="Nineschool : Activité rendue"; - $body ="Activité = ".$data->getActivity()->getName()."
"; - $body.="Elève = ".$data->getUser()->getDisplayname()."
"; - $body.="Matière = ".$data->getActivity()->getSubject()."
"; - $body.="Url = ".$this->generateUrl('app_answer_view', ["id"=>$data->getId()], UrlGeneratorInterface::ABSOLUTE_URL); - - $this->mail->sendEmail($subject, $body, $to, $from); - } - - - $em->persist($data); - $em->flush(); - - // Retour à la liste - return $this->redirectToRoute("app_activity"); - } - - // Affichage du formulaire - return $this->render($this->render.'edit.html.twig', [ - 'useheader' => true, - 'usesidebar' => ($this->getUser()->hasRole("ROLE_ADMIN")), - $this->data => $data, - 'mode' => 'update', - 'form' => $form->createView() - ]); - } - - public function view($id,Request $request) { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - // Controle accès - if(!$data) - return $this->redirectToRoute($this->route); - else { - if(!$this->getUser()->Hasrole("ROLE_ADMIN")&&$this->getUser()!=$data->getActivity()->getUser()) - return $this->redirectToRoute($this->route); - } - - // Création du formulaire - $form = $this->createForm(Corrected::class,$data,array("mode"=>"update","status"=>$data->getStatus(),"activitystatus"=>$data->getActivity()->getStatus())); - - // Récupération des data du formulaire - $form->handleRequest($request); - - // Sur erreur - $this->getErrorForm(null,$form,$request,$data,"update"); - - $valid=false; - if($form->isSubmitted()&&$form->isValid()) { - if($form->get('submit')->isClicked()) - $valid=true; - - if ($form->has('corrected') && $form->get('corrected')->isClicked()) - $valid=true; - - if ($form->has('canceled') && $form->get('canceled')->isClicked()) - $valid=true; - } - - // Sur validation - if ($valid) { - $data = $form->getData(); - - // Retour de la réponse - if ($form->has('corrected') && $form->get('corrected')->isClicked()) { - $data->setStatus(15); - - // Message - $message=new Message; - $message->setMessage("Activité corrigée"); - $message->setDeletable(false); - $message->setUser($this->getUser()); - $message->setAnswer($data); - $message->addReader($this->getUser()); - - $em->persist($message); - $em->flush(); - - // Notification par mail de la correction de l'activité - $to = $data->getActivity()->getUser()->getEmail(); - $from = $data->getUser()->getEmail(); - $subject="Nineschool : Activité réouverte"; - $body ="Activité = ".$data->getActivity()->getName()."
"; - $body.="Professeur = ".$data->getActivity()->getUser()->getDisplayname()."
"; - $body.="Matière = ".$data->getActivity()->getSubject()."
"; - $body.="Url = ".$this->generateUrl('app_answer_update', ["id"=>$data->getId()], UrlGeneratorInterface::ABSOLUTE_URL); - - $this->mail->sendEmail($subject, $body, $to, $from); - } - - // Annuler le rendu de l'élève - if ($form->has('canceled') && $form->get('canceled')->isClicked()) { - $data->setStatus(2); - - // Message - $message=new Message; - $message->setMessage("Activité réouverte"); - $message->setDeletable(false); - $message->setUser($this->getUser()); - $message->setAnswer($data); - $message->addReader($this->getUser()); - - $em->persist($message); - $em->flush(); - - // Notification par mail de la réouverture de l'activité - $to = $data->getActivity()->getUser()->getEmail(); - $from = $data->getUser()->getEmail(); - $subject="Nineschool : Activité réouverte"; - $body ="Activité = ".$data->getActivity()->getName()."
"; - $body.="Professeur = ".$data->getActivity()->getUser()->getDisplayname()."
"; - $body.="Matière = ".$data->getActivity()->getSubject()."
"; - $body.="Url = ".$this->generateUrl('app_answer_update', ["id"=>$data->getId()], UrlGeneratorInterface::ABSOLUTE_URL); - - $this->mail->sendEmail($subject, $body, $to, $from); - } - - - $em->persist($data); - $em->flush(); - - // Retour à la liste - return $this->redirectToRoute("app_activity"); - } - - // Affichage du formulaire - return $this->render($this->render.'view.html.twig', [ - 'useheader' => true, - 'usesidebar' => ($this->getUser()->hasRole("ROLE_ADMIN")), - $this->data => $data, - 'mode' => 'update', - 'form' => $form->createView() - ]); - } - - public function select(Request $request) { - // S'assurer que c'est un appel ajax - if (!$request->isXmlHttpRequest()) { - return new JsonResponse(array('message' => 'Interdit'), 400); - } - - $output=array(); - $em = $this->getDoctrine()->getManager(); - $page_limit=$request->query->get('page_limit'); - $q=$request->query->get('q'); - $id=$request->query->get('activity'); - - $activity=$em->getRepository("App:Activity")->find($id); - if(!$activity) { - $response = new Response(json_encode($ret_string)); - $response->headers->set('Content-Type', 'application/json'); - return $response; - } - - $datas=$activity->getAnswers(); - foreach($datas as $data) { - array_push($output,array("id"=>$data->getId(),"text"=>$data->getDisplayname())); - } - - $ret_string["results"]=$output; - $response = new Response(json_encode($ret_string)); - $response->headers->set('Content-Type', 'application/json'); - return $response; - } - - protected function getErrorForm($id,$form,$request,$data,$mode) { - if ($form->get('submit')->isClicked()&&$mode=="delete") { - } - - if ($form->get('submit')->isClicked() && $mode=="submit") { - } - - if ($form->get('submit')->isClicked() && !$form->isValid()) { - $this->get('session')->getFlashBag()->clear(); - - $errors = $form->getErrors(); - foreach( $errors as $error ) { - $request->getSession()->getFlashBag()->add("error", $error->getMessage()); - } - } - } -} diff --git a/src/nineskeletor-1.0/src/Controller/DocumentController.php b/src/nineskeletor-1.0/src/Controller/DocumentController.php deleted file mode 100755 index 3893e0d..0000000 --- a/src/nineskeletor-1.0/src/Controller/DocumentController.php +++ /dev/null @@ -1,493 +0,0 @@ -ctrlAccessentity($entity,$id,"update")) return $this->redirectToRoute("app_activity"); - - // Rendu - return $this->render($this->render.'upload.html.twig',[ - 'useheader' => false, - 'usesidebar' => false, - 'entity' => $entity, - 'id' => $id, - ]); - } - - public function record($entity,$id) - { - // Controles d'accès en fonction de l'entité d'arrivé - if(!$this->ctrlAccessentity($entity,$id,"update")) return $this->redirectToRoute("app_activity"); - - // Rendu - return $this->render($this->render.'record.html.twig',[ - 'useheader' => false, - 'usesidebar' => false, - 'entity' => $entity, - 'id' => $id, - ]); - } - - public function recordupload($entity,$id,Request $request) - { - // Controles d'accès en fonction de l'entité d'arrivé - if(!$this->ctrlAccessentity($entity,$id,"update")) return $this->redirectToRoute("app_activity"); - - // Récupérper l'enregistrement - $content = $request->getContent(); - $name = $request->get('name'); - - // Destination - $directory = $this->getParameter('kernel.project_dir')."/uploads/document/".$entity."/".$id; - $filename = uniqid().".ogg"; - - // Ecrire sur le filesystem - $fs = new Filesystem(); - $fs->mkdir($directory); - $fp = fopen($directory."/".$filename, 'wb'); - fwrite($fp, $content); - fclose($fp); - - // Création du document - $em = $this->getDoctrine()->getManager(); - $document=new Entity(); - $document->setName($name); - $document->setFilename($filename); - $document->setRoworder(99999); - $document->setExtention("ogg"); - $document->setMinetype("video/webm"); - $document->setHavethumb(false); - $document->setEntity($entity); - - - // Rattacher le document à l'entity - switch($entity) { - case "activity": - $activity=$em->getRepository("App:Activity")->find($id); - $document->setActivity($activity); - break; - - case "corrected": - $corrected=$em->getRepository("App:Activity")->find($id); - $document->setCorrected($corrected); - break; - - case "answer": - $answer=$em->getRepository("App:Answer")->find($id); - $document->setAnswer($answer); - break; - - case "answercorrected": - $answer=$em->getRepository("App:Answer")->find($id); - $document->setAnswercorrected($answer); - break; - } - - // Sauvegarde - $em->persist($document); - $em->flush(); - - // Retour - return new Response(json_encode([])); - } - - public function list($entity,$id,$master) { - // Controles d'accès en fonction de l'entité d'arrivé - if(!$this->ctrlAccessentity($entity,$id,"view")) return $this->redirectToRoute("app_activity"); - - // Récupérer les documents - $em = $this->getDoctrine()->getManager(); - $documents=null; - switch($entity) { - case "activity": - $activity=$em->getRepository("App:Activity")->find($id); - if($activity) { - $documents=$em->getRepository("App:Document")->findBy(["activity"=>$activity]); - if($activity->getStatus()!=0) $master=false; - } - break; - - case "corrected": - $corrected=$em->getRepository("App:Activity")->find($id); - if($corrected) { - $documents=$em->getRepository("App:Document")->findBy(["corrected"=>$corrected]); - if($corrected->getStatus()==10) $master=false; - } - - break; - - case "answer": - $answer=$em->getRepository("App:Answer")->find($id); - if($answer) { - $documents=$em->getRepository("App:Document")->findBy(["answer"=>$answer]); - if($answer->getStatus()>=10) - $master=false; - if($answer->getActivity()->getStatus()==10) - $master=false; - } - break; - - case "answercorrected": - $answercorrected=$em->getRepository("App:Answer")->find($id); - if($answercorrected) { - $documents=$em->getRepository("App:Document")->findBy(["answercorrected"=>$answercorrected]); - if($answercorrected->getStatus()>=15) - $master=false; - if($answercorrected->getActivity()->getStatus()==10) - $master=false; - } - break; - } - - // Construire le tableau d'id - $output=[]; - - foreach($documents as $document) { - $tmp=[ - "id"=>$document->getId(), - "html"=>$this->thumb($document->getId(),$master), - ]; - - array_push($output,$tmp); - - } - - // Retour - return new Response(json_encode($output)); - } - - public function thumb($id,$master) - { - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - $title=$data->getName(); - $filename=$data->getFilename(); - $description=$data->getDescription(); - $extention=$data->getExtention(); - $minetype=$data->getMinetype(); - $minefamily=explode("/",$minetype)[0]; - - switch($data->getEntity()) { - case "activity" : $identity=$data->getActivity()->getId(); break; - case "corrected" : $identity=$data->getCorrected()->getId(); break; - case "answer" : $identity=$data->getAnswer()->getId(); break; - case "answercorrected" : $identity=$data->getAnswercorrected()->getId(); break; - } - if($data->getHavethumb()) { - $directory = $this->getParameter('kernel.project_dir') . '/uploads/document/'.$data->getEntity()."/".$identity; - $dataimg = file_get_contents($directory."/thumb/".$filename); - $url="data:image/" . $extention . ";base64," . base64_encode($dataimg); - } - else { - $url="/".$this->getParameter("appAlias")."/images/files/".$extention.".png"; - } - - - return $this->renderView($this->render.'render.html.twig',[ - 'entity' => $data->getEntity(), - 'id' => $id, - 'title' => $title, - 'description' => $description, - 'url' => $url, - 'extention' => $extention, - 'minefamily' => $minefamily, - 'master' => $master, - ]); - } - - public function view($entity,$id) { - // Controles d'accès sur le document - if(!$this->ctrlAccessdocument($entity,$id,"view")) return $this->redirectToRoute("app_activity"); - - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - switch($data->getEntity()) { - case "activity" : $identity=$data->getActivity()->getId(); break; - case "corrected" : $identity=$data->getCorrected()->getId(); break; - case "answer" : $identity=$data->getAnswer()->getId(); break; - case "answercorrected" : $identity=$data->getAnswercorrected()->getId(); break; - } - - $directory= $this->getParameter('kernel.project_dir') . '/uploads/document/'.$entity."/".$identity; - $url=$directory."/".$data->getFilename(); - $file = new file($url); - - $minetype=$file->getMimeType(); - $minefamily=explode("/",$minetype)[0]; - - if($minefamily=="text" || $minefamily=="image") { - $image=""; - if($minefamily=="image") { - $image = "data:image/" . $file->getExtension() . ";base64," . base64_encode(file_get_contents($url)); - } - - return $this->render($this->render.'view.html.twig',[ - 'useheader' => false, - 'usesidebar' => false, - 'entity' => $entity, - 'id' => $id, - 'minefamily' => $minefamily, - 'image' => $image - ]); - } - else { - $response = new BinaryFileResponse($file); - $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE); - - return $response; - } - } - - public function show($entity,$id) { - // Controles d'accès sur le document - if(!$this->ctrlAccessdocument($entity,$id,"view")) return $this->redirectToRoute("app_activity"); - - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - switch($data->getEntity()) { - case "activity" : $identity=$data->getActivity()->getId(); break; - case "corrected" : $identity=$data->getCorrected()->getId(); break; - case "answer" : $identity=$data->getAnswer()->getId(); break; - case "answercorrected" : $identity=$data->getAnswercorrected()->getId(); break; - } - - $directory= $this->getParameter('kernel.project_dir') . '/uploads/document/'.$entity."/".$identity; - $url=$directory."/".$data->getFilename(); - $file = new file($url); - - $response = new BinaryFileResponse($file); - //$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE); - $name= ($data->getName()==$data->getFilename()?$data->getFilename():$data->getName().'.'.$data->getExtention()); - $response->setContentDisposition( - ResponseHeaderBag::DISPOSITION_ATTACHMENT, - $name - ); - - return $response; - } - - public function update($entity,$id,Request $request) - { - // Controles d'accès sur le document - if(!$this->ctrlAccessdocument($entity,$id,"update")) return $this->redirectToRoute("app_activity"); - - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - // Création du formulaire - $form = $this->createForm(Form::class,$data,array("mode"=>"update")); - - // Récupération des data du formulaire - $form->handleRequest($request); - - // Sur validation - if ($form->get('submit')->isClicked() && $form->isValid()) { - $data = $form->getData(); - $em->persist($data); - $em->flush(); - - return $this->render($this->render.'close.html.twig'); - } - - // Affichage du formulaire - return $this->render($this->render.'edit.html.twig', [ - 'useheader' => false, - 'usesidebar' => false, - $this->data => $data, - 'mode' => 'update', - 'form' => $form->createView(), - ]); - } - - public function delete($entity,$id,Request $request) - { - // Controles d'accès sur le document - if(!$this->ctrlAccessdocument($entity,$id,"update")) return $this->redirectToRoute("app_activity"); - - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - - // Création du formulaire - $form = $this->createForm(Form::class,$data,array("mode"=>"update")); - - // Récupération des data du formulaire - $form->handleRequest($request); - - if($data) { - $em->remove($data); - $em->flush(); - - return $this->render($this->render.'close.html.twig'); - } - - // Affichage du formulaire - return $this->render($this->render.'edit.html.twig', [ - 'useheader' => false, - 'usesidebar' => false, - $this->data => $data, - 'mode' => 'update', - 'form' => $form->createView(), - ]); - } - - private function ctrlAccessentity($entity,$id,$mode) { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - - switch($entity) { - case "activity" : - $data=$em->getRepository("App:Activity")->find($id); - if(!$data) return false; - - $group=$data->getGroup(); - $user=$this->getUser(); - $isadmin=($user->Hasrole("ROLE_ADMIN")); - $ismaster=($user==$data->getUser()); - $ismember=($group->getUsers()->contains($this->getUser())); - - // Test visualisation = tout les membres du groupes peuvent voir l'énoncé - if(!$isadmin && !$ismaster && !$ismember) - return false; - - // Membre = Test visualisation activité que si activité non brouillon - if(!$isadmin && !$ismaster && $ismember) { - if($data->getStatus()==0) - return false; - } - - // Test modification = Impossible de modifier un document si activité non brouillon - if ($mode=="update" && ((!$isadmin && !$ismaster) || $data->getStatus()>0)) - return false; - break; - - case "corrected": - $data=$em->getRepository("App:Activity")->find($id); - if(!$data) return false; - - $group=$data->getGroup(); - $user=$this->getUser(); - $isadmin=($user->Hasrole("ROLE_ADMIN")); - $ismaster=($user==$data->getUser()); - $ismember=($group->getUsers()->contains($this->getUser())); - - // Test visualisation - if(!$isadmin && !$ismaster && !$ismember) - return false; - - // Membre = Visualisation uniquement si sa réponse est corrigée - if(!$isadmin && !$ismaster && $ismember) { - $answer=$em->getRepository("App:Answer")->findOneBy(["activity"=>$data,"user"=>$user]); - if(!$answer || $answer->getStatus()<15) - return false; - } - - // Test modification = Impossible de modifier un document si activité close - if ($mode=="update" && ((!$isadmin && !$ismaster) || $data->getStatus()==10)) - return false; - break; - - case "answer": - $data=$em->getRepository("App:Answer")->find($id); - if(!$data) return false; - - $user=$this->getUser(); - $isadmin=($user->Hasrole("ROLE_ADMIN")); - $ismaster=($user==$data->getActivity()->getUser()); - $isuser=($user==$data->getUser()); - - // Test visualisation - if(!$isadmin && !$ismaster && !$isuser) - return false; - - // Test modification = Impossible de modifier un document si réponse rendues ou activité non distribut - if ($mode=="update" && ((!$isadmin && !$isuser) || $data->getStatus()>=10 || $data->getActivity()->getStatus()!=1)) - return false; - break; - - case "answercorrected": - $data=$em->getRepository("App:Answer")->find($id); - if(!$data) return false; - - $user=$this->getUser(); - $isadmin=($user->Hasrole("ROLE_ADMIN")); - $ismaster=($user==$data->getActivity()->getUser()); - $isuser=($user==$data->getUser()); - - // Test visualisation - if(!$isadmin && !$ismaster && !$isuser) - return false; - - // Membre = Visualisation uniquement si sa réponse est rendu - if(!$isadmin && !$ismaster && $isuser) { - if($data->getStatus()<10) - return false; - } - - // Test modification = Impossible de modifier un document si réponse corrigées - if ($mode=="update" && ((!$isadmin && !$ismaster) || $data->getStatus()>=15 || $data->getActivity()->getStatus()!=1) ) - return false; - break; - } - - return true; - } - - private function ctrlAccessdocument($entity,$id,$mode) { - // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); - - $document=$em->getRepository($this->entity)->find($id); - if(!$document) return false; - - switch($entity) { - case "activity" : - $data=$document->getActivity(); - return $this->ctrlAccessentity($entity,$data->getId(),$mode); - break; - - case "corrected": - $data=$document->getCorrected(); - return $this->ctrlAccessentity($entity,$data->getId(),$mode); - break; - - case "answer" : - $data=$document->getAnswer(); - return $this->ctrlAccessentity($entity,$data->getId(),$mode); - break; - - case "answercorrected" : - $data=$document->getAnswercorrected(); - return $this->ctrlAccessentity($entity,$data->getId(),$mode); - break; - } - - return true; - } - -} diff --git a/src/nineskeletor-1.0/src/Controller/HomeController.php b/src/nineskeletor-1.0/src/Controller/HomeController.php index c71ad54..f967d4f 100755 --- a/src/nineskeletor-1.0/src/Controller/HomeController.php +++ b/src/nineskeletor-1.0/src/Controller/HomeController.php @@ -11,14 +11,18 @@ class HomeController extends AbstractController { public function home() { - return $this->redirectToRoute("app_activity"); - - /* return $this->render('Home/home.html.twig',[ "useheader" => true, - "usesidebar" => ($this->getUser()?$this->getUser()->hasRole("ROLE_ADMIN"):false), + "usesidebar" => false, + ]); + } + + public function admin() + { + return $this->render('Home/admin.html.twig',[ + "useheader" => true, + "usesidebar" => true, ]); - */ } public function upload(Request $request,$access=null) { diff --git a/src/nineskeletor-1.0/src/Controller/MessageController.php b/src/nineskeletor-1.0/src/Controller/MessageController.php deleted file mode 100755 index 97d98ca..0000000 --- a/src/nineskeletor-1.0/src/Controller/MessageController.php +++ /dev/null @@ -1,268 +0,0 @@ -getDoctrine()->getManager(); - - // Création du formulaire - $data=new Entity; - $form = $this->createForm(Form::class,$data,array("mode"=>"submit")); - - // Récupération des data du formulaire - $form->handleRequest($request); - - - return $this->render('Message/message.html.twig',[ - 'id' => $id, - 'form' => $form->createView() - ]); - } - - public function messagegroup($id, Request $request) { - $em = $this->getDoctrine()->getManager(); - - // Création du formulaire - $activity=$em->getRepository("App:Activity")->find($id); - if(!$activity) return $this->redirectToRoute("app_activity"); - - // Formulaire - $form = $this->createForm(Activitymessage::class,$activity,array("mode"=>"submit","id"=>$activity->getId())); - - // Récupération des data du formulaire - $form->handleRequest($request); - - // Sur validation - if ($form->get('submit')->isClicked() && $form->isValid()) { - $data = $form->getData(); - $message = $form->get("message")->getData(); - - if($message) { - foreach($data->getAnswers() as $answer) { - $data=new Entity; - $data->setMessage($message); - $data->setUser($this->getUser()); - $data->addReader($this->getUser()); - $data->setDeletable(true); - $data->setAnswer($answer); - - $em->persist($data); - $em->flush(); - } - } - - // Fermeture de la popup - return $this->render($this->render.'close.html.twig'); - } - - return $this->render('Message/group.html.twig',[ - 'id' => $id, - 'activity' => $activity, - 'form' => $form->createView() - ]); - } - - public function load($id,Request $request) { - return new Response(json_encode($this->getMessages($id))); - } - - public function submit($id,Request $request) { - $em = $this->getDoctrine()->getManager(); - $answer=$em->getRepository("App:Answer")->find($id); - if(!$answer) { - $output=["return"=>"KO","error"=>"Utilisateur inconnu"]; - return new Response(json_encode($output)); - } - // Controler que l'on peut créer mesage sur la answer - - // Récupérer les datas envoyés en post - $html = $request->request->get('html'); - - // Création du message - $data = new Entity(); - $data->setUser($this->getUser()); - $data->setAnswer($answer); - $data->setMessage($html); - $data->setDeletable(true); - $em->persist($data); - $em->flush(); - - // Si on génère le message c'est qu'il est forcement lu - $data->addReader($this->getUser()); - - return new Response(json_encode($this->getMessages($id))); - } - - public function unread() { - $em = $this->getDoctrine()->getManager(); - $user=$this->getUser(); - $output=[]; - - // View master - if ($user->hasRole('ROLE_ADMIN')||$user->hasRole('ROLE_MASTER')) { - // Sur chaque activité de l'activité - $activitys = $em->getRepository("App:Activity")->findBy(["user"=>$user]); - foreach($activitys as $activity) { - // Sur chaque réponse de l'activité - $answers = $em->getRepository("App:Answer")->findBy(["activity"=>$activity]); - foreach($answers as $answer) { - // Statut de la réponse - switch($answer->getStatus()) { - case -1: $status = "non vu"; break; - case 0: $status = "vu"; break; - case 1: $status = "en cours"; break; - case 2: $status = "réouvert"; break; - case 10: $status = "rendu"; break; - case 15: $status = "corrigé"; break; - } - - // Initialisation du tableau des messages non lus - $tmp = [ - "id" => $answer->getId(), - "cpt" => 0, - "status" => $status - ]; - - // Sur chaque message de la réponse - $messages = $em->getRepository("App:Message")->findBy(["answer"=>$answer]); - foreach($messages as $message) { - $readers=$message->getReaders(); - if(!$readers->contains($user)) - $tmp["cpt"]=$tmp["cpt"]+1; - } - array_push($output,$tmp); - } - } - } - // View student - elseif($user->hasRole('ROLE_STUDENT')) { - $answers = $em->getRepository("App:Answer")->findBy(["user"=>$user]); - foreach($answers as $answer) { - // Statut de la réponse - switch($answer->getStatus()) { - case -1: $status = "non vu"; break; - case 0: $status = "vu"; break; - case 1: $status = "en cours"; break; - case 2: $status = "réouvert"; break; - case 10: $status = "rendu"; break; - case 15: $status = "corrigé"; break; - } - - // Initialisation du tableau des messages non lus - $tmp = [ - "id" => $answer->getId(), - "cpt" => 0, - "status" => $status - ]; - - // Sur chaque message de la réponse - $messages = $em->getRepository("App:Message")->findBy(["answer"=>$answer]); - foreach($messages as $message) { - $readers=$message->getReaders(); - if(!$readers->contains($user)) - $tmp["cpt"]=$tmp["cpt"]+1; - } - array_push($output,$tmp); - } - } - - return new Response(json_encode($output)); - } - - private function getMessages($id) { - $em = $this->getDoctrine()->getManager(); - - $datas=$em->getRepository($this->entity)->findBy(["answer"=>$id],["submitdate"=>"DESC"]); - - $return=[]; - foreach($datas as $data) { - $user=$this->getUser(); - $isadmin=($user->Hasrole("ROLE_ADMIN")); - $ismaster=($user==$data->getAnswer()->getActivity()->getUser()); - $isuser=($user==$data->getUser()); - - //Si le message est supprimable : seul le propriétaire peut supprimer - $deletable=$data->getDeletable(); - if($deletable) { - if(!$isadmin&&!$ismaster&&!$isuser) $deletable=false; - } - else{ - // Un admin peut tout supprimer - if($isadmin) $deletable=true; - } - - // Si on liste le message c'est qu'il est lu - $readers=$data->getReaders(); - if(!$readers->contains($user)) { - $data->addReader($user); - $em->persist($data); - $em->flush(); - } - - $tmp = [ - "id" => $data->getId(), - "message" => $data->getMessage(), - "submitdate" => $data->getSubmitdate()->format("d/m/Y H:i"), - "userdisplayname" => $data->getUser()->getDisplayname(), - "deletable" => $deletable - ]; - array_push($return,$tmp); - } - - return $return; - } - - public function delete($id) { - $em = $this->getDoctrine()->getManager(); - $data=$em->getRepository($this->entity)->find($id); - if(!$data) { - $output=["return"=>"KO","error"=>"Message non retrouvé"]; - return new Response(json_encode($output)); - } - - $user=$this->getUser(); - $isadmin=($user->Hasrole("ROLE_ADMIN")); - $ismaster=($user==$data->getAnswer()->getActivity()->getUser()); - $isuser=($user==$data->getUser()); - - //Si le message est supprimable : seul le propriétaire peut supprimer - $deletable=$data->getDeletable(); - if($deletable) { - if(!$isadmin&&!$ismaster&&!$isuser) $deletable=false; - } - else{ - // Un admin peut tout supprimer - if($isadmin) $deletable=true; - } - - if(!$deletable) { - $output=["return"=>"KO","error"=>"Message non supprimable"]; - return new Response(json_encode($output)); - } - - $em->remove($data); - $em->flush(); - - return new Response(json_encode([])); - } -} diff --git a/src/nineskeletor-1.0/src/Controller/SecurityController.php b/src/nineskeletor-1.0/src/Controller/SecurityController.php index a2a197b..0861cd7 100755 --- a/src/nineskeletor-1.0/src/Controller/SecurityController.php +++ b/src/nineskeletor-1.0/src/Controller/SecurityController.php @@ -158,7 +158,8 @@ class SecurityController extends AbstractController $this->get('session')->invalidate(); // Init Client CAS - \phpCAS::setDebug('/var/www/html/schedule/var/log/cas.log'); + $alias=$this->getParameter('appAlias'); + \phpCAS::setDebug('/var/www/html/'.$alias.'/var/log/cas.log'); \phpCAS::client(CAS_VERSION_2_0, $this->getParameter('casHost'), intval($this->getParameter('casPort')), is_null($this->getParameter('casPath')) ? '' : $this->getParameter('casPath'), false); \phpCAS::setNoCasServerValidation(); diff --git a/src/nineskeletor-1.0/src/Entity/Activity.php b/src/nineskeletor-1.0/src/Entity/Activity.php deleted file mode 100644 index b53ec25..0000000 --- a/src/nineskeletor-1.0/src/Entity/Activity.php +++ /dev/null @@ -1,282 +0,0 @@ -answeruser; - } - public function setAnsweruser(?Answer $answer): self - { - $this->answeruser = $answer; - - return $this; - } - - public function __construct() - { - $this->activitydocuments = new ArrayCollection(); - $this->correcteddocuments = new ArrayCollection(); - $this->answers = new ArrayCollection(); - } - - public function getId(): ?int - { - return $this->id; - } - - public function getName(): ?string - { - return $this->name; - } - - public function setName(string $name): self - { - $this->name = $name; - - return $this; - } - - public function getSubject(): ?string - { - return $this->subject; - } - - public function setSubject(?string $subject): self - { - $this->subject = $subject; - - return $this; - } - - public function getStatus(): ?int - { - return $this->status; - } - - public function setStatus(int $status): self - { - $this->status = $status; - - return $this; - } - - public function getActivity(): ?string - { - return $this->activity; - } - - public function setActivity(?string $activity): self - { - $this->activity = $activity; - - return $this; - } - - public function getCorrected(): ?string - { - return $this->corrected; - } - - public function setCorrected(?string $corrected): self - { - $this->corrected = $corrected; - - return $this; - } - - public function getUser(): ?User - { - return $this->user; - } - - public function setUser(?User $user): self - { - $this->user = $user; - - return $this; - } - - public function getGroup(): ?Group - { - return $this->group; - } - - public function setGroup(?Group $group): self - { - $this->group = $group; - - return $this; - } - - /** - * @return Collection|Document[] - */ - public function getActivitydocuments(): Collection - { - return $this->activitydocuments; - } - - public function addActivitydocument(Document $activitydocument): self - { - if (!$this->activitydocuments->contains($activitydocument)) { - $this->activitydocuments[] = $activitydocument; - $activitydocument->setActivity($this); - } - - return $this; - } - - public function removeActivitydocument(Document $activitydocument): self - { - if ($this->activitydocuments->contains($activitydocument)) { - $this->activitydocuments->removeElement($activitydocument); - // set the owning side to null (unless already changed) - if ($activitydocument->getActivity() === $this) { - $activitydocument->setActivity(null); - } - } - - return $this; - } - - /** - * @return Collection|Document[] - */ - public function getCorrecteddocuments(): Collection - { - return $this->correcteddocuments; - } - - public function addCorrecteddocument(Document $correcteddocument): self - { - if (!$this->correcteddocuments->contains($correcteddocument)) { - $this->correcteddocuments[] = $correcteddocument; - $correcteddocument->setCorrected($this); - } - - return $this; - } - - public function removeCorrecteddocument(Document $correcteddocument): self - { - if ($this->correcteddocuments->contains($correcteddocument)) { - $this->correcteddocuments->removeElement($correcteddocument); - // set the owning side to null (unless already changed) - if ($correcteddocument->getCorrected() === $this) { - $correcteddocument->setCorrected(null); - } - } - - return $this; - } - - /** - * @return Collection|Answer[] - */ - public function getAnswers(): Collection - { - return $this->answers; - } - - public function addAnswer(Answer $answer): self - { - if (!$this->answers->contains($answer)) { - $this->answers[] = $answer; - $answer->setActivity($this); - } - - return $this; - } - - public function removeAnswer(Answer $answer): self - { - if ($this->answers->contains($answer)) { - $this->answers->removeElement($answer); - // set the owning side to null (unless already changed) - if ($answer->getActivity() === $this) { - $answer->setActivity(null); - } - } - - return $this; - } - - - -} \ No newline at end of file diff --git a/src/nineskeletor-1.0/src/Entity/Answer.php b/src/nineskeletor-1.0/src/Entity/Answer.php deleted file mode 100644 index baaa7e2..0000000 --- a/src/nineskeletor-1.0/src/Entity/Answer.php +++ /dev/null @@ -1,238 +0,0 @@ -user->getDisplayname(); - } - - public function __construct() - { - $this->answerdocuments = new ArrayCollection(); - $this->answercorrecteddocuments = new ArrayCollection(); - $this->messages = new ArrayCollection(); - } - - public function getId(): ?int - { - return $this->id; - } - - public function getStatus(): ?int - { - return $this->status; - } - - public function setStatus(int $status): self - { - $this->status = $status; - - return $this; - } - - public function getAnswer(): ?string - { - return $this->answer; - } - - public function setAnswer(?string $answer): self - { - $this->answer = $answer; - - return $this; - } - - public function getAnswercorrected(): ?string - { - return $this->answercorrected; - } - - public function setAnswercorrected(?string $answercorrected): self - { - $this->answercorrected = $answercorrected; - - return $this; - } - - public function getUser(): ?User - { - return $this->user; - } - - public function setUser(?User $user): self - { - $this->user = $user; - - return $this; - } - - /** - * @return Collection|Document[] - */ - public function getAnswerdocuments(): Collection - { - return $this->answerdocuments; - } - - public function addAnswerdocument(Document $answerdocument): self - { - if (!$this->answerdocuments->contains($answerdocument)) { - $this->answerdocuments[] = $answerdocument; - $answerdocument->setAnswer($this); - } - - return $this; - } - - public function removeAnswerdocument(Document $answerdocument): self - { - if ($this->answerdocuments->contains($answerdocument)) { - $this->answerdocuments->removeElement($answerdocument); - // set the owning side to null (unless already changed) - if ($answerdocument->getAnswer() === $this) { - $answerdocument->setAnswer(null); - } - } - - return $this; - } - - /** - * @return Collection|Document[] - */ - public function getAnswercorrecteddocuments(): Collection - { - return $this->answercorrecteddocuments; - } - - public function addAnswercorrecteddocument(Document $answercorrecteddocument): self - { - if (!$this->answercorrecteddocuments->contains($answercorrecteddocument)) { - $this->answercorrecteddocuments[] = $answercorrecteddocument; - $answercorrecteddocument->setAnswercorrected($this); - } - - return $this; - } - - public function removeAnswercorrecteddocument(Document $answercorrecteddocument): self - { - if ($this->answercorrecteddocuments->contains($answercorrecteddocument)) { - $this->answercorrecteddocuments->removeElement($answercorrecteddocument); - // set the owning side to null (unless already changed) - if ($answercorrecteddocument->getAnswercorrected() === $this) { - $answercorrecteddocument->setAnswercorrected(null); - } - } - - return $this; - } - - public function getActivity(): ?Activity - { - return $this->activity; - } - - public function setActivity(?Activity $activity): self - { - $this->activity = $activity; - - return $this; - } - - /** - * @return Collection|Message[] - */ - public function getMessages(): Collection - { - return $this->messages; - } - - public function addMessage(Message $message): self - { - if (!$this->messages->contains($message)) { - $this->messages[] = $message; - $message->setAnswer($this); - } - - return $this; - } - - public function removeMessage(Message $message): self - { - if ($this->messages->contains($message)) { - $this->messages->removeElement($message); - // set the owning side to null (unless already changed) - if ($message->getAnswer() === $this) { - $message->setAnswer(null); - } - } - - return $this; - } - - - -} \ No newline at end of file diff --git a/src/nineskeletor-1.0/src/Entity/Document.php b/src/nineskeletor-1.0/src/Entity/Document.php deleted file mode 100644 index f630c4b..0000000 --- a/src/nineskeletor-1.0/src/Entity/Document.php +++ /dev/null @@ -1,242 +0,0 @@ -id; - } - - public function getName(): ?string - { - return $this->name; - } - - public function setName(string $name): self - { - $this->name = $name; - - return $this; - } - - public function getFilename(): ?string - { - return $this->filename; - } - - public function setFilename(string $filename): self - { - $this->filename = $filename; - - return $this; - } - - public function getDescription(): ?string - { - return $this->description; - } - - public function setDescription(?string $description): self - { - $this->description = $description; - - return $this; - } - - public function getEntity(): ?string - { - return $this->entity; - } - - public function setEntity(string $entity): self - { - $this->entity = $entity; - - return $this; - } - - public function getRoworder(): ?int - { - return $this->roworder; - } - - public function setRoworder(int $roworder): self - { - $this->roworder = $roworder; - - return $this; - } - - public function getExtention(): ?string - { - return $this->extention; - } - - public function setExtention(string $extention): self - { - $this->extention = $extention; - - return $this; - } - - public function getMinetype(): ?string - { - return $this->minetype; - } - - public function setMinetype(string $minetype): self - { - $this->minetype = $minetype; - - return $this; - } - - public function getHavethumb(): ?bool - { - return $this->havethumb; - } - - public function setHavethumb(bool $havethumb): self - { - $this->havethumb = $havethumb; - - return $this; - } - - public function getActivity(): ?Activity - { - return $this->activity; - } - - public function setActivity(?Activity $activity): self - { - $this->activity = $activity; - - return $this; - } - - public function getCorrected(): ?Activity - { - return $this->corrected; - } - - public function setCorrected(?Activity $corrected): self - { - $this->corrected = $corrected; - - return $this; - } - - public function getAnswer(): ?Answer - { - return $this->answer; - } - - public function setAnswer(?Answer $answer): self - { - $this->answer = $answer; - - return $this; - } - - public function getAnswercorrected(): ?Answer - { - return $this->answercorrected; - } - - public function setAnswercorrected(?Answer $answercorrected): self - { - $this->answercorrected = $answercorrected; - - return $this; - } - - -} \ No newline at end of file diff --git a/src/nineskeletor-1.0/src/Entity/Group.php b/src/nineskeletor-1.0/src/Entity/Group.php index fb8aaa6..9fd0973 100644 --- a/src/nineskeletor-1.0/src/Entity/Group.php +++ b/src/nineskeletor-1.0/src/Entity/Group.php @@ -6,12 +6,14 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * Group - * - * @ORM\Table(name="groupe") + * * @ORM\Entity(repositoryClass="App\Repository\GroupRepository") + * @ORM\Table(name="groupe",uniqueConstraints={@ORM\UniqueConstraint(name="name", columns={"name"})})) + * @UniqueEntity("name", message="Ce nom de groupe existe dèja") */ class Group { @@ -38,15 +40,9 @@ class Group */ protected $users; - /** - * @ORM\OneToMany(targetEntity="Activity", mappedBy="group", cascade={"persist"}, orphanRemoval=true) - */ - private $activitys; - public function __construct() { $this->users = new ArrayCollection(); - $this->activitys = new ArrayCollection(); } public function getId(): ?int @@ -106,37 +102,4 @@ class Group return $this; } - /** - * @return Collection|Activity[] - */ - public function getActivitys(): Collection - { - return $this->activitys; - } - - public function addActivity(Activity $activity): self - { - if (!$this->activitys->contains($activity)) { - $this->activitys[] = $activity; - $activity->setGroup($this); - } - - return $this; - } - - public function removeActivity(Activity $activity): self - { - if ($this->activitys->contains($activity)) { - $this->activitys->removeElement($activity); - // set the owning side to null (unless already changed) - if ($activity->getGroup() === $this) { - $activity->setGroup(null); - } - } - - return $this; - } - - - } \ No newline at end of file diff --git a/src/nineskeletor-1.0/src/Entity/Message.php b/src/nineskeletor-1.0/src/Entity/Message.php deleted file mode 100644 index 1a0577f..0000000 --- a/src/nineskeletor-1.0/src/Entity/Message.php +++ /dev/null @@ -1,156 +0,0 @@ -submitdate = new \DateTime(); - $this->readers = new ArrayCollection(); - } - - public function getId(): ?int - { - return $this->id; - } - - public function getMessage(): ?string - { - return $this->message; - } - - public function setMessage(string $message): self - { - $this->message = $message; - - return $this; - } - - public function getSubmitdate(): ?\DateTimeInterface - { - return $this->submitdate; - } - - public function setSubmitdate(\DateTimeInterface $submitdate): self - { - $this->submitdate = $submitdate; - - return $this; - } - - public function getDeletable(): ?bool - { - return $this->deletable; - } - - public function setDeletable(bool $deletable): self - { - $this->deletable = $deletable; - - return $this; - } - - public function getAnswer(): ?Answer - { - return $this->answer; - } - - public function setAnswer(?Answer $answer): self - { - $this->answer = $answer; - - return $this; - } - - public function getUser(): ?User - { - return $this->user; - } - - public function setUser(?User $user): self - { - $this->user = $user; - - return $this; - } - - /** - * @return Collection|User[] - */ - public function getReaders(): Collection - { - return $this->readers; - } - - public function addReader(User $reader): self - { - if (!$this->readers->contains($reader)) { - $this->readers[] = $reader; - } - - return $this; - } - - public function removeReader(User $reader): self - { - if ($this->readers->contains($reader)) { - $this->readers->removeElement($reader); - } - - return $this; - } - -} diff --git a/src/nineskeletor-1.0/src/Entity/User.php b/src/nineskeletor-1.0/src/Entity/User.php index 2cac5ca..623feed 100644 --- a/src/nineskeletor-1.0/src/Entity/User.php +++ b/src/nineskeletor-1.0/src/Entity/User.php @@ -13,7 +13,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * User * * @ORM\Entity(repositoryClass="App\Repository\UserRepository") - * @ORM\Table(name="user",indexes={@ORM\Index(name="username", columns={"username"})}) + * @ORM\Table(name="user",uniqueConstraints={@ORM\UniqueConstraint(name="username", columns={"username"})}) * @UniqueEntity("username", message="Ce nom d'utilisateur existe dèja") */ @@ -90,34 +90,10 @@ class User implements UserInterface, \Serializable */ private $groups; - /** - * @ORM\OneToMany(targetEntity="Activity", mappedBy="user", cascade={"persist"}, orphanRemoval=true) - */ - private $activitys; - - /** - * @ORM\OneToMany(targetEntity="Answer", mappedBy="user", cascade={"persist"}, orphanRemoval=true) - */ - private $answers; - - /** - * @ORM\OneToMany(targetEntity="Message", mappedBy="user", cascade={"persist"}, orphanRemoval=true) - */ - private $messages; - - /** - * @ORM\ManyToMany(targetEntity="Message", mappedBy="readers") - */ - protected $messagereaders; public function __construct() { $this->groups = new ArrayCollection(); - $this->activitys = new ArrayCollection(); - $this->anwsers = new ArrayCollection(); - $this->answers = new ArrayCollection(); - $this->messages = new ArrayCollection(); - $this->messagereaders = new ArrayCollection(); } public function getUsername(): ?string @@ -310,125 +286,4 @@ class User implements UserInterface, \Serializable return $this; } - /** - * @return Collection|Activity[] - */ - public function getActivitys(): Collection - { - return $this->activitys; - } - - public function addActivity(Activity $activity): self - { - if (!$this->activitys->contains($activity)) { - $this->activitys[] = $activity; - $activity->setUser($this); - } - - return $this; - } - - public function removeActivity(Activity $activity): self - { - if ($this->activitys->contains($activity)) { - $this->activitys->removeElement($activity); - // set the owning side to null (unless already changed) - if ($activity->getUser() === $this) { - $activity->setUser(null); - } - } - - return $this; - } - - /** - * @return Collection|Answer[] - */ - public function getAnswers(): Collection - { - return $this->answers; - } - - public function addAnswer(Answer $answer): self - { - if (!$this->answers->contains($answer)) { - $this->answers[] = $answer; - $answer->setUser($this); - } - - return $this; - } - - public function removeAnswer(Answer $answer): self - { - if ($this->answers->contains($answer)) { - $this->answers->removeElement($answer); - // set the owning side to null (unless already changed) - if ($answer->getUser() === $this) { - $answer->setUser(null); - } - } - - return $this; - } - - /** - * @return Collection|Message[] - */ - public function getMessages(): Collection - { - return $this->messages; - } - - public function addMessage(Message $message): self - { - if (!$this->messages->contains($message)) { - $this->messages[] = $message; - $message->setUser($this); - } - - return $this; - } - - public function removeMessage(Message $message): self - { - if ($this->messages->contains($message)) { - $this->messages->removeElement($message); - // set the owning side to null (unless already changed) - if ($message->getUser() === $this) { - $message->setUser(null); - } - } - - return $this; - } - - /** - * @return Collection|Message[] - */ - public function getMessagereaders(): Collection - { - return $this->messagereaders; - } - - public function addMessagereader(Message $messagereader): self - { - if (!$this->messagereaders->contains($messagereader)) { - $this->messagereaders[] = $messagereader; - $messagereader->addReader($this); - } - - return $this; - } - - public function removeMessagereader(Message $messagereader): self - { - if ($this->messagereaders->contains($messagereader)) { - $this->messagereaders->removeElement($messagereader); - $messagereader->removeReader($this); - } - - return $this; - } - } diff --git a/src/nineskeletor-1.0/src/Repository/ActivityRepository.php b/src/nineskeletor-1.0/src/Repository/ActivityRepository.php deleted file mode 100644 index 11afe54..0000000 --- a/src/nineskeletor-1.0/src/Repository/ActivityRepository.php +++ /dev/null @@ -1,42 +0,0 @@ -createQueryBuilder('activity') - ->Where('activity.user=:user') - ->setParameter('user',$user); - - if($activeactivity) - $qb->andWhere('activity.status<10'); - else - $qb->andWhere('activity.status=10'); - - return $qb->getQuery()->getResult(); - } - - public function findAllGroupActivityActive($group,$activeactivity) { - $qb = $this->createQueryBuilder('activity') - ->Where('activity.group=:group') - ->setParameter('group',$group); - - if($activeactivity) - $qb->andWhere('activity.status=1'); - else - $qb->andWhere('activity.status=10'); - - return $qb->getQuery()->getResult(); - } - -} diff --git a/src/nineskeletor-1.0/src/Repository/AnswerRepository.php b/src/nineskeletor-1.0/src/Repository/AnswerRepository.php deleted file mode 100644 index 16d7f1a..0000000 --- a/src/nineskeletor-1.0/src/Repository/AnswerRepository.php +++ /dev/null @@ -1,15 +0,0 @@ - - {% if mode=="update" %} - Modification ACTIVITE - {% elseif mode=="submit" %} - Création ACTIVITE - {% endif %} - - - {{ form_widget(form.submit) }} - - Annuler - - {% if mode=="update" %} - {% if activity.status==0 or activity.status==10%} - - Supprimer - - {% else %} - {{ form_widget(form.archiving) }} - {% endif %} - - {% if form.distribution is defined %} - {{ form_widget(form.distribution) }} - {% endif %} - - {% endif %} - -

- - {% if app.session.flashbag.has('error') %} -
- Erreur
- {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage | raw }}
- {% endfor %} -
- {% endif %} - - {% if app.session.flashbag.has('notice') %} -
- Information
- {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - -

Entête

-
-
-
-
- Informations -
- -
- {{ form_row(form.name) }} - {{ form_row(form.subject) }} - {{ form_row(form.group) }} -
-
-
-
- -
-

Enoncés

-
-
- {% if mode == "submit" %} -
-
- Pièces Jointes -
- -
- Vous pourrez rattacher des pièces jointes une fois l'activité créée. -
-
- {% else %} -
-
- Pièces Jointes - {% if activity.status == 0 %} - - - {% endif %} -
- -
-
-
- - {% endif %} - -
- -
-
-
- Description -
- -
- {{ form_widget(form.activity) }} -
-
-
-
- - -
-

Corrigés

-
-
- {% if mode == "submit" %} -
-
- Pièces Jointes -
- -
- Vous pourrez rattacher des pièces jointes une fois l'activité créée. -
-
- {% else %} -
-
- Pièces Jointes - {% if activity.status < 10 %} - - - {% endif %} -
- -
-
-
- - {% endif %} - -
- -
-
-
- Description -
- -
- {{ form_widget(form.corrected) }} -
-
-
-
- -{{ form_end(form) }} - - -{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - loadDocument(); - $("#activity_name").focus(); - }); - - {% if mode != "submit" %} - function myupload(entity) { - url='{{ path('app_document_upload',{'entity': 'xxxxx', 'id':activity.id }) }}'; - url=url.replace('xxxxx',entity); - ModalLoad('mymodal','Pièces Jointes',url); - } - - function myrecord(entity) { - url='{{ path('app_document_record',{'entity': 'xxxxx', 'id':activity.id }) }}'; - url=url.replace('xxxxx',entity); - ModalLoad('mymodal','Enregistrement',url); - } - - function myviewer(entity,id) { - url='{{ path('app_document_view',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - ModalLoad('mymodal','Pièce Jointe',url); - } - - function mydownload(entity,id) { - url='{{ path('app_document_show',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - document.location=url; - } - - function myedit(entity,id) { - url='{{ path('app_document_update',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - ModalLoad('mymodal','Pièce Jointe',url); - } - - $('#mymodal').on('hidden.bs.modal', function (e) { - loadDocument(); - }); - - - - function loadDocument() { - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listmaster',{entity:'activity',id:activity.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#activitydocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#activitydocuments").append(doc.html); - } - } - } - }); - - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listmaster',{entity:'corrected',id:activity.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#correcteddocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#correcteddocuments").append(doc.html); - } - } - } - }); - } - {%endif%} - -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Activity/list.html.twig b/src/nineskeletor-1.0/templates/Activity/list.html.twig deleted file mode 100644 index 2785f37..0000000 --- a/src/nineskeletor-1.0/templates/Activity/list.html.twig +++ /dev/null @@ -1,125 +0,0 @@ -{% extends "base.html.twig" %} - -{% block body %} -

-ACTIVITES -

- -

Ajouter

- -
-
- Liste des Activités -
- - -
-
- -
-
- - - - - - - - - - - - {% for activity in activitys %} - - - - - - - - {% endfor %} - -
ActionNomStatutGroupeElèves
- - - {{activity.name}} - {% if activity.status == 0 %} - brouillon - {% elseif activity.status == 1 %} - distribué - {% else %} - clos - {% endif %} - {{activity.group.name}} - {% set answerusers = [] %} - - {% for answer in activity.answers %} - {% set answerusers = answerusers|merge([answer.user.id]) %} - - 0 - {{ answer.user.displayname }} = - - -
- {% endfor %} - - {% if activity.status > 0 %} - {% for user in activity.group.users %} - {% if user.id not in answerusers and "ROLE_STUDENT" in user.roles %} - 0{{ user.displayname }} = non vu
- {% endif %} - {% endfor %} - {% endif %} -
-
-
-
-{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $('#dataTables').DataTable({ - columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], - responsive: true, - iDisplayLength: 100, - order: [[ 1, "asc" ]] - }); - - myloadMessage(); - }); - - function myloadMessage() { - $.ajax({ - type: "POST", - url: "{{ path("app_message_unread") }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - $(".badge").removeClass("badge-danger").removeClass("badge-success").addClass("badge-success"); - - for (answer of response) { - $("#badge"+answer.id).html(answer.cpt); - if(answer.cpt>0) $("#badge"+answer.id).removeClass("badge-success").addClass("badge-danger"); - $("#status"+answer.id).html(answer.status); - } - } - } - }); - } - - function mymessage(id) { - url='{{ path('app_message_group',{'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - - ModalLoad('mymodal','Message aux Elèves',url); - } - - $('#switchactive').change(function() { - window.location="{{ path('app_activity_activeactivity' )}}"; - }); - - window.setInterval(myloadMessage, 5000); -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Answer/edit.html.twig b/src/nineskeletor-1.0/templates/Answer/edit.html.twig deleted file mode 100755 index d05f8dc..0000000 --- a/src/nineskeletor-1.0/templates/Answer/edit.html.twig +++ /dev/null @@ -1,301 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -
-
-

- ACTIVITE = {{ answer.activity.name }} -

- - {{ form_widget(form.submit) }} - - Annuler - - {% if mode=="update" %} - {% if answer.status<10 and answer.activity.status==1%} - {{ form_widget(form.returned) }} - {% endif %} - {% endif %} - -

- - {% if app.session.flashbag.has('error') %} -
- Erreur
- {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if app.session.flashbag.has('notice') %} -
- Information
- {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if answer.status == 15 %} -
-
-

Corrigé

-
-
-
-
- Appréciation -
- -
- {{ answer.answercorrected | raw }} -
-
- - {% if answer.activity.corrected %} -
-
-
- Corrigé -
- -
- {{ answer.activity.corrected | raw }} -
-
- {% endif %} -
- -
-
-
- Pièces Jointes de l'Appréciation -
- -
-
-
- - {% if answer.activity.correcteddocuments %} -
-
-
- Pièces Jointes de la Correction -
- -
-
-
- {% endif %} -
-
-
- {% endif %} - -
-
-

Enoncés

-
-
- Informations -
- -
- Titre = {{ answer.activity.name}}
- Matière = {{ answer.activity.subject}}
- -
- {{ answer.activity.activity|raw}} -
-
- -
-
-
- Pièces Jointes -
- -
-
-
- -
- -
-

Activité

-
-
- Description -
- -
- {{ form_widget(form.answer) }} -
-
- -
-
-
- Pièces Jointes - {% if answer.status < 10 and answer.activity.status == 1 %} - - - {% endif %} -
- -
-
-
-
-
-
- -
-

Messages

- {{ render_esi(controller('App\\Controller\\MessageController::message', { 'id': answer.id })) }} -
-
-{{ form_end(form) }} - - -{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - loadDocument(); - $("#anwser_anwser").focus(); - }); - - {% if mode != "submit" %} - function myupload(entity) { - url='{{ path('app_document_upload',{'entity': 'xxxxx', 'id':answer.id }) }}'; - url=url.replace('xxxxx',entity); - ModalLoad('mymodal','Pièces Jointes',url); - } - - function myrecord(entity) { - url='{{ path('app_document_record',{'entity': 'xxxxx', 'id':answer.id }) }}'; - url=url.replace('xxxxx',entity); - ModalLoad('mymodal','Enregistrement',url); - } - - function myviewer(entity,id) { - url='{{ path('app_document_view',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - ModalLoad('mymodal','Pièce Jointe',url); - } - - function mydownload(entity,id) { - url='{{ path('app_document_show',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - document.location=url; - } - - function myedit(entity,id) { - url='{{ path('app_document_update',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - ModalLoad('mymodal','Pièce Jointe',url); - } - - $('#mymodal').on('hidden.bs.modal', function (e) { - loadDocument(); - }); - - - - function loadDocument() { - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listuser',{entity:'activity',id:answer.activity.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#activitydocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#activitydocuments").append(doc.html); - } - } - } - }); - - $.ajax({ - type: "POST", - url: "{{ path('app_document_listmaster',{entity:'answer',id:answer.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#answerdocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#answerdocuments").append(doc.html); - } - } - } - }); - - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listuser',{entity:'corrected',id:answer.activity.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#correcteddocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#correcteddocuments").append(doc.html); - } - } - } - }); - - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listuser',{entity:'answercorrected',id:answer.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#answercorrecteddocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#answercorrecteddocuments").append(doc.html); - } - } - } - }); - - } - {%endif%} - -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Answer/list.html.twig b/src/nineskeletor-1.0/templates/Answer/list.html.twig deleted file mode 100644 index 6120c76..0000000 --- a/src/nineskeletor-1.0/templates/Answer/list.html.twig +++ /dev/null @@ -1,104 +0,0 @@ -{% extends "base.html.twig" %} - -{% block body %} -

-ACTIVITES -

- -
-
- Liste des Activités -
- - -
-
- -
-
- - - - - - - - - - - - - {% for activity in activitys %} - - - - - - - - - {% endfor %} - -
ActionNomProfesseurMatièreStatut
- - 0{{activity.name}}{{activity.user.displayname}}{{activity.subject}} - - {% if activity.answeruser.status == 0 %} - vu - {% elseif activity.answeruser.status == 1 %} - en cours - {% elseif activity.answeruser.status == 2 %} - réouvert - {% elseif activity.answeruser.status == 10 %} - rendu - {% elseif activity.answeruser.status == 15 %} - corrigé - {% endif %} - -
-
-
-
-{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $('#dataTables').DataTable({ - columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], - responsive: true, - iDisplayLength: 100, - order: [[ 1, "asc" ]] - }); - - myloadMessage(); - }); - - function myloadMessage() { - $.ajax({ - type: "POST", - url: "{{ path("app_message_unread") }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - $(".badge").removeClass("badge-danger").removeClass("badge-success").addClass("badge-success"); - - for (answer of response) { - $("#badge"+answer.id).html(answer.cpt); - if(answer.cpt>0) $("#badge"+answer.id).removeClass("badge-success").addClass("badge-danger"); - $("#status"+answer.id).html(answer.status); - } - } - } - }); - } - - $('#switchactive').change(function() { - window.location="{{ path('app_activity_activeactivity' )}}"; - }); - - window.setInterval(myloadMessage, 5000); - -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Answer/view.html.twig b/src/nineskeletor-1.0/templates/Answer/view.html.twig deleted file mode 100755 index b0f8809..0000000 --- a/src/nineskeletor-1.0/templates/Answer/view.html.twig +++ /dev/null @@ -1,304 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -
-
-

- ACTIVITE = {{ answer.activity.name }} = {{ answer.user.displayname }} -

- - {{ form_widget(form.submit) }} - - Annuler - - {% if mode=="update" %} - {% if answer.status>=10 and answer.status<15 and answer.activity.status==1 %} - {{ form_widget(form.corrected) }} - {{ form_widget(form.canceled) }} - {% endif %} - {% endif %} - -

- - {% if app.session.flashbag.has('error') %} -
- Erreur
- {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if app.session.flashbag.has('notice') %} -
- Information
- {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if form.answercorrected is defined %} -
-
-

Corrigé

-
-
-
-
- Appréciation -
- -
- {{ form_widget(form.answercorrected) }} -
-
- - {% if answer.activity.corrected %} -
-
-
- Corrigé -
- -
- {{ answer.activity.corrected | raw }} -
-
- {% endif %} -
- -
-
-
- Pièces Jointes de l'Appréciation - {% if answer.status>=10 and answer.status<15 and answer.activity.status==1 %} - - - {% endif %} -
- -
-
-
- - {% if answer.activity.correcteddocuments %} -
-
-
- Pièces Jointes de la Correction -
- -
-
-
- {% endif %} -
-
-
- {% endif %} - -
-
-

Enoncés

-
-
- Informations -
- -
- Titre = {{ answer.activity.name}}
- {% if answer.activity.subject %} - Matière = {{ answer.activity.subject}}
- {% endif %} - -
- {{ answer.activity.activity|raw}} -
-
- -
-
-
- Pièces Jointes -
- -
-
-
- -
- -
-

Activité

-
-
- Description -
- -
- {{ answer.answer|raw}} -
-
- -
-
-
- Pièces Jointes -
- -
-
-
-
-
-
- -
-

Messages

- {{ render_esi(controller('App\\Controller\\MessageController::message', { 'id': answer.id })) }} -
-
-{{ form_end(form) }} - - -{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - loadDocument(); - $("#anwser_anwser").focus(); - }); - - {% if mode != "submit" %} - function myupload(entity) { - url='{{ path('app_document_upload',{'entity': 'xxxxx', 'id':answer.id }) }}'; - url=url.replace('xxxxx',entity); - ModalLoad('mymodal','Pièces Jointes',url); - } - - function myrecord(entity) { - url='{{ path('app_document_record',{'entity': 'xxxxx', 'id':answer.id }) }}'; - url=url.replace('xxxxx',entity); - ModalLoad('mymodal','Enregistrement',url); - } - - function myviewer(entity,id) { - url='{{ path('app_document_view',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - ModalLoad('mymodal','Pièce Jointe',url); - } - - function mydownload(entity,id) { - url='{{ path('app_document_show',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - document.location=url; - } - - function myedit(entity,id) { - url='{{ path('app_document_update',{'entity': 'yyyyy', 'id':'xxxxx' }) }}'; - url=url.replace('xxxxx',id); - url=url.replace('yyyyy',entity); - - ModalLoad('mymodal','Pièce Jointe',url); - } - - $('#mymodal').on('hidden.bs.modal', function (e) { - loadDocument(); - }); - - - - function loadDocument() { - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listuser',{entity:'activity',id:answer.activity.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#activitydocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#activitydocuments").append(doc.html); - } - } - } - }); - - $.ajax({ - type: "POST", - url: "{{ path('app_document_listuser',{entity:'answer',id:answer.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#answerdocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#answerdocuments").append(doc.html); - } - } - } - }); - - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listuser',{entity:'corrected',id:answer.activity.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#correcteddocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#correcteddocuments").append(doc.html); - } - } - } - }); - - // Sur fermeture de la modal on recharge les PJ - $.ajax({ - type: "POST", - url: "{{ path('app_document_listmaster',{entity:'answercorrected',id:answer.id}) }}", - success: function (response) { - response=JSON.parse(response); - if(response.return=="KO") { - alert(response.error); - } - else { - // On vide le conteneur document - $("#answercorrecteddocuments").empty(); - - // On reconstruit la liste - for (doc of response) { - $("#answercorrecteddocuments").append(doc.html); - } - } - } - }); - - } - {%endif%} - -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Cron/edit.html.twig b/src/nineskeletor-1.0/templates/Cron/edit.html.twig deleted file mode 100644 index 91b6c8f..0000000 --- a/src/nineskeletor-1.0/templates/Cron/edit.html.twig +++ /dev/null @@ -1,59 +0,0 @@ - -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

- {% if mode=="update" %} - Modification JOB - {% endif %} -

- - {{ form_widget(form.submit) }} - - Annuler - -

- - {% if app.session.flashbag.has('error') %} -
- Erreur
- {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if app.session.flashbag.has('notice') %} -
- Information
- {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} -
-
- Informations -
- -
- {{ form_row(form.command) }} - {{ form_row(form.jsonargument) }} - {{ form_row(form.statut) }} - {{ form_row(form.repeatcall) }} - {{ form_row(form.repeatinterval) }} - {{ form_row(form.nextexecdate) }} -
-
-{{ form_end(form) }} -{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $("#command").focus(); - }); -{% endblock %} - - - diff --git a/src/nineskeletor-1.0/templates/Cron/list.html.twig b/src/nineskeletor-1.0/templates/Cron/list.html.twig deleted file mode 100644 index dde3511..0000000 --- a/src/nineskeletor-1.0/templates/Cron/list.html.twig +++ /dev/null @@ -1,56 +0,0 @@ -{% extends "base.html.twig" %} - -{% block body %} -

-JOBS -

- -
-
- Liste des Jobs -
- -
-
- - - - - - - - - - - - - {% for cron in crons %} - - - - - - - - - {% endfor %} - -
ActionOrderCommandDescriptionStatutProchaine exécution
- - {{cron.id}}{{cron.command}}{{cron.description}}{{cron.statutlabel}}{{cron.nextexecdate|date("d/m/Y H:i")}}
-
-
-
-{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $('#dataTables').DataTable({ - columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], - responsive: true, - iDisplayLength: 100, - order: [[ 1, "asc" ]] - }); - }); -{% endblock %} - diff --git a/src/nineskeletor-1.0/templates/Cron/logs.html.twig b/src/nineskeletor-1.0/templates/Cron/logs.html.twig deleted file mode 100644 index 0988633..0000000 --- a/src/nineskeletor-1.0/templates/Cron/logs.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "CRWhizBundle::base.html.twig" %} - -{% block body %} -

{{ title }}

- - Log CRON - Log PROD - Log DEV -

-
-
- Logs -
- -
- {{ content | nl2br }} -
-
-{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Crop/crop01.html.twig b/src/nineskeletor-1.0/templates/Crop/crop01.html.twig deleted file mode 100644 index da5966e..0000000 --- a/src/nineskeletor-1.0/templates/Crop/crop01.html.twig +++ /dev/null @@ -1,35 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block head_style %} - {{ encore_entry_link_tags('app') }} - {{ encore_entry_link_tags('dropzone') }} -{% endblock head_style %} - - -{% block body %} - - - -
- - {{ encore_entry_script_tags('dropzone') }} -{% endblock %} - - - -{% block localjavascript %} - window.parent.$(".modal-title").html("ETAPE 1 - Téléchargez votre image"); - - Dropzone.options.MyDropZone = { - maxFiles: 1, - acceptedMimeTypes: 'image/*', - //renameFilename: false, - success: function(file, response){ - $(location).attr('href',"{{ path('app_crop02') }}"); - } - } - - function closeModal() { - window.parent.$("#extraLargeModal").modal('hide'); - } -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Crop/crop02.html.twig b/src/nineskeletor-1.0/templates/Crop/crop02.html.twig deleted file mode 100644 index ada9256..0000000 --- a/src/nineskeletor-1.0/templates/Crop/crop02.html.twig +++ /dev/null @@ -1,71 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} - {{ form_start(form) }} - {{ form_widget(form.submit) }} - - -
- Thumbnail Preview -
- -
-
-
-
- {{ form_end(form) }} - -{% endblock %} - - -{% block localjavascript %} - function move(data) { - $('#form_x').val(data.xScaledToImage); - $('#form_y').val(data.yScaledToImage); - - preview(); - } - - function resize(data) { - $('#form_w').val(data.widthScaledToImage); - $('#form_h').val(data.heightScaledToImage); - - preview(); - } - - function preview(data) { - var scaleX = 90 / $('#form_w').val(); - var scaleY = 90 / $('#form_h').val(); - - $('#preview img').css({ - width: Math.round(scaleX * $('#largeimg').width()) + 'px', - height: Math.round(scaleY * $('#largeimg').height()) + 'px', - marginLeft: '-' + Math.round(scaleX * $('#form_x').val()) + 'px', - marginTop: '-' + Math.round(scaleY * $('#form_y').val()) + 'px' - }); - - } - - function reportThumb() { - window.parent.$("#user_avatar").val("thumb_{{ app.session.get('uploadavatar') }}"); - window.parent.$("#user_avatar_img").attr("src","/{{ appAlias }}/uploads/avatar/thumb_{{ app.session.get('uploadavatar') }}"); - closeModal(); - } - - function closeModal() { - window.parent.$("#extraLargeModal").modal('hide'); - } - - $(document).ready(function() { - window.parent.$(".modal-title").html("ETAPE 2 - Découper votre image"); - - $('#largeimg').CropSelectJs({ - imageSrc: "/{{ appAlias }}/uploads/avatar/{{ app.session.get('uploadavatar') }}", - selectionResize: function(data) { resize(data); }, - selectionMove: function(data) { move(data); }, - }); - $('#largeimg').CropSelectJs('setSelectionAspectRatio',1); - - - }); -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Document/close.html.twig b/src/nineskeletor-1.0/templates/Document/close.html.twig deleted file mode 100755 index 6a7cb25..0000000 --- a/src/nineskeletor-1.0/templates/Document/close.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} - -{% endblock %} - diff --git a/src/nineskeletor-1.0/templates/Document/edit.html.twig b/src/nineskeletor-1.0/templates/Document/edit.html.twig deleted file mode 100755 index fa7d237..0000000 --- a/src/nineskeletor-1.0/templates/Document/edit.html.twig +++ /dev/null @@ -1,52 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} - {{ form_widget(form.submit) }} - - - - {% if mode=="update" %} - - Supprimer - - {% endif %} - -

- - {% if app.session.flashbag.has('error') %} -
- Erreur
- {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if app.session.flashbag.has('notice') %} -
- Information
- {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {{ form_row(form.name) }} - {{ form_row(form.description) }} -{{ form_end(form) }} - -{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $("#document_name").focus(); - }); - - function closeModal() { - window.parent.$("#mymodal").modal('hide'); - } -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Document/record.html.twig b/src/nineskeletor-1.0/templates/Document/record.html.twig deleted file mode 100644 index ee35250..0000000 --- a/src/nineskeletor-1.0/templates/Document/record.html.twig +++ /dev/null @@ -1,302 +0,0 @@ -{% extends "base.html.twig" %} - -{% block localstyle %} - .main-controls { - padding: 0.5rem 0; - } - - canvas { - display: block; - margin-bottom: 0.5rem; - } - - #buttons button { - font-size: 1rem; - padding: 1rem; - width: 100%; - } - - #buttons i { - margin-right: 5px; - } - - - - /* Make the clips use as much space as possible, and also show a scrollbar when there are too many clips to show in the available space */ - .sound-clips { - flex: 1; - overflow: auto; - } - - section, article { - display: block; - } - - .clip { - padding-bottom: 1rem; - } - - audio { - width: 100%; - display: block; - margin: 1rem auto 0.5rem; - } - - .clip p { - display: inline-block; - font-size: 1rem; - } - - .clip button { - font-size: 1rem; - float: right; - } - - - aside { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - transform: translateX(100%); - transition: 0.3s all ease-out; - background-color: #efefef; - padding: 1rem; - } - - aside p { - font-size: 1.2rem; - margin: 0.5rem 0; - } - - aside a { - color: #666; - } - - /* Toggled State of information box */ - input[type=checkbox]:checked ~ aside { - transform: translateX(0); - } - - /* Cursor when clip name is clicked over */ - .clip p { - cursor: pointer; - } - -{% endblock %} - -{% block body %} -
- -
- - -
-
- -
- - -
- -{% endblock %} - -{% block localjavascript %} - // set up basic variables for app - const record = document.querySelector('.record'); - const stop = document.querySelector('.stop'); - const soundClips = document.querySelector('.sound-clips'); - const canvas = document.querySelector('.visualizer'); - const mainSection = document.querySelector('.main-controls'); - - // disable stop button while not recording - $('.stop').hide(); - - // visualiser setup - create web audio api context and canvas - let audioCtx; - const canvasCtx = canvas.getContext("2d"); - - //main block for doing the audio recording - if (navigator.mediaDevices.getUserMedia) { - console.log('getUserMedia supported.'); - - const constraints = { audio: true }; - let chunks = []; - - let onSuccess = function(stream) { - const mediaRecorder = new MediaRecorder(stream); - - visualize(stream); - - record.onclick = function() { - mediaRecorder.start(); - console.log(mediaRecorder.state); - console.log("recorder started"); - record.style.background = "red"; - - $(".stop").show(); - $(".record").hide(); - } - - stop.onclick = function() { - mediaRecorder.stop(); - console.log(mediaRecorder.state); - console.log("recorder stopped"); - record.style.background = ""; - record.style.color = ""; - - $(".stop").hide(); - $(".record").show(); - } - - mediaRecorder.onstop = function(e) { - console.log("data available after MediaRecorder.stop() called."); - - const clipName = prompt("Nom de l'enregistrement ?",'Activite'); - - const clipContainer = document.createElement('article'); - const clipLabel = document.createElement('p'); - const audio = document.createElement('audio'); - const deleteButton = document.createElement('button'); - const addButton = document.createElement('button'); - - clipContainer.classList.add('clip'); - audio.setAttribute('controls', ''); - deleteButton.textContent = 'Supprimer'; - deleteButton.className = 'delete btn btn-danger'; - addButton.textContent = "Ajouter à l'Activité"; - addButton.className = 'add btn btn-success mr-2'; - - if(clipName === null) { - clipLabel.textContent = 'My unnamed clip'; - } else { - clipLabel.textContent = clipName; - } - - clipContainer.appendChild(audio); - clipContainer.appendChild(clipLabel); - clipContainer.appendChild(deleteButton); - clipContainer.appendChild(addButton); - soundClips.appendChild(clipContainer); - - audio.controls = true; - const blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); - chunks = []; - const audioURL = window.URL.createObjectURL(blob); - audio.src = audioURL; - console.log("recorder stopped"); - - deleteButton.onclick = function(e) { - let evtTgt = e.target; - evtTgt.parentNode.parentNode.removeChild(evtTgt.parentNode); - } - - addButton.onclick = function(e) { - url='{{ path('app_document_recordupload',{entity:entity,id:id,name:'xxxxx'})}}'; - url=url.replace('xxxxx',clipName); - - fetch(url, { - method: 'POST', - body: blob, - }) - .then(response => response.json()) - .then(result => { - let evtTgt = e.target; - evtTgt.parentNode.parentNode.removeChild(evtTgt.parentNode); - }) - .catch(error => { - console.error('Error:', error); - }); - } - - clipLabel.onclick = function() { - const existingName = clipLabel.textContent; - const newClipName = prompt("Nom de l'enregistrement ?",existingName); - - if(newClipName === null) { - clipLabel.textContent = existingName; - } else { - clipLabel.textContent = newClipName; - } - } - } - - mediaRecorder.ondataavailable = function(e) { - chunks.push(e.data); - } - } - - let onError = function(err) { - console.log('The following error occured: ' + err); - } - - navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError); - } - else { - console.log('getUserMedia not supported on your browser!'); - } - - function visualize(stream) { - if(!audioCtx) { - audioCtx = new AudioContext(); - } - - const source = audioCtx.createMediaStreamSource(stream); - - const analyser = audioCtx.createAnalyser(); - analyser.fftSize = 2048; - const bufferLength = analyser.frequencyBinCount; - const dataArray = new Uint8Array(bufferLength); - - source.connect(analyser); - - draw() - - function draw() { - const WIDTH = canvas.width - const HEIGHT = canvas.height; - - requestAnimationFrame(draw); - - analyser.getByteTimeDomainData(dataArray); - - canvasCtx.fillStyle = 'rgb(200, 200, 200)'; - canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); - - canvasCtx.lineWidth = 2; - canvasCtx.strokeStyle = 'rgb(0, 0, 0)'; - - canvasCtx.beginPath(); - - let sliceWidth = WIDTH * 1.0 / bufferLength; - let x = 0; - - - for(let i = 0; i < bufferLength; i++) { - let v = dataArray[i] / 128.0; - let y = v * HEIGHT/2; - - if(i === 0) { - canvasCtx.moveTo(x, y); - } - else { - canvasCtx.lineTo(x, y); - } - - x += sliceWidth; - } - - canvasCtx.lineTo(canvas.width, canvas.height/2); - canvasCtx.stroke(); - - } - } - - window.onresize = function() { - canvas.width = mainSection.offsetWidth; - } - - window.onresize(); - -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Document/render.html.twig b/src/nineskeletor-1.0/templates/Document/render.html.twig deleted file mode 100644 index 710cafa..0000000 --- a/src/nineskeletor-1.0/templates/Document/render.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -
- -
-
{{title}}
- - {% if minefamily=="image" or minefamily=="image" or minefamily=="video" or extention=="pdf" %} - - {% endif %} - - - - {% if master %} - - {% endif %} - - {{ description|raw }} -
-
\ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Document/upload.html.twig b/src/nineskeletor-1.0/templates/Document/upload.html.twig deleted file mode 100644 index a250bef..0000000 --- a/src/nineskeletor-1.0/templates/Document/upload.html.twig +++ /dev/null @@ -1,52 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block head_style %} - {{ encore_entry_link_tags('app') }} - {{ encore_entry_link_tags('dropzone') }} -{% endblock head_style %} - - -{% block body %} - - - - - {{ encore_entry_script_tags('dropzone') }} -{% endblock %} - - - -{% block localjavascript %} - Dropzone.options.MyDropZone = { - init: function() { - var totalFiles = 0; - var completeFiles = 0; - - this.on("sending", function(file, xhr, formData) { - formData.append("nameentity", "{{ entity }}"); - formData.append("identity", "{{ id }}"); - }); - - this.on("addedfile", function (file) { - totalFiles += 1; - }); - - this.on("removed file", function (file) { - totalFiles -= 1; - }); - - this.on("complete", function (file) { - completeFiles += 1; - if (completeFiles === totalFiles) { - window.parent.$("#mymodal").modal('hide'); - } - }); - }, - success: function( file, response ){ - } - } - - function closeModal() { - window.parent.$("#mymodal").modal('hide'); - } -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Document/view.html.twig b/src/nineskeletor-1.0/templates/Document/view.html.twig deleted file mode 100644 index dd8031a..0000000 --- a/src/nineskeletor-1.0/templates/Document/view.html.twig +++ /dev/null @@ -1,55 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} - {% if minefamily == "image" %} - - {% else %} - - {% endif %} -{% endblock %} - - -{% block localjavascript %} - $(document).ready(function() { - $(window).resize(function() { - AjustFrame(); - }); - - AjustFrame(); - }); - - // Ajustement des frames - function AjustFrame() { - var heightbody = $('html').height(); - var heightheader = $('.nav').height(); - var heightframe = 600; - console.log(heightbody); - var widthbody = $('body').width(); - - if($("#frameviewfile").length>0) { - $("#frameviewfile").height(heightframe); - } - - if($("#image").length>0) { - widthbody=widthbody-250; - if(widthbody<950) widthbody="100%"; - - console.log("euhe"+widthbody); - //$("#image").css({}); - $("#image").css("height","auto"); - $("#image").css("max-width",widthbody); - if($("#image").height()>heightframe) { - $("#image").css({height:heightframe}); - - - } - - } - } -{% endblock %} - - - - diff --git a/src/nineskeletor-1.0/templates/Form/fields.html.twig b/src/nineskeletor-1.0/templates/Form/fields.html.twig deleted file mode 100644 index 03835d7..0000000 --- a/src/nineskeletor-1.0/templates/Form/fields.html.twig +++ /dev/null @@ -1,175 +0,0 @@ -{% extends 'form_div_layout.html.twig' %} - -{# Voir https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig #} - -{# On commence par simplement ajouter le form-group au row de nos formulaires #} -{% block form_row -%} - {% set attr = attr|merge({'help': (attr.help|default(true)) }) %} -
- {{- form_label(form) }} - {{- form_widget(form) }} - {{ form_errors(form) }} -
-{%- endblock form_row %} - -{# Puis on modifie très simplement nos input et textarea -les plus importants pour y ajouter le class imposée par Bootstrap 3 #} -{% block textarea_widget %} - {% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %} - {{ parent() }} -{% endblock textarea_widget %} - -{% block form_widget_simple %} - {% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %} - {{ parent() }} -{% endblock form_widget_simple %} - -{% block form_label -%} - {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' control-label')|trim}) %} - {% if 'checkbox' not in block_prefixes %} - {% if label is not same as(false) -%} - {% if not compound -%} - {% set label_attr = label_attr|merge({'for': id}) %} - {%- endif %} - {% if required -%} - {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} - {%- endif %} - {% if label is empty -%} - {% set label = name|humanize %} - {%- endif -%} - - - {{ label|trans({}, translation_domain)|raw }} - {% if required %}*{% endif %} - - {%- endif %} - {% endif %} -{%- endblock form_label %} - -{# et enfin les erreurs #} -{% block form_errors %} - {% if errors|length > 0 %} - {% if attr.help is defined and attr.help %} -

- {% for error in errors %} - {{ error.message }}
- {% endfor %} -

- {% else %} -
- - {% for error in errors %} - {{ error.message|raw }}
- {% endfor %} -
- {% endif %} - {% endif %} -{% endblock form_errors %} - -{# Personnalisation des boutons #} -{% block button_widget -%} - {% if label is empty -%} - {% set label = name|humanize %} - {%- endif -%} - {% set attr = attr|merge({'class': (attr.class|default('') ~ '')|trim}) %} - -{%- endblock button_widget %} - -{# Personnalisation des attributs des boutons #} -{% block button_attributes -%} - {% if type is defined and type == 'submit' -%} - {% set class = 'btn-primary' %} - {% else %} - {% set class = 'btn-default' %} - {%- endif -%} - - {% set attr = attr|merge({'class': (attr.class|default('') ~ ' btn ' ~ class)|trim}) %} - {{ parent() }} -{%- endblock button_attributes %} - - -{# Personnalisation des select #} -{% block choice_widget_collapsed %} - {% set attr = attr|merge({'class': (attr.class|default('') ~ ' form-control')|trim}) %} - {{ parent() }} -{%- endblock choice_widget_collapsed %} - -{% block choice_widget %} - {% if expanded %} - - {% else %} - {{ parent() }} - {% endif %} -{% endblock choice_widget %} - -{% block checkbox_widget %} - -{% endblock checkbox_widget %} - -{% block radio_widget %} -    -{% endblock radio_widget %} - -{# Inline date marcro #} -{% macro date_form_widget(form) %} -
- {{ form_widget(form) }} -
-{% endmacro %} - -{# Inline date #} -{% block date_widget %} - {% if widget == 'single_text' %} - {{ block('form_widget_simple') }} - {% else %} - {% import _self as self %} -
- {{ date_pattern|replace({ - '{{ year }}': self.date_form_widget(form.year), - '{{ month }}': self.date_form_widget(form.month), - '{{ day }}': self.date_form_widget(form.day), - })|raw }} -
- {% endif %} -{% endblock date_widget %} - -{# Inline date_time -{% block time_widget %} - {% if widget == 'single_text' %} - {{ block('form_widget_simple') }} - {% else %} - {% import _self as self %} -
- {{ time_pattern|replace({ - '{{ hour }}': self.date_form_widget(form.hour), - '{{ minute }}': self.date_form_widget(form.minute), - })|raw }} -
- {% endif %} -{% endblock time_widget %} -#} - -{% block file_widget %} - {% set type = type|default('file') %} - -{% endblock file_widget %} diff --git a/src/nineskeletor-1.0/templates/Group/edit.html.twig b/src/nineskeletor-1.0/templates/Group/edit.html.twig deleted file mode 100755 index 92c58a5..0000000 --- a/src/nineskeletor-1.0/templates/Group/edit.html.twig +++ /dev/null @@ -1,64 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

- {% if mode=="update" %} - Modification GROUPE - {% elseif mode=="submit" %} - Création GROUPE - {% endif %} -

- - {{ form_widget(form.submit) }} - - Annuler - - {% if mode=="update" %} - - Supprimer - - {% endif %} - -

- - {% if app.session.flashbag.has('error') %} -
- Erreur
- {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if app.session.flashbag.has('notice') %} -
- Information
- {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - -
-
- Informations -
- -
- {{ form_row(form.name) }} - {{ form_row(form.users) }} -
-
-{{ form_end(form) }} - -{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $("#group_name").focus(); - }); -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Group/list.html.twig b/src/nineskeletor-1.0/templates/Group/list.html.twig deleted file mode 100644 index a643786..0000000 --- a/src/nineskeletor-1.0/templates/Group/list.html.twig +++ /dev/null @@ -1,51 +0,0 @@ -{% extends "base.html.twig" %} - -{% block body %} -

-GROUPES -

- -

Ajouter

- -
-
- Liste des Groupes -
- -
-
- - - - - - - - - {% for group in groups %} - - - - - {% endfor %} - -
ActionNom
- {% if not group.ldapfilter %} - - {% endif %} - {{group.name}}
-
-
-
-{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $('#dataTables').DataTable({ - columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], - responsive: true, - iDisplayLength: 100, - order: [[ 1, "asc" ]] - }); - }); -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Home/admin.html.twig b/src/nineskeletor-1.0/templates/Home/admin.html.twig deleted file mode 100644 index 8352af0..0000000 --- a/src/nineskeletor-1.0/templates/Home/admin.html.twig +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "CRWhizBundle::base.html.twig" %} - -{% block body %} - - - -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Home/home.html.twig b/src/nineskeletor-1.0/templates/Home/home.html.twig deleted file mode 100644 index 643f0d8..0000000 --- a/src/nineskeletor-1.0/templates/Home/home.html.twig +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "base.html.twig" %} - -{% block body %} - -{% endblock %} - diff --git a/src/nineskeletor-1.0/templates/Home/login.html.twig b/src/nineskeletor-1.0/templates/Home/login.html.twig deleted file mode 100755 index 54b9806..0000000 --- a/src/nineskeletor-1.0/templates/Home/login.html.twig +++ /dev/null @@ -1,36 +0,0 @@ -{% extends "base.html.twig" %} - -{% block localstyle %} - body { - background-color: #efefef; - } - .homecard { - padding-top: 20px; - } -{% endblock %} - -{% block body %} -
-
-

{{appName}}

- -
-
- {% if error %} -
{{ error.messageKey|trans(error.messageData, 'security') }}
- {% endif %} - - - - - - - - - - -
-
- -
-{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Home/mail.html.twig b/src/nineskeletor-1.0/templates/Home/mail.html.twig deleted file mode 100644 index a99b325..0000000 --- a/src/nineskeletor-1.0/templates/Home/mail.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% block subject %} - {{ subject }} -{% endblock %} - -{% block body %} -{% autoescape %} -

{{ body|raw }}

-{% endautoescape %} -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/Message/close.html.twig b/src/nineskeletor-1.0/templates/Message/close.html.twig deleted file mode 100755 index 6a7cb25..0000000 --- a/src/nineskeletor-1.0/templates/Message/close.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} - -{% endblock %} - diff --git a/src/nineskeletor-1.0/templates/Message/group.html.twig b/src/nineskeletor-1.0/templates/Message/group.html.twig deleted file mode 100644 index b8d9758..0000000 --- a/src/nineskeletor-1.0/templates/Message/group.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} - {{ form_start(form) }} - - {{ form_row(form.message) }} - {{ form_row(form.answers) }} - {{ form_end(form) }} -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/Message/message.html.twig b/src/nineskeletor-1.0/templates/Message/message.html.twig deleted file mode 100644 index 814769c..0000000 --- a/src/nineskeletor-1.0/templates/Message/message.html.twig +++ /dev/null @@ -1,95 +0,0 @@ -{{ form_widget(form.message) }} - -
-
- \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/User/edit.html.twig b/src/nineskeletor-1.0/templates/User/edit.html.twig deleted file mode 100755 index e62a103..0000000 --- a/src/nineskeletor-1.0/templates/User/edit.html.twig +++ /dev/null @@ -1,136 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

- {% if mode=="update" %} - Modification UTILISATEUR - {% elseif mode=="submit" %} - Création UTILISATEUR - {% elseif mode=="profil" %} - Profil UTILISATEUR - {% endif %} -

- - {{ form_widget(form.submit) }} - - {% if mode=="profil" %} - Annuler - {% else %} - Annuler - {% endif %} - - {% if mode=="update" %} - - Supprimer - - {% endif %} - -

- - {% if app.session.flashbag.has('error') %} -
- Erreur
- {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - - {% if app.session.flashbag.has('notice') %} -
- Information
- {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
- {% endfor %} -
- {% endif %} - -
- {% set avatar= "noavatar.png" %} - {% if user.avatar %} - {% set avatar= user.avatar %} - {% endif %} - - {{ form_widget(form.avatar) }} - Modifier -
- -
-
-
-
- Informations -
- -
- {{ form_row(form.username) }} - {% if form.password is defined %} - {{ form_row(form.password) }} - {%endif%} - {{ form_row(form.lastname) }} - {{ form_row(form.firstname) }} - {{ form_row(form.email) }} - {{ form_row(form.apikey) }} -
-
-
- -
- {% if form.roles is defined %} -
-
- Organisation -
- -
- {{ form_row(form.groups) }} - {{ form_row(form.roles) }} -
-
- {%endif%} -
-
-{{ form_end(form) }} - - - - -{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $("#user_password_first").val(""); - $("#user_login").focus(); - }); - - $("#user_avatar_img").on('load', function() { - - }) - $("#user_avatar_img").on('error', function(){ - console.log("la"); - var imgSrc = $(this).attr('src'); - if(imgSrc!="/{{appAlias}}/uploads/avatar/") - $(this).attr('src',imgSrc); - }); - - function showModal() { - $("#frameModal").attr("src","{{path("app_crop01")}}"); - $("#extraLargeModal").modal("show"); - } -{% endblock %} diff --git a/src/nineskeletor-1.0/templates/User/list.html.twig b/src/nineskeletor-1.0/templates/User/list.html.twig deleted file mode 100644 index e6d4b50..0000000 --- a/src/nineskeletor-1.0/templates/User/list.html.twig +++ /dev/null @@ -1,75 +0,0 @@ -{% extends "base.html.twig" %} - -{% block body %} -

-UTILISATEURS -

- -

Ajouter

- -
-
- Liste des Utilisateurs -
- -
-
- - - - - - - - - - - - - - {% for user in users %} - - - - - - - - - - {% endfor %} - -
ActionAvatarLoginPrénomNomRôlesGroupes
- - {{user.username}}{{user.firstname}}{{user.lastname}} - {%for role in user.roles %} - {%if role=="ROLE_ADMIN" %} - Administrateur
- {%elseif role=="ROLE_MASTER" %} - Professeur
- {%elseif role=="ROLE_STUDENT" %} - Elève
- {%elseif role=="ROLE_USER" %} - Utilisateur
- {%endif%} - {% endfor %} -
- {% for group in user.groups %} - {{ group.name }}
- {% endfor %} -
-
-
-
-{% endblock %} - -{% block localjavascript %} - $(document).ready(function() { - $('#dataTables').DataTable({ - columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], - responsive: true, - iDisplayLength: 100, - order: [[ 2, "asc" ]] - }); - }); -{% endblock %} \ No newline at end of file diff --git a/src/nineskeletor-1.0/templates/base.html.twig b/src/nineskeletor-1.0/templates/base.html.twig deleted file mode 100644 index 6c8b871..0000000 --- a/src/nineskeletor-1.0/templates/base.html.twig +++ /dev/null @@ -1,331 +0,0 @@ - - - {% set color = app.session.get('color') %} - - - - {% block title %}{{ appName }}{% endblock %} - - - - {% block head_style %} - {{ encore_entry_link_tags('app') }} - {% endblock head_style %} - - {% block stylesheets %}{% endblock %} - - - - - - - - - {% if useheader is defined and useheader %} - - {% endif %} - -
- {% set contentsidebar="" %} - {% if usesidebar is defined and usesidebar %} - {% set contentsidebar="contentsidebar" %} - - - {%endif%} - - -
- {% block body %} - - {% endblock %} -
-
- - - - - {{ encore_entry_script_tags('app') }} - - {% block localexternalscript %} - - {% endblock %} - - - - - - diff --git a/tmpl/nineskeletor.cron b/tmpl/nineskeletor.cron new file mode 100644 index 0000000..ebe9322 --- /dev/null +++ b/tmpl/nineskeletor.cron @@ -0,0 +1 @@ +* * * * * root /var/www/html/nineskeletor/scripts/cron.sh &>/dev/null