Пример #1
0
require_once __ROOT__ . 'models/GameItems.class.php';
require_once __ROOT__ . 'models/GameItemLanguage.class.php';
require_once __ROOT__ . 'models/GameItemCategory.class.php';
require_once __ROOT__ . 'models/GameItemCategoryLanguage.class.php';
$result = new FunctionResult();
$result->success = false;
if (isset($_POST["sessionId"]) && !empty($_POST["sessionId"])) {
    session_id($_POST["sessionId"]);
} else {
    if (isset($_GET["sessionId"]) && !empty($_GET["sessionId"])) {
        session_id($_GET["sessionId"]);
    }
}
session_start();
session_write_close();
try {
    $resp = GameItemCategory::getGameCategoryItemWithLanguage();
    if (!empty($resp)) {
        foreach ($resp as $cat) {
            $cat->getCateoryItems();
        }
    }
    $result->result = new stdClass();
    $result->result->categories = $resp;
    $result->success = true;
} catch (Exception $exc) {
    $result->success = false;
    $result->result = $exc->getTraceAsString();
}
echo json_encode($result);
exit(1);
 /**
  * get single GameItemCategory instance from a DOMElement
  *
  * @param DOMElement $node
  * @return GameItemCategory
  */
 public static function fromDOMElement(DOMElement $node)
 {
     $o = new GameItemCategory();
     $o->assignByHash(self::domNodeToHash($node, self::$FIELD_NAMES, self::$DEFAULT_VALUES, self::$FIELD_TYPES));
     $o->notifyPristine();
     return $o;
 }