} else { if (isset($_POST[$str]) && $_POST[$str] != null) { $val = $_POST[$str]; } } return $val; } $errorHTML = ""; $edit = false; $bot = GameBots::create()->setId(-1); $user = GameUsers::create()->setUserId(-1); $defaultUserName = ""; //edit için id gelirse bot ordan kopyala $tmp = getURLParam("id"); if (!empty($tmp)) { $bot = GameBots::getBotById($tmp); if (empty($bot)) { $bot = GameBots::create()->setId(-1); } else { $user = $bot->user; $defaultUserName = $user->userName; $edit = true; } } //formdan data gelmişse onları ata ve kaydet $tmp = getURLParam("form_"); if (!empty($tmp)) { $bot->setActive(getURLParam("active", 0)); $bot->setRoomGroupId(getURLParam("roomGroupId", -1)); $bot->setWeightBar(getURLParam("weight_bar", -1)); $bot->setWeightBlocked(getURLParam("weight_blocked", -1));
$tag = $_GET["tag"]; $orderStr = $tag . " " . $orderBy; $botList = GameBots::getBotsList(($pageNumber - 1) * 100, 100, $orderStr); if ($orderBy == "DESC") { $orderBy = "ASC"; } else { $orderBy = "DESC"; } } else { if ($action == "activate" || $action == "deactivate") { $value = $action == "activate" ? 1 : 0; $id = -1; if (isset($_GET["id"])) { $id = $_GET["id"]; } $_user = GameBots::getBotById($id); if (!empty($_user)) { $_user->setActive($value); $_user->updateToDatabase(DBUtils::getConnection()); } $botList = GameBots::getBotsList(($pageNumber - 1) * 100, 100); } } } } else { $botList = GameBots::getBotsList(($pageNumber - 1) * 100, 100); if (sizeof($botList) == 0) { $pageNumber = $pageNumber - 1; $botList = GameBots::getBotsList(($pageNumber - 1) * 100, 100); } }