Fixed
This commit is contained in:
parent
41916a90bd
commit
cb6ab3bdda
@ -1,9 +1,19 @@
|
||||
<?php
|
||||
class WidgetApi extends ApiController{
|
||||
public function check($subDeviceId){
|
||||
class UsersApi extends ApiController{
|
||||
public function default(){
|
||||
//$this->requireAuth();
|
||||
$response = null;
|
||||
|
||||
$users = UserManager::getUsers(["user_id", "username", "at_home"]);
|
||||
|
||||
foreach ($users as $key => $user) {
|
||||
$response[] = [
|
||||
"userName" => $users['username'],
|
||||
"homeStatus" => ($users['at_home']) ? true : false,
|
||||
"avatarUrl" => getAvatarUrl($value['user_id']),
|
||||
];
|
||||
}
|
||||
|
||||
$this->response($response);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Notification Manager
|
||||
*/
|
||||
//TODO: Working timestamp to body or $title
|
||||
//TODO: Working timestamp to $title
|
||||
class NotificationManager
|
||||
{
|
||||
function addSubscriber($userID = '', $token = ''){
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
class UserManager
|
||||
{
|
||||
public static function getUsers () {
|
||||
public static function getUsers ($filtr = ['*']) {
|
||||
try {
|
||||
$allUsers = Db::loadAll ("SELECT user_id, username, at_home, ota FROM users");
|
||||
$allUsers = Db::loadAll ("SELECT " . implode($filtr, ",") . " FROM users");
|
||||
return $allUsers;
|
||||
} catch(PDOException $error) {
|
||||
echo $error->getMessage();
|
||||
@ -32,8 +32,10 @@ class UserManager
|
||||
}
|
||||
|
||||
public static function getAvatarUrl($userId = null){
|
||||
if ($userId == null) {
|
||||
$email = self::getUserData('email');
|
||||
if ($userId != null){
|
||||
}
|
||||
else if ($userId != null){
|
||||
$email = self::getUserData('email',$userId);
|
||||
}
|
||||
return 'https://secure.gravatar.com/avatar/' . md5( strtolower( trim( $email ) ) );
|
||||
|
Loading…
Reference in New Issue
Block a user