Merge branch 'master' into dist/envole/6/master
This commit is contained in:
commit
d1637e4efa
|
@ -19,9 +19,10 @@ class CalendareventController extends Controller
|
||||||
public function loadAction(Request $request,$access="config")
|
public function loadAction(Request $request,$access="config")
|
||||||
{
|
{
|
||||||
// S'assurer que c'est un appel ajax
|
// S'assurer que c'est un appel ajax
|
||||||
if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
|
// if (!$request->isXmlHttpRequest()) return new JsonResponse(array('message' => 'Interdit'), 400);
|
||||||
|
|
||||||
$output=array();
|
$events=array();
|
||||||
|
$eventids=array();
|
||||||
$idcalendar = $request->query->get('idcalendar');
|
$idcalendar = $request->query->get('idcalendar');
|
||||||
$start = $request->query->get('start');
|
$start = $request->query->get('start');
|
||||||
$end = $request->query->get('end');
|
$end = $request->query->get('end');
|
||||||
|
@ -62,15 +63,23 @@ class CalendareventController extends Controller
|
||||||
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
|
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
|
||||||
$tmp['allDay'] = $calendarevent->getAllday();
|
$tmp['allDay'] = $calendarevent->getAllday();
|
||||||
$tmp['calendar'] = $calendar->getId();
|
$tmp['calendar'] = $calendar->getId();
|
||||||
$tmp['editable'] = $calendar->getCanupdate();
|
$tmp['editable'] = $calendarevent->getCalendar()->getCanupdate();
|
||||||
|
|
||||||
array_push($output,$tmp);
|
array_push($events,$tmp);
|
||||||
|
array_push($eventids,$tmp["id"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($idcalendar==0) {
|
// On récupére les évenement partagé de l'utilisateur
|
||||||
$calendareventsshared = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventShareByDate($this->getUser(),$start,$end);
|
if($this->getUser()) {
|
||||||
foreach($calendareventsshared as $calendarevent) {
|
|
||||||
|
$calendarevents = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventGroupsShareByDate($this->getUser(),$start,$end);
|
||||||
|
|
||||||
|
foreach($calendarevents as $calendarevent) {
|
||||||
|
if($idcalendar>0) {
|
||||||
|
if(!$calendarevent->getGroups()->contains($calendar->getGroups()[0])) continue;
|
||||||
|
}
|
||||||
|
|
||||||
$tmp=[];
|
$tmp=[];
|
||||||
$tmp['id'] = strval($calendarevent->getId());
|
$tmp['id'] = strval($calendarevent->getId());
|
||||||
$tmp['title'] = $calendarevent->getName();
|
$tmp['title'] = $calendarevent->getName();
|
||||||
|
@ -80,13 +89,16 @@ class CalendareventController extends Controller
|
||||||
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
|
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
|
||||||
$tmp['allDay'] = $calendarevent->getAllday();
|
$tmp['allDay'] = $calendarevent->getAllday();
|
||||||
$tmp['calendar'] = $calendar->getId();
|
$tmp['calendar'] = $calendar->getId();
|
||||||
$tmp['editable'] = $calendar->getCanupdate();
|
$tmp['editable'] = $calendarevent->getCalendar()->getCanupdate();
|
||||||
|
|
||||||
array_push($output,$tmp);
|
if(!in_array($tmp['id'],$eventids)) {
|
||||||
|
array_push($events,$tmp);
|
||||||
|
array_push($eventids,$tmp["id"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response(json_encode($output));
|
$response = new Response(json_encode($events));
|
||||||
$response->headers->set('Content-Type', 'application/text');
|
$response->headers->set('Content-Type', 'application/text');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,10 +82,6 @@ class CalendareventRepository extends EntityRepository
|
||||||
->andWhere('groupe=usergroupe.group')
|
->andWhere('groupe=usergroupe.group')
|
||||||
->andWhere('usergroupe.user=:user')
|
->andWhere('usergroupe.user=:user')
|
||||||
|
|
||||||
->from('CadolesCoreBundle:UserGroup','proprio')
|
|
||||||
->andWhere('proprio.group=groupe')
|
|
||||||
->andWhere('proprio.user=calendar.user')
|
|
||||||
|
|
||||||
->setParameter('fgcanshare',true)
|
->setParameter('fgcanshare',true)
|
||||||
->setParameter('user',$user)
|
->setParameter('user',$user)
|
||||||
->setParameter('start',$start)
|
->setParameter('start',$start)
|
||||||
|
|
Loading…
Reference in New Issue