예제 #1
0
 /**
  * Returns the users who are not members of a group and whose first name, last
  * name or username match a given search string.
  *
  * @param \Claroline\CoreBundle\Entity\Group $group
  * @param string                             $search
  * @param bool                               $executeQuery
  * @param string                             $orderedBy
  *
  * @return User[]|Query
  *
  * @todo Find out why the join on profile preferences is necessary
  */
 public function findGroupOutsidersByName(Group $group, $search, $executeQuery = true, $orderedBy = 'id')
 {
     $dql = "\n            SELECT DISTINCT u FROM Claroline\\CoreBundle\\Entity\\User u\n            WHERE (\n                UPPER(u.lastName) LIKE :search\n                OR UPPER(u.firstName) LIKE :search\n                OR UPPER(u.lastName) LIKE :search\n            )\n            AND u NOT IN (\n                SELECT us FROM Claroline\\CoreBundle\\Entity\\User us\n                JOIN us.groups gr\n                WHERE gr.id = :groupId\n            )\n            AND u.isRemoved = false\n            ORDER BY u.{$orderedBy}\n        ";
     $search = strtoupper($search);
     $query = $this->_em->createQuery($dql);
     $query->setParameter('groupId', $group->getId());
     $query->setParameter('search', "%{$search}%");
     return $executeQuery ? $query->getResult() : $query;
 }
예제 #2
0
 public function findByGroupAndWorkspace(Group $group, Workspace $workspace)
 {
     $dql = "\n            SELECT r FROM Claroline\\CoreBundle\\Entity\\Role r\n            JOIN r.groups g\n            JOIN r.workspace w\n            WHERE g.id = :groupId AND w.id = :workspaceId\n            ";
     $query = $this->_em->createQuery($dql);
     $query->setParameter('groupId', $group->getId());
     $query->setParameter('workspaceId', $workspace->getId());
     return $query->getResult();
 }
예제 #3
0
 /**
  * @EXT\Route(
  *     "/form/group/{group}",
  *     name="claro_message_form_for_group"
  * )
  *
  * Displays the message form with the "to" field filled with users of a group.
  *
  * @param Group $group
  *
  * @return Response
  */
 public function formForGroupAction(Group $group)
 {
     $url = $this->router->generate('claro_message_show', ['message' => 0]) . '?grpsIds[]=' . $group->getId();
     return new RedirectResponse($url);
 }