is this gonna work?
This commit is contained in:
parent
3b6c92b0c6
commit
906e85afe3
2 changed files with 48 additions and 3 deletions
|
@ -15,7 +15,7 @@ class Users {
|
|||
|
||||
}
|
||||
|
||||
// Get user
|
||||
// Get user data by id
|
||||
public static function getUser($id) {
|
||||
|
||||
// Execute query
|
||||
|
@ -30,4 +30,49 @@ class Users {
|
|||
|
||||
}
|
||||
|
||||
// Get group data by id
|
||||
public static function getGroup($id) {
|
||||
|
||||
// Execute query
|
||||
$group = Database::fetch('groups', false, ['id' => [$id, '=']]);
|
||||
|
||||
// Return false if no group was found
|
||||
if(empty($group))
|
||||
return false;
|
||||
|
||||
// If group was found return group data
|
||||
return $group;
|
||||
|
||||
}
|
||||
|
||||
// Get all users
|
||||
public static function getAllUsers() {
|
||||
|
||||
// Execute query
|
||||
$getUsers = Database::fetch('users', true);
|
||||
|
||||
// Reorder shit
|
||||
foreach($getUsers as $user)
|
||||
$users[$user['id']] = $user;
|
||||
|
||||
// and return an array with the users
|
||||
return $users;
|
||||
|
||||
}
|
||||
|
||||
// Get all users
|
||||
public static function getAllGroups() {
|
||||
|
||||
// Execute query
|
||||
$getGroups = Database::fetch('groups', true);
|
||||
|
||||
// Reorder shit
|
||||
foreach($getGroups as $group)
|
||||
$groups[$group['id']] = $group;
|
||||
|
||||
// and return an array with the users
|
||||
return $groups;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,6 @@ $renderData = array(
|
|||
'user' => [
|
||||
'loggedin' => Users::loggedIn()
|
||||
],
|
||||
'users' => \create_function('$uid', 'return Users::getUser($uid);')//,
|
||||
//'groups' => Users::getGroup($gid)
|
||||
'users' => Users::getAllUsers(),
|
||||
'groups' => Users::getAllGroups()
|
||||
);
|
||||
|
|
Reference in a new issue