/**
  * @param string $action
  * @param bool   $executeQuery
  *
  * @return array|\Doctrine\ORM\AbstractQuery
  */
 public function findBadgeAutomaticallyAwardedFromAction(Log $log, $executeQuery = true)
 {
     $actiontype = $log->getAction();
     if ($log->getResourceType()) {
         $actiontype = '[[' . $log->getResourceType()->getName() . ']]' . $log->getAction();
     }
     $query = $this->getEntityManager()->createQuery('SELECT b
             FROM IcapBadgeBundle:Badge b
             JOIN b.badgeRules br
             WHERE (br.action = :action
             OR br.action = :action2)
             AND b.automaticAward = true')->setParameter('action', $log->getAction())->setParameter('action2', $actiontype);
     return $executeQuery ? $query->getResult() : $query;
 }
示例#2
0
 /**
  * @EXT\Route(
  *     "/view_details/{logId}",
  *           name="claro_log_view_details",
  *           options={"expose"=true}
  * )
  * @EXT\ParamConverter(
  *      "log",
  *           class="ClarolineCoreBundle:Log\Log",
  *           options={"id" = "logId", "strictId" = true}
  * )
  *
  * Displays the public profile of an user.
  *
  * @param \Claroline\CoreBundle\Entity\Log\Log $log
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function viewDetailsAction(Log $log)
 {
     $eventLogName = 'create_log_details_' . $log->getAction();
     if ($this->eventDispatcher->hasListeners($eventLogName)) {
         $event = $this->eventDispatcher->dispatch($eventLogName, new LogCreateDelegateViewEvent($log));
         return new Response($event->getResponseContent());
     }
     return $this->render('ClarolineCoreBundle:Log:view_details.html.twig', array('log' => $log));
 }