Static class Fix

This commit is contained in:
JonatanRek
2020-04-21 19:44:30 +02:00
parent ba836c9573
commit ee65ea43c4
8 changed files with 66 additions and 66 deletions

View File

@@ -3,19 +3,19 @@ class DashboardManager{
public static $devices;
function getAllDashboards ($userId) {
static function getAllDashboards ($userId) {
return Db::loadAll ("SELECT * FROM dashboard WHERE user_id=?", array($userId));
}
function getAllSubDevices ($userId) {
static function getAllSubDevices ($userId) {
return Db::loadAll ("SELECT * FROM subdevices WHERE subdevice_id IN (SELECT subdevice_id FROM dashboard WHERE user_id=?)", array($userId));
}
function getSubDevice ($userId, $subDeviceId) {
static function getSubDevice ($userId, $subDeviceId) {
return Db::loadOne ("SELECT * FROM subdevices WHERE subdevice_id = (SELECT subdevice_id FROM dashboard WHERE user_id=? AND subdevice_id = ? )", array($userId, $subDeviceId));
}
function Add ($subDeviceId) {
static function Add ($subDeviceId) {
if (self::getSubDevice(UserManager::getUserData('user_id'), $subDeviceId) == null){
// to do: pokud existuje nepridej
@@ -34,7 +34,7 @@ class DashboardManager{
}
}
function Remove ($subDeviceId){
static function Remove ($subDeviceId){
$userId = UserManager::getUserData('user_id');
Db::command ('DELETE FROM dashboard WHERE subdevice_id=? AND user_id = ?', array ($subDeviceId, $userId));
}