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