Exemplo n.º 1
0
 function objects()
 {
     if (isset($_POST["Token"]) && isset($_POST["ObjectId"]) && $_POST["Token"] != null) {
         $userId = Users::getUserIdByMobileToken($_POST["Token"]);
         if ($userId != -1) {
             if ($_POST["ObjectId"] == null) {
                 $object = new stdClass();
                 $object->CurrentObject = null;
                 $object->ParentObject = null;
                 $object->ChildObjects = Objects::getAllVisibleObjectsInContainer(null, $userId);
                 echo JSON_ENCODE($object);
             } else {
                 $object = new stdClass();
                 $object->CurrentObject = Objects::getObject($_POST["ObjectId"]);
                 $object->ParentObject = $object->CurrentObject["ObjectContainer"] == null ? null : Objects::getObject($object->CurrentObject["ObjectContainer"]);
                 $object->ChildObjects = Objects::getAllVisibleObjectsInContainer($_POST["ObjectId"], $userId);
                 echo JSON_ENCODE($object);
             }
         }
     }
 }