retrieve local users, groups and group members in a sorted way

This commit is contained in:
Arthur Schiwon 2014-08-29 15:17:37 +02:00
parent 033b0361ed
commit 0bb460c9b5
2 changed files with 4 additions and 4 deletions

View File

@ -168,7 +168,7 @@ class OC_Group_Database extends OC_Group_Backend {
* Returns a list with all groups * Returns a list with all groups
*/ */
public function getGroups($search = '', $limit = null, $offset = null) { public function getGroups($search = '', $limit = null, $offset = null) {
$stmt = OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` LIKE ?', $limit, $offset); $stmt = OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` LIKE ? ORDER BY `gid` ASC', $limit, $offset);
$result = $stmt->execute(array('%' . $search . '%')); $result = $stmt->execute(array('%' . $search . '%'));
$groups = array(); $groups = array();
while ($row = $result->fetchRow()) { while ($row = $result->fetchRow()) {
@ -200,7 +200,7 @@ class OC_Group_Database extends OC_Group_Backend {
* @return array an array of user ids * @return array an array of user ids
*/ */
public function usersInGroup($gid, $search = '', $limit = null, $offset = null) { public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
$stmt = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ?', $stmt = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ? ORDER BY `uid` ASC',
$limit, $limit,
$offset); $offset);
$result = $stmt->execute(array($gid, '%'.$search.'%')); $result = $stmt->execute(array($gid, '%'.$search.'%'));

View File

@ -157,7 +157,7 @@ class OC_User_Database extends OC_User_Backend {
$displayNames = array(); $displayNames = array();
$query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`' $query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`'
. ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR ' . ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR '
. 'LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); . 'LOWER(`uid`) LIKE LOWER(?) ORDER BY `uid` ASC', $limit, $offset);
$result = $query->execute(array('%' . $search . '%', '%' . $search . '%')); $result = $query->execute(array('%' . $search . '%', '%' . $search . '%'));
$users = array(); $users = array();
while ($row = $result->fetchRow()) { while ($row = $result->fetchRow()) {
@ -231,7 +231,7 @@ class OC_User_Database extends OC_User_Backend {
* Get a list of all users. * Get a list of all users.
*/ */
public function getUsers($search = '', $limit = null, $offset = null) { public function getUsers($search = '', $limit = null, $offset = null) {
$query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); $query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?) ORDER BY `uid` ASC', $limit, $offset);
$result = $query->execute(array('%' . $search . '%')); $result = $query->execute(array('%' . $search . '%'));
$users = array(); $users = array();
while ($row = $result->fetchRow()) { while ($row = $result->fetchRow()) {