nettoyage
This commit is contained in:
parent
91da9291a1
commit
04273d0596
@ -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
|
||||
|
@ -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'
|
@ -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 }
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 14 KiB |
@ -1,397 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
use App\Entity\Activity as Entity;
|
||||
use App\Entity\Answer as Answer;
|
||||
use App\Entity\Message as Message;
|
||||
|
||||
use App\Form\ActivityType as Form;
|
||||
|
||||
class ActivityController extends AbstractController
|
||||
{
|
||||
private $data = "activity";
|
||||
private $route = "app_activity";
|
||||
private $render = "Activity/";
|
||||
private $entity = "App:Activity";
|
||||
|
||||
|
||||
private $mail;
|
||||
public function __construct(\App\Service\mailService $mail) { $this->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()."<br>";
|
||||
$body.="Professeur = ".$data->getUser()->getDisplayname()."<br>";
|
||||
$body.="Matière = ".$data->getSubject()."<br>";
|
||||
$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()."<br>";
|
||||
$body.="Professeur = ".$activity->getUser()->getDisplayname()."<br>";
|
||||
$body.="Matière = ".$activity->getSubject()."<br>";
|
||||
$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 ?<br><a class='btn btn-danger' href='".$url."'>Forcer l'Archivage</a>"));
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,283 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
use App\Entity\Answer as Entity;
|
||||
use App\Entity\Message as Message;
|
||||
|
||||
use App\Form\AnswerType as Form;
|
||||
use App\Form\CorrectedType as Corrected;
|
||||
|
||||
class AnswerController extends AbstractController
|
||||
{
|
||||
private $data = "answer";
|
||||
private $route = "app_answer";
|
||||
private $render = "Answer/";
|
||||
private $entity = "App:Answer";
|
||||
|
||||
private $mail;
|
||||
public function __construct(\App\Service\mailService $mail) { $this->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()."<br>";
|
||||
$body.="Elève = ".$data->getUser()->getDisplayname()."<br>";
|
||||
$body.="Matière = ".$data->getActivity()->getSubject()."<br>";
|
||||
$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()."<br>";
|
||||
$body.="Professeur = ".$data->getActivity()->getUser()->getDisplayname()."<br>";
|
||||
$body.="Matière = ".$data->getActivity()->getSubject()."<br>";
|
||||
$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()."<br>";
|
||||
$body.="Professeur = ".$data->getActivity()->getUser()->getDisplayname()."<br>";
|
||||
$body.="Matière = ".$data->getActivity()->getSubject()."<br>";
|
||||
$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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,493 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\Form\FormError;
|
||||
|
||||
use App\Entity\Document as Entity;
|
||||
use App\Form\DocumentType as Form;
|
||||
|
||||
class DocumentController extends AbstractController
|
||||
{
|
||||
private $data = "document";
|
||||
private $route = "app_document";
|
||||
private $render = "Document/";
|
||||
private $entity = "App:Document";
|
||||
|
||||
public function upload($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.'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;
|
||||
}
|
||||
|
||||
}
|
@ -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) {
|
||||
|
@ -1,268 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use App\Entity\Message as Entity;
|
||||
use App\Form\MessageType as Form;
|
||||
use App\Form\ActivitymessageType as Activitymessage;
|
||||
use App\Form\CorrectedType as Corrected;
|
||||
|
||||
class MessageController extends AbstractController
|
||||
{
|
||||
private $data = "message";
|
||||
private $route = "app_message";
|
||||
private $render = "Message/";
|
||||
private $entity = "App:Message";
|
||||
|
||||
public function message($id,Request $request)
|
||||
{
|
||||
$em = $this->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([]));
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
|
@ -1,282 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Activity
|
||||
*
|
||||
* @ORM\Table(name="activity")
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ActivityRepository")
|
||||
*/
|
||||
class Activity
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="name", type="string")
|
||||
*
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="subject", type="string", nullable=true)
|
||||
*
|
||||
*/
|
||||
private $subject;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="status", type="integer")
|
||||
*
|
||||
*/
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="activitys")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="activitys")
|
||||
*/
|
||||
private $group;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $activity;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Document", mappedBy="activity", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $activitydocuments;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $corrected;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Document", mappedBy="corrected", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $correcteddocuments;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Answer", mappedBy="activity", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $answers;
|
||||
|
||||
|
||||
private $answeruser;
|
||||
public function getAnsweruser(): ?Answer
|
||||
{
|
||||
return $this->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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,238 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Answer
|
||||
*
|
||||
* @ORM\Table(name="answer")
|
||||
* @ORM\Entity(repositoryClass="App\Repository\AnswerRepository")
|
||||
*/
|
||||
class Answer
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="status", type="integer")
|
||||
*
|
||||
*/
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="answers")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $answer;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Document", mappedBy="answer", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $answerdocuments;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $answercorrected;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Document", mappedBy="answercorrected", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $answercorrecteddocuments;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Message", mappedBy="answer", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $messages;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Activity", inversedBy="answers")
|
||||
*/
|
||||
private $activity;
|
||||
|
||||
public function getDisplayname()
|
||||
{
|
||||
return $this->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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,242 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Document
|
||||
*
|
||||
* @ORM\Table(name="document")
|
||||
* @ORM\Entity(repositoryClass="App\Repository\DocumentRepository")
|
||||
*/
|
||||
class Document
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="name", type="string")
|
||||
*
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="filename", type="string")
|
||||
*
|
||||
*/
|
||||
private $filename;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="entity", type="string")
|
||||
*/
|
||||
private $entity;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $roworder;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="extention", type="string")
|
||||
*/
|
||||
private $extention;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="minetype", type="string")
|
||||
*/
|
||||
private $minetype;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="havethumb", type="boolean")
|
||||
*/
|
||||
private $havethumb;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Activity", inversedBy="activitydocuments")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $activity;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Activity", inversedBy="correcteddocuments")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $corrected;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Answer", inversedBy="answerdocuments")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $answer;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Answer", inversedBy="answercorrecteddocuments")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $answercorrected;
|
||||
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
<?php
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="message")
|
||||
*/
|
||||
class Message
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
private $message;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $submitdate;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $deletable;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Answer", inversedBy="messages")
|
||||
*/
|
||||
private $answer;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="messages")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="User", inversedBy="messagereaders", cascade={"persist"})
|
||||
* @ORM\JoinTable(name="messageuserread",
|
||||
* joinColumns={@ORM\JoinColumn(name="message", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")}
|
||||
* )
|
||||
*/
|
||||
protected $readers;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Activity;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Common\Persistence\ManagerRegistry;
|
||||
|
||||
class ActivityRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Activity::class);
|
||||
}
|
||||
|
||||
public function findAllMasterActivityActive($user,$activeactivity) {
|
||||
$qb = $this->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();
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Answer;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Common\Persistence\ManagerRegistry;
|
||||
|
||||
class AnswerRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Answer::class);
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Document;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Common\Persistence\ManagerRegistry;
|
||||
|
||||
class DocumentRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Document::class);
|
||||
}
|
||||
}
|
@ -1,262 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="update" %}
|
||||
Modification ACTIVITE
|
||||
{% elseif mode=="submit" %}
|
||||
Création ACTIVITE
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<a class="btn btn-secondary" href={{ path('app_activity') }}>Annuler</a>
|
||||
|
||||
{% if mode=="update" %}
|
||||
{% if activity.status==0 or activity.status==10%}
|
||||
<a href="{{ path('app_activity_delete',{'id':activity.id}) }}"
|
||||
class="btn btn-danger float-right"
|
||||
data-method="delete"
|
||||
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
|
||||
Supprimer
|
||||
</a>
|
||||
{% else %}
|
||||
{{ form_widget(form.archiving) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.distribution is defined %}
|
||||
{{ form_widget(form.distribution) }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage | raw }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h2>Entête</h2>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.subject) }}
|
||||
{{ form_row(form.group) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h2>Enoncés</h2>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{% if mode == "submit" %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
Vous pourrez rattacher des pièces jointes une fois l'activité créée.
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
{% if activity.status == 0 %}
|
||||
<button type="button" id="upload" onClick="myupload('activity')" class="btn btn-link float-right" title="upload"><i class ="fa fa-upload"></i></button>
|
||||
<button type="button" id="record" onClick="myrecord('activity')" class="btn btn-link float-right" title="enregistrer"><i class ="fa fa-microphone"></i></button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div id="activitydocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Description
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_widget(form.activity) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br>
|
||||
<h2>Corrigés</h2>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{% if mode == "submit" %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
Vous pourrez rattacher des pièces jointes une fois l'activité créée.
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
{% if activity.status < 10 %}
|
||||
<button type="button" id="upload" onClick="myupload('corrected')" class="btn btn-link float-right" title="upload"><i class ="fa fa-upload"></i></button>
|
||||
<button type="button" id="record" onClick="myrecord('corrected')" class="btn btn-link float-right" title="enregistrer"><i class ="fa fa-microphone"></i></button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div id="correcteddocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Description
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_widget(form.corrected) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ 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 %}
|
@ -1,125 +0,0 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
ACTIVITES
|
||||
</h1>
|
||||
|
||||
<p><a class="btn btn-success" href={{ path('app_activity_submit') }}>Ajouter</a></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Activités
|
||||
<div class="custom-control custom-switch float-right">
|
||||
<input type="checkbox" class="custom-control-input" id="switchactive" {% if app.session.get('activeactivity') %} checked {% endif %}>
|
||||
<label class="custom-control-label" for="switchactive">Activités actives</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70px" class="no-sort">Action</th>
|
||||
<th>Nom</th>
|
||||
<th>Statut</th>
|
||||
<th>Groupe</th>
|
||||
<th>Elèves</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for activity in activitys %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{path("app_activity_update",{id:activity.id})}}"><i class="fa fa-file"></i></a>
|
||||
<button type='button' class='btn btn-link' onClick='mymessage({{activity.id}})'><i class="fa fa-envelope"></i></button>
|
||||
</td>
|
||||
<td>{{activity.name}}</td>
|
||||
<td>
|
||||
{% if activity.status == 0 %}
|
||||
brouillon
|
||||
{% elseif activity.status == 1 %}
|
||||
distribué
|
||||
{% else %}
|
||||
clos
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{activity.group.name}}</td>
|
||||
<td>
|
||||
{% set answerusers = [] %}
|
||||
|
||||
{% for answer in activity.answers %}
|
||||
{% set answerusers = answerusers|merge([answer.user.id]) %}
|
||||
<a href="{{ path('app_answer_view',{id:answer.id}) }}">
|
||||
<span id="badge{{answer.id}}" class="badge badge-success mr-1">0</span>
|
||||
{{ answer.user.displayname }} =
|
||||
<span id="status{{answer.id}}"></span>
|
||||
</a>
|
||||
<br>
|
||||
{% endfor %}
|
||||
|
||||
{% if activity.status > 0 %}
|
||||
{% for user in activity.group.users %}
|
||||
{% if user.id not in answerusers and "ROLE_STUDENT" in user.roles %}
|
||||
<span class="badge badge-success mr-1">0</span>{{ user.displayname }} = non vu<br>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% 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 %}
|
@ -1,301 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1 class="page-header">
|
||||
ACTIVITE = {{ answer.activity.name }}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<a class="btn btn-secondary" href={{ path('app_activity') }}>Annuler</a>
|
||||
|
||||
{% if mode=="update" %}
|
||||
{% if answer.status<10 and answer.activity.status==1%}
|
||||
{{ form_widget(form.returned) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if answer.status == 15 %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>Corrigé</h2>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Appréciation
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ answer.answercorrected | raw }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if answer.activity.corrected %}
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Corrigé
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ answer.activity.corrected | raw }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes de l'Appréciation
|
||||
</div>
|
||||
|
||||
<div id="answercorrecteddocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if answer.activity.correcteddocuments %}
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes de la Correction
|
||||
</div>
|
||||
|
||||
<div id="correcteddocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>Enoncés</h2>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
Titre = {{ answer.activity.name}}<br>
|
||||
Matière = {{ answer.activity.subject}}<br>
|
||||
|
||||
<br>
|
||||
{{ answer.activity.activity|raw}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
</div>
|
||||
|
||||
<div id="activitydocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<h2>Activité</h2>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Description
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_widget(form.answer) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
{% if answer.status < 10 and answer.activity.status == 1 %}
|
||||
<button type="button" id="upload" onClick="myupload('answer')" class="btn btn-link float-right" title="upload"><i class ="fa fa-upload"></i></button>
|
||||
<button type="button" id="record" onClick="myrecord('answer')" class="btn btn-link float-right" title="enregistrer"><i class ="fa fa-microphone"></i></button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div id="answerdocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 text-white bg-secondary">
|
||||
<h3>Messages</h3>
|
||||
{{ render_esi(controller('App\\Controller\\MessageController::message', { 'id': answer.id })) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ 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 %}
|
@ -1,104 +0,0 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
ACTIVITES
|
||||
</h1>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Activités
|
||||
<div class="custom-control custom-switch float-right">
|
||||
<input type="checkbox" class="custom-control-input" id="switchactive" {% if app.session.get('activeactivity') %} checked {% endif %}>
|
||||
<label class="custom-control-label" for="switchactive">Activités actives</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70px" class="no-sort">Action</th>
|
||||
<th width="70px" class="no-sort"></th>
|
||||
<th>Nom</th>
|
||||
<th>Professeur</th>
|
||||
<th>Matière</th>
|
||||
<th>Statut</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for activity in activitys %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{path("app_answer_update",{id:activity.answeruser.id})}}"><i class="fa fa-file"></i></a>
|
||||
</td>
|
||||
<td class="text-center"><span id="badge{{activity.answeruser.id}}" class="badge badge-success p-2" style="font-size:20px">0</span></td>
|
||||
<td>{{activity.name}}</td>
|
||||
<td>{{activity.user.displayname}}</td>
|
||||
<td>{{activity.subject}}</td>
|
||||
<td>
|
||||
<span id="status{{activity.answeruser.id}}">
|
||||
{% 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 %}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% 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 %}
|
@ -1,304 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1 class="page-header">
|
||||
ACTIVITE = {{ answer.activity.name }} = {{ answer.user.displayname }}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<a class="btn btn-secondary" href={{ path('app_activity') }}>Annuler</a>
|
||||
|
||||
{% 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 %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if form.answercorrected is defined %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>Corrigé</h2>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Appréciation
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_widget(form.answercorrected) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if answer.activity.corrected %}
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Corrigé
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ answer.activity.corrected | raw }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes de l'Appréciation
|
||||
{% if answer.status>=10 and answer.status<15 and answer.activity.status==1 %}
|
||||
<button type="button" id="upload" onClick="myupload('answercorrected')" class="btn btn-link float-right" title="upload"><i class ="fa fa-upload"></i></button>
|
||||
<button type="button" id="record" onClick="myrecord('answercorrected')" class="btn btn-link float-right" title="enregistrer"><i class ="fa fa-microphone"></i></button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div id="answercorrecteddocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if answer.activity.correcteddocuments %}
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes de la Correction
|
||||
</div>
|
||||
|
||||
<div id="correcteddocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>Enoncés</h2>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
Titre = {{ answer.activity.name}}<br>
|
||||
{% if answer.activity.subject %}
|
||||
Matière = {{ answer.activity.subject}}<br>
|
||||
{% endif %}
|
||||
|
||||
<br>
|
||||
{{ answer.activity.activity|raw}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
</div>
|
||||
|
||||
<div id="activitydocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<h2>Activité</h2>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Description
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ answer.answer|raw}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Pièces Jointes
|
||||
</div>
|
||||
|
||||
<div id="answerdocuments" class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 text-white bg-secondary">
|
||||
<h3>Messages</h3>
|
||||
{{ render_esi(controller('App\\Controller\\MessageController::message', { 'id': answer.id })) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ 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 %}
|
@ -1,59 +0,0 @@
|
||||
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="update" %}
|
||||
Modification JOB
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<a class="btn btn-secondary" href={{ path('app_cron') }}>Annuler</a>
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_row(form.command) }}
|
||||
{{ form_row(form.jsonargument) }}
|
||||
{{ form_row(form.statut) }}
|
||||
{{ form_row(form.repeatcall) }}
|
||||
{{ form_row(form.repeatinterval) }}
|
||||
{{ form_row(form.nextexecdate) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
$("#command").focus();
|
||||
});
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
JOBS
|
||||
</h1>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Jobs
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70px" class="no-sort">Action</th>
|
||||
<th class="no-string">Order</th>
|
||||
<th>Command</th>
|
||||
<th>Description</th>
|
||||
<th>Statut</th>
|
||||
<th>Prochaine exécution</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for cron in crons %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{path("app_cron_update",{id:cron.id})}}"><i class="fa fa-file"></i></a>
|
||||
</td>
|
||||
<td>{{cron.id}}</td>
|
||||
<td>{{cron.command}}</td>
|
||||
<td>{{cron.description}}</td>
|
||||
<td>{{cron.statutlabel}}</td>
|
||||
<td>{{cron.nextexecdate|date("d/m/Y H:i")}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% 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 %}
|
||||
|
@ -1,19 +0,0 @@
|
||||
{% extends "CRWhizBundle::base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">{{ title }}</h1>
|
||||
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_log",{"id":"cron"}) }}>Log CRON</a>
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_log",{"id":"prod"}) }}>Log PROD</a>
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_log",{"id":"dev"}) }}>Log DEV</a>
|
||||
<br><br>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-pencil fa-fw"></i> Logs
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{{ content | nl2br }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -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 %}
|
||||
<h3 class="page-header"></h3>
|
||||
<button class="btn btn-secondary" onClick="closeModal();">Annuler</button>
|
||||
|
||||
<form action="{{ oneup_uploader_endpoint('avatar') }}" class="dropzone" id="MyDropZone" style="margin-top:10px">
|
||||
|
||||
{{ 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 %}
|
@ -1,71 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form.submit) }}
|
||||
<button class="btn btn-secondary" onClick="closeModal();">Annuler</button>
|
||||
|
||||
<div id='preview' style='overflow:hidden; width:90px; height:90px; position: absolute; top: 0px; right: 10px;'>
|
||||
<img src="/{{ appAlias }}/uploads/avatar/{{ app.session.get('uploadavatar') }}" style='position: relative;' alt='Thumbnail Preview' />
|
||||
</div>
|
||||
|
||||
<div style="width:800px; height:590px; overflow:hidden; margin:65px auto 0px auto;">
|
||||
<div id="largeimg" class="crop-select-js" style="width:800px;">
|
||||
</div>
|
||||
</div>
|
||||
{{ 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 %}
|
@ -1,8 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<script>
|
||||
window.parent.$("#mymodal").modal('hide');
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -1,52 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<button class="btn btn-secondary" onClick="closeModal();">Annuler</button>
|
||||
|
||||
{% if mode=="update" %}
|
||||
<a href="{{ path('app_document_delete',{'entity':document.entity,'id':document.id}) }}"
|
||||
class="btn btn-danger float-right"
|
||||
data-method="delete"
|
||||
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
|
||||
Supprimer
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% 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 %}
|
@ -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 %}
|
||||
<section class="main-controls">
|
||||
<canvas class="visualizer" height="200px"></canvas>
|
||||
<div id="buttons">
|
||||
<button class="btn btn-primary record"><i class="fa fa-microphone fa-fw"></i>Enregistrer</button>
|
||||
<button class="btn btn-danger stop"><i class="fa fa-circle fa-fw"></i>Stop</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="sound-clips">
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
{% 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 %}
|
@ -1,18 +0,0 @@
|
||||
<div class="border media mb-3 p-2 bg-light">
|
||||
<img class="align-self-start mr-3" src="{{ url }}" style="max-width:80px">
|
||||
<div class="media-body">
|
||||
<h5 class="mt-0">{{title}}</h5>
|
||||
|
||||
{% if minefamily=="image" or minefamily=="image" or minefamily=="video" or extention=="pdf" %}
|
||||
<button type="button" onClick="myviewer('{{ entity }}',{{ id }})" class="btn btn-link" title="visualiser"><i class="fa fa-eye"></i></button>
|
||||
{% endif %}
|
||||
|
||||
<button type="button" onClick="mydownload('{{ entity }}',{{ id }})" class="btn btn-link" title="télécharger"><i class="fa fa-download"></i></button>
|
||||
|
||||
{% if master %}
|
||||
<button type="button" onClick="myedit('{{ entity }}',{{ id }})" class="btn btn-link" title="éditer"><i class="fa fa-edit"></i></button>
|
||||
{% endif %}
|
||||
|
||||
{{ description|raw }}
|
||||
</div>
|
||||
</div>
|
@ -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 %}
|
||||
<button class="btn btn-secondary" onClick="closeModal();">Annuler</button>
|
||||
|
||||
<form action="{{ oneup_uploader_endpoint('document') }}" class="dropzone" id="MyDropZone" style="margin-top:10px">
|
||||
|
||||
{{ 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 %}
|
@ -1,55 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% if minefamily == "image" %}
|
||||
<img id="image" src="{{image}}" style="display:block; margin:auto; max-width:100%;">
|
||||
{% else %}
|
||||
<iframe id="frameviewfile" src="{{ path('app_document_show',{'entity':entity,'id':id }) }}"
|
||||
style="width:100%; height:100%">
|
||||
</iframe>
|
||||
{% 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 %}
|
||||
|
||||
|
||||
|
||||
|
@ -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)) }) %}
|
||||
<div class="form-group {{ errors|length > 0 ? 'has-error' : '' }}">
|
||||
{{- form_label(form) }}
|
||||
{{- form_widget(form) }}
|
||||
{{ form_errors(form) }}
|
||||
</div>
|
||||
{%- 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{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
||||
{{ label|trans({}, translation_domain)|raw }}
|
||||
<span class="mandatory">{% if required %}*{% endif %}</span>
|
||||
</label>
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
{%- endblock form_label %}
|
||||
|
||||
{# et enfin les erreurs #}
|
||||
{% block form_errors %}
|
||||
{% if errors|length > 0 %}
|
||||
{% if attr.help is defined and attr.help %}
|
||||
<p class="help-block text-danger">
|
||||
{% for error in errors %}
|
||||
{{ error.message }}<br />
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% else %}
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">
|
||||
<span aria-hidden="true">×</span>
|
||||
<span class="sr-only">Close</span>
|
||||
</button>
|
||||
{% for error in errors %}
|
||||
{{ error.message|raw }}<br />
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% 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}) %}
|
||||
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{
|
||||
label|trans({}, translation_domain) }}
|
||||
{% if type is defined and type == 'submit' -%}
|
||||
|
||||
{% endif %}
|
||||
</button>
|
||||
{%- 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 %}
|
||||
<ul {{ block('widget_container_attributes') }} style="list-style: none; padding-left: 0">
|
||||
{% for child in form %}
|
||||
<li>
|
||||
{{ form_widget(child) }}
|
||||
{{ form_label(child) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
{{ parent() }}
|
||||
{% endif %}
|
||||
{% endblock choice_widget %}
|
||||
|
||||
{% block checkbox_widget %}
|
||||
<label for="{{ id }}">
|
||||
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
|
||||
{{ label|trans({}, translation_domain) }}</label>
|
||||
{% endblock checkbox_widget %}
|
||||
|
||||
{% block radio_widget %}
|
||||
<label for="{{ id }}">
|
||||
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
|
||||
{{ label|trans({}, translation_domain) }}
|
||||
</label>
|
||||
{% endblock radio_widget %}
|
||||
|
||||
{# Inline date marcro #}
|
||||
{% macro date_form_widget(form) %}
|
||||
<div class="col col-xs-4">
|
||||
{{ form_widget(form) }}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{# Inline date #}
|
||||
{% block date_widget %}
|
||||
{% if widget == 'single_text' %}
|
||||
{{ block('form_widget_simple') }}
|
||||
{% else %}
|
||||
{% import _self as self %}
|
||||
<div class="row">
|
||||
{{ 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 }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock date_widget %}
|
||||
|
||||
{# Inline date_time
|
||||
{% block time_widget %}
|
||||
{% if widget == 'single_text' %}
|
||||
{{ block('form_widget_simple') }}
|
||||
{% else %}
|
||||
{% import _self as self %}
|
||||
<div class="row">
|
||||
{{ time_pattern|replace({
|
||||
'{{ hour }}': self.date_form_widget(form.hour),
|
||||
'{{ minute }}': self.date_form_widget(form.minute),
|
||||
})|raw }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock time_widget %}
|
||||
#}
|
||||
|
||||
{% block file_widget %}
|
||||
{% set type = type|default('file') %}
|
||||
<input type="{{ type }}" {{ block('widget_attributes') }} />
|
||||
{% endblock file_widget %}
|
@ -1,64 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="update" %}
|
||||
Modification GROUPE
|
||||
{% elseif mode=="submit" %}
|
||||
Création GROUPE
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<a class="btn btn-secondary" href={{ path('app_group') }}>Annuler</a>
|
||||
|
||||
{% if mode=="update" %}
|
||||
<a href="{{ path('app_group_delete',{'id':group.id}) }}"
|
||||
class="btn btn-danger float-right"
|
||||
data-method="delete"
|
||||
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
|
||||
Supprimer
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.users) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
$("#group_name").focus();
|
||||
});
|
||||
{% endblock %}
|
@ -1,51 +0,0 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
GROUPES
|
||||
</h1>
|
||||
|
||||
<p><a class="btn btn-success" href={{ path('app_group_submit') }}>Ajouter</a></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Groupes
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70px" class="no-sort">Action</th>
|
||||
<th>Nom</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for group in groups %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if not group.ldapfilter %}
|
||||
<a href="{{path("app_group_update",{id:group.id})}}"><i class="fa fa-file"></i></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{group.name}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% 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 %}
|
@ -1,7 +0,0 @@
|
||||
{% extends "CRWhizBundle::base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
@ -1,6 +0,0 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,36 +0,0 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block localstyle %}
|
||||
body {
|
||||
background-color: #efefef;
|
||||
}
|
||||
.homecard {
|
||||
padding-top: 20px;
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div style="text-align:center">
|
||||
<img src="/{{appAlias}}/images/logo.png" style="height:120px;margin-top:10px;"><br>
|
||||
<h1>{{appName}}</h1>
|
||||
<form action="{{ path('app_login') }}" method="post">
|
||||
<div class="card homecard" style="width:400px; margin:auto">
|
||||
<div class="card-body">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
|
||||
<label for="username">Login</label>
|
||||
<input type="text" id="username" name="_username" value="{{ last_username }}" class="form-control" style="margin-bottom:15px;" />
|
||||
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="_password" class="form-control" style="margin-bottom:15px;" />
|
||||
|
||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
|
||||
|
||||
<input type="submit" name="login" class="btn btn-success form-control" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,9 +0,0 @@
|
||||
{% block subject %}
|
||||
{{ subject }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% autoescape %}
|
||||
<p>{{ body|raw }}</p>
|
||||
{% endautoescape %}
|
||||
{% endblock %}
|
@ -1,8 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<script>
|
||||
window.parent.$("#mymodal").modal('hide');
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -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 %}
|
@ -1,95 +0,0 @@
|
||||
{{ form_widget(form.message) }}
|
||||
<button type="button" id="send" onClick="mySend({{ id }})" class="btn btn-success mt-1 mb-3" title="envoyer">Envoyer</button>
|
||||
<div id="messagescontent">
|
||||
</div>
|
||||
<script>
|
||||
function mySend(id) {
|
||||
url="{{ path('app_message_submit',{id:'xxxxx'}) }}";
|
||||
url=url.replace("xxxxx",id);
|
||||
data = CKEDITOR.instances["message_message"].getData();
|
||||
|
||||
if(data) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {
|
||||
html: data
|
||||
},
|
||||
success: function (response) {
|
||||
response=JSON.parse(response);
|
||||
if(response.return=="KO") {
|
||||
alert(response.error);
|
||||
}
|
||||
else {
|
||||
// On vide l'editeur
|
||||
CKEDITOR.instances["message_message"].setData('');
|
||||
|
||||
// On vide le conteneur message
|
||||
$("#messagescontent").empty();
|
||||
|
||||
// On reconstruit la liste
|
||||
for (message of response) {
|
||||
myMessage(message.id,message.message,message.userdisplayname,message.submitdate,message.deletable);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function myMessage(id,html,displayname,submitdate,deletable) {
|
||||
html ='<div class="border p-1 text-secondary bg-light">'+html+'</div>';
|
||||
html+='<div class="small mb-2 font-italic" style="line-height:26px">'+displayname+' le '+submitdate;
|
||||
if(deletable) {
|
||||
html+='<button type="button" class="btn btn-link float-right text-white" onClick="mydeleteMessage('+id+')"><i class="fa fa-trash" style="font-size:12px"></i></button>';
|
||||
}
|
||||
html+='</div>';
|
||||
|
||||
$("#messagescontent").append(html);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', myloadMessage, false);
|
||||
|
||||
function myloadMessage() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ path("app_message_load",{"id":id}) }}",
|
||||
success: function (response) {
|
||||
response=JSON.parse(response);
|
||||
if(response.return=="KO") {
|
||||
alert(response.error);
|
||||
}
|
||||
else {
|
||||
// On vide le conteneur message
|
||||
$("#messagescontent").empty();
|
||||
|
||||
// On reconstruit la liste
|
||||
for (message of response) {
|
||||
myMessage(message.id,message.message,message.userdisplayname,message.submitdate,message.deletable);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function mydeleteMessage(id) {
|
||||
url="{{ path("app_message_delete",{"id":"xxxxx"}) }}";
|
||||
url=url.replace("xxxxx",id);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
success: function (response) {
|
||||
response=JSON.parse(response);
|
||||
if(response.return=="KO") {
|
||||
alert(response.error);
|
||||
}
|
||||
else {
|
||||
myloadMessage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.setInterval(myloadMessage, 5000);
|
||||
</script>
|
@ -1,136 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="update" %}
|
||||
Modification UTILISATEUR
|
||||
{% elseif mode=="submit" %}
|
||||
Création UTILISATEUR
|
||||
{% elseif mode=="profil" %}
|
||||
Profil UTILISATEUR
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
{% if mode=="profil" %}
|
||||
<a class="btn btn-secondary" href={{ path('app_home') }}>Annuler</a>
|
||||
{% else %}
|
||||
<a class="btn btn-secondary" href={{ path('app_user') }}>Annuler</a>
|
||||
{% endif %}
|
||||
|
||||
{% if mode=="update" %}
|
||||
<a href="{{ path('app_user_delete',{'id':user.id}) }}"
|
||||
class="btn btn-danger float-right"
|
||||
data-method="delete"
|
||||
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
|
||||
Supprimer
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<br><br>
|
||||
|
||||
{% if app.session.flashbag.has('error') %}
|
||||
<div class='alert alert-danger' style='margin: 5px 0px'>
|
||||
<strong>Erreur</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('error') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.session.flashbag.has('notice') %}
|
||||
<div class='alert alert-info' style='margin: 5px 0px'>
|
||||
<strong>Information</strong><br>
|
||||
{% for flashMessage in app.session.flashbag.get('notice') %}
|
||||
{{ flashMessage }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div style="width:90px; margin:auto;">
|
||||
{% set avatar= "noavatar.png" %}
|
||||
{% if user.avatar %}
|
||||
{% set avatar= user.avatar %}
|
||||
{% endif %}
|
||||
<img id="user_avatar_img" src="/{{ appAlias }}/uploads/avatar/{{ avatar }}" class="avatar big" >
|
||||
{{ form_widget(form.avatar) }}
|
||||
<a class="btn btn-info" style="width:100%; margin-bottom:15px;" onClick="showModal();" title='Ajouter un avatar'>Modifier</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ 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) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{% if form.roles is defined %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Organisation
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_row(form.groups) }}
|
||||
{{ form_row(form.roles) }}
|
||||
</div>
|
||||
</div>
|
||||
{%endif%}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
|
||||
<div id="extraLargeModal" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<iframe id="frameModal" frameborder=0 width="100%" height="700px"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% 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 %}
|
@ -1,75 +0,0 @@
|
||||
{% extends "base.html.twig" %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">
|
||||
UTILISATEURS
|
||||
</h1>
|
||||
|
||||
<p><a class="btn btn-success" href={{ path('app_user_submit') }}>Ajouter</a></p>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Utilisateurs
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70px" class="no-sort">Action</th>
|
||||
<th width="70px" class="no-sort">Avatar</th>
|
||||
<th>Login</th>
|
||||
<th>Prénom</th>
|
||||
<th>Nom</th>
|
||||
<th>Rôles</th>
|
||||
<th>Groupes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{path("app_user_update",{id:user.id})}}"><i class="fa fa-file"></i></a>
|
||||
</td>
|
||||
<td><img id="user_avatar_img" src="/{{ appAlias }}/uploads/avatar/{{ user.avatar }}" class="avatar" ></td>
|
||||
<td>{{user.username}}</td>
|
||||
<td>{{user.firstname}}</td>
|
||||
<td>{{user.lastname}}</td>
|
||||
<td>
|
||||
{%for role in user.roles %}
|
||||
{%if role=="ROLE_ADMIN" %}
|
||||
Administrateur<br>
|
||||
{%elseif role=="ROLE_MASTER" %}
|
||||
Professeur<br>
|
||||
{%elseif role=="ROLE_STUDENT" %}
|
||||
Elève<br>
|
||||
{%elseif role=="ROLE_USER" %}
|
||||
Utilisateur<br>
|
||||
{%endif%}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
{% for group in user.groups %}
|
||||
{{ group.name }}<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% 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 %}
|
@ -1,331 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
{% set color = app.session.get('color') %}
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
|
||||
<title>{% block title %}{{ appName }}{% endblock %}</title>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
{% block head_style %}
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
{% endblock head_style %}
|
||||
|
||||
{% block stylesheets %}{% endblock %}
|
||||
|
||||
<link rel="shortcut icon" href="/{{ appAlias }}/images/logo.png" />
|
||||
</head>
|
||||
|
||||
|
||||
<style>
|
||||
/* global */
|
||||
h1{
|
||||
padding: 40px 0px 9px 0px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.nav a{
|
||||
background: none;
|
||||
color: #CFD8DC;
|
||||
font-size: 14px;
|
||||
padding: 5px 0px 5px 25px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
/* Sidebar Styles */
|
||||
.contentsidebar {
|
||||
margin-left:250px;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
left: 250px;
|
||||
width: 250px;
|
||||
height: 100%;
|
||||
margin-left: -250px;
|
||||
overflow-y: auto;
|
||||
background: #37474F;
|
||||
-webkit-transition: all 0.5s ease;
|
||||
-moz-transition: all 0.5s ease;
|
||||
-o-transition: all 0.5s ease;
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
|
||||
#sidebar header {
|
||||
background-color: #263238;
|
||||
font-size: 20px;
|
||||
line-height: 52px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#sidebar header a {
|
||||
color: #fff;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#sidebar header a:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#sidebar .nav{
|
||||
display: block;
|
||||
}
|
||||
|
||||
#sidebar .nav a {
|
||||
padding: 0px 10px 5px 10px;
|
||||
}
|
||||
|
||||
#sidebar .nav .last{
|
||||
border-bottom: 5px solid #455A64;
|
||||
padding-bottom:5px;
|
||||
}
|
||||
|
||||
#sidebar .title {
|
||||
color: #CFD8DC;
|
||||
font-size: 16px;
|
||||
padding: 0px 10px 0px 10px;
|
||||
display: block;
|
||||
text-transform: uppercase;
|
||||
margin-left: 0px !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#sidebar .nav .last{
|
||||
border-bottom: 5px solid #455A64;
|
||||
padding-bottom:5px;
|
||||
}
|
||||
|
||||
#sidebar .nav a:hover{
|
||||
background: none;
|
||||
color: #ECEFF1;
|
||||
}
|
||||
|
||||
#sidebar .nav a .fa{
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#sidebar .nav .select-control {
|
||||
padding: 0px 10px 5px 10px;
|
||||
margin-top: -12px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
background-color: #343a40;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
border-radius: 100%;
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
.avatar.big{
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.contentsidebar {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
position: static;
|
||||
margin:0px -15px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
a.btn {
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
.btn-link {
|
||||
padding:0px;
|
||||
width:25px;
|
||||
}
|
||||
|
||||
.media-body p {
|
||||
font-size :12px;
|
||||
margin-bottom:0px;
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 992px) {
|
||||
#sidebar {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
{% if useheader is defined and useheader %}
|
||||
#main {
|
||||
padding-top:55px;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
|
||||
th.dt-center, td.dt-center { text-align: center; }
|
||||
{% block localstyle %}
|
||||
|
||||
{% endblock %}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
{% if useheader is defined and useheader %}
|
||||
<nav class="navbar navbar-expand-lg navbar-dark fixed-top bg-dark">
|
||||
<a class="navbar-brand" href="{{ path('app_home')}}">
|
||||
<img src="/{{appAlias}}/images/logo.png" style="height:30px;margin-top:-3px;">
|
||||
{{appName}}
|
||||
</a>
|
||||
|
||||
{% if usesidebar is defined and usesidebar %}
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#sidebar" aria-controls="sidebar" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<ul class="nav navbar-top-links navbar-right">
|
||||
{% if app.user %}
|
||||
<li>
|
||||
<a href="{{path("app_user_profil")}}">
|
||||
<img src="\{{appAlias}}\uploads\avatar\{{app.user.avatar}}" class="avatar">
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li>
|
||||
{% if app.user %}
|
||||
{% if appAuth=="MYSQL" %}
|
||||
<a href="{{path("app_logout")}}"><i class="fa fa-sign-out-alt fa-fw"></i></a>
|
||||
{% elseif appAuth=="CAS" %}
|
||||
<a href="{{path("app_logoutcas")}}"><i class="fa fa-sign-out-alt fa-fw"></i></a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if appAuth=="MYSQL" %}
|
||||
<a href="{{path("app_login")}}"><i class="fa fa-sign-in-alt fa-fw"></i></a>
|
||||
{% elseif appAuth=="CAS" %}
|
||||
<a href="{{path("app_logincas")}}"><i class="fa fa-sign-in-alt fa-fw"></i></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<main id="main" class="container-fluid">
|
||||
{% set contentsidebar="" %}
|
||||
{% if usesidebar is defined and usesidebar %}
|
||||
{% set contentsidebar="contentsidebar" %}
|
||||
|
||||
<div id="sidebar" class="collapse">
|
||||
<ul class="nav">
|
||||
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MASTER') or is_granted('ROLE_STUDENT')%}
|
||||
<br>
|
||||
<li class="last">
|
||||
<a href="{{path("app_activity")}}">
|
||||
<i class="fa fa-clipboard-list"></i>Activités
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('ROLE_ADMIN') %}
|
||||
<br>
|
||||
<li class="title">Administration</li>
|
||||
<li>
|
||||
<a href="{{path("app_user")}}">
|
||||
<i class="fa fa-user"></i>Utilisateurs
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="{{path("app_group")}}">
|
||||
<i class="fa fa-users"></i>Groupes
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="last">
|
||||
<a href="{{path("app_cron")}}">
|
||||
<i class="fa fa-cogs"></i>Jobs
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{%endif%}
|
||||
|
||||
|
||||
<div id="mycontent" class="content {{contentsidebar}}">
|
||||
{% block body %}
|
||||
|
||||
{% endblock %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div id="mymodal" class="modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Modification Evènement</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<iframe id="framemodal" frameborder=0 width="100%" height="600px"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{ encore_entry_script_tags('app') }}
|
||||
|
||||
{% block localexternalscript %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var doit = true;
|
||||
|
||||
$("a[data-method]").on('click',function(){
|
||||
if($(this).data('confirm')){
|
||||
doit = confirm($(this).data('confirm'));
|
||||
if(!doit) return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("button[data-method]").on('click',function(){
|
||||
if($(this).data('confirm')){
|
||||
doit = confirm($(this).data('confirm'));
|
||||
if(!doit) return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function ModalLoad(idmodal,title,path) {
|
||||
$("#"+idmodal+" .modal-header h4").text(title);
|
||||
$("#"+idmodal+" #framemodal").attr("src",path);
|
||||
$("#"+idmodal).modal("show");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
{% block localjavascript %}
|
||||
|
||||
{% endblock %}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
1
tmpl/nineskeletor.cron
Normal file
1
tmpl/nineskeletor.cron
Normal file
@ -0,0 +1 @@
|
||||
* * * * * root /var/www/html/nineskeletor/scripts/cron.sh &>/dev/null
|
Loading…
Reference in New Issue
Block a user