Зимние правки. MVC/

Signed-off-by: lopar <lopar.4ever@gmail.com>
This commit is contained in:
lopar
2022-08-09 22:57:43 +03:00
parent 0f62ee20e7
commit b9b4c01cf0
104 changed files with 2254 additions and 2086 deletions
+14 -16
View File
@@ -6,32 +6,29 @@ use Battles\User;
require_once 'functions.php';
require_once 'classes/quests_class.php';
$qEndNow = $_GET['end_qst_now'] ?? null;
$qEnd = $_GET['end_qst'] ?? null;
if ($qEndNow) {
if (!empty($_GET['end_qst_now'])) {
$q->endq((int)$_GET['end_qst_now'], 'end', $user);
}
if ($qEnd) {
if (!empty($_GET['end_qst'])) {
$q->winqst((int)$_GET['end_qst'], $user);
}
$qsee = '';
$qx = 0;
$qsee = null;
$error = '';
$q = new Quests();
Template::header('module_quest');
?>
<link rel="stylesheet" href="css/hostel.css"/>
<?php
$sp = db::c()->query('SELECT `vars` FROM `actions` WHERE `vars` LIKE "?S" AND `vals` = "?s" AND `uid` = ?i LIMIT 100', "%start_quest%", "go", User::getInstance()->getId());
while ($pl = $sp->fetch_assoc()) {
$questId = str_replace('start_quest', '', $pl['vars']);
$pq = db::c()->query('SELECT `id`,`name`,`info` FROM `quests` WHERE `id` = ?i', $questId)->fetch_assoc();
$qsee .= sprintf('<a href="?end_qst_now=%s"><img src="/i/clear.gif" title="Отказаться от задания"></a> <b>%s</b><span style="float: right;"><a href="?end_qst=%s">Выполнить</a></span><div style="padding-left: 15px; padding-bottom: 5px; border-bottom: 1px solid grey;"><small>%s<br>$s</small></div><br>', $pq['id'], $pq['name'], $pq['id'], $pq['info'], $q->info($pq, User::getInstance()->getId()));
$qx++;
}
//$sp = \Battles\Database\Db::getInstance()->fetchall('select vars from actions where vars like ? and vals = ? and uid = ? limit 100', ['%start_quest%', 'go', User::getInstance()->getId()]);
//foreach ($sp as $row) {
// $questId = str_replace('start_quest', '', $pl['vars']);
// $pq = \Battles\Database\Db::getInstance()->fetch('select id, name, info from quests where is = ?', $questId);
// $qsee .= sprintf('<a href="?end_qst_now=%s"><img src="/i/clear.gif" title="Отказаться от задания"></a> <b>%s</b><span style="float: right;"><a href="?end_qst=%s">Выполнить</a></span><div style="padding-left: 15px; padding-bottom: 5px; border-bottom: 1px solid grey;"><small>%s<br>$s</small></div><br>', $pq['id'], $pq['name'], $pq['id'], $pq['info'], $q->info($pq, User::getInstance()->getId()));
//}
if (!$qsee) {
$qsee = 'У вас нет заданий.';
@@ -42,8 +39,9 @@ if ($q->error) {
?>
<div class="contentContainer">
<div style="text-align: center; padding-top: 3px;"><span
class="hs">Состояние персонажа, <?= $user['login']; ?></span></div>
<div style="text-align: center; padding-top: 3px;">
<span class="hs">Состояние персонажа, <?= User::getInstance()->getLogin() ?></span>
</div>
<div class="buttonContainer">
<input type="button" class="btns button-route" value="Вернуться" onclick="location.href='main.php';"/>
<input type="button" class="btns button-route" value="Обновить" onclick="location.href='module_quest.php';"/>