Пример #1
0
 static function getFirstRacine($_userOwnerID)
 {
     $containerID = self::getRacinesContainersId($_userOwnerID);
     $containerID = $containerID[0][0];
     return Db::query("SELECT * FROM Objects WHERE ObjectContainer=? LIMIT 1", $containerID);
 }
Пример #2
0
 static function getContactsByUser($_userId)
 {
     return Db::query("SELECT *\n        FROM Contacts\n        WHERE ContactUser = ?", $_userId);
 }
Пример #3
0
 static function deleteUser($_userId)
 {
     $infoId = Db::queryFirst("SELECT UserInfo\n                                        FROM Users\n                                        WHERE UserId = ?", $_userId);
     if (self::isUserFamilyOwner($_userId)) {
         $childs = Db::query("SELECT UserID\n                                        FROM users INNER JOIN userinfos ON UserInfo = userinfos.UserInfoId\n                                        WHERE UserInfoFamilyOwner = ?", $_userId);
         foreach ($childs as $child) {
             Db::execute("DELETE FROM Users\n                          WHERE UserId = ?", $child[0]);
         }
         Db::execute("UPDATE userinfos\n                                SET UserInfoFamilyOwner = 1\n                                WHERE UserInfoId = ?", $infoId[0]);
     }
     Db::execute("DELETE FROM Users\n                                WHERE UserId = ?", $_userId);
     Db::execute("DELETE FROM UserInfos\n                                WHERE UserInfoId = ?", $infoId[0]);
 }