Browse Source

Minor fixes

Julio Montoya 11 years ago
parent
commit
371e73d1d5

+ 24 - 0
main/inc/Entity/Repository/UserRepository.php

@@ -15,6 +15,30 @@ use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
  */
 class UserRepository extends EntityRepository implements UserProviderInterface
 {
+    /**
+     * @param string $keyword
+     * @return mixed
+     */
+    public function searchUserByKeyword($keyword)
+    {
+        $qb = $this->createQueryBuilder('a');
+
+        //Selecting user info
+        $qb->select('DISTINCT b');
+
+        $qb->from('Entity\User', 'b');
+
+        //Selecting courses for users
+        //$qb->innerJoin('u.courses', 'c');
+
+        //@todo check app settings
+        $qb->add('orderBy', 'b.firstname ASC');
+        $qb->where('b.firstname LIKE :keyword OR b.lastname LIKE :keyword ');
+        $qb->setParameter('keyword', "%$keyword%");
+        $q = $qb->getQuery();
+
+        return $q->execute();
+    }
 
     /**
      * @param string $username

+ 1 - 0
main/inc/lib/formvalidator/Element/tbl_change.js.php

@@ -1,5 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
+// Fixes error that shows the header and footer.
 $app['default_layout'] = $app['template_style'].'/layout/blank.tpl';
 
 ?>

+ 1 - 1
src/ChamiloLMS/Component/Auth/LoginSuccessHandler.php

@@ -44,8 +44,8 @@ class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
         $user = $token->getUser();
         $userId = $user->getUserId();
 
+        $url = null;
         if ($this->security->isGranted('ROLE_STUDENT') && !empty($pageAfterLogin)) {
-            $url = null;
             switch($pageAfterLogin) {
                 case 'index.php':
                     $url = $this->router->generate('index');