124 lines
3.1 KiB
PHP
124 lines
3.1 KiB
PHP
<?php
|
|
|
|
|
|
$number_pending = 0;
|
|
|
|
|
|
|
|
$sql = "SELECT `value`,`id` FROM `VokabelBox2Content` WHERE `type` = 'voc' AND `path` = '$userid/lang/$list/'";
|
|
$result_articles = $conn->query($sql);
|
|
if(mysqli_num_rows($result_articles))
|
|
{
|
|
|
|
while ($articleDb = mysqli_fetch_object($result_articles))
|
|
{
|
|
|
|
|
|
$voc = json_decode($articleDb->value, true);
|
|
$id = $articleDb->id;
|
|
|
|
if($voc[0]['activeLearn'] == 'true') {
|
|
$number_pending++;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$n = '"activeLearn":"true"';
|
|
|
|
$sql = "SELECT `value`,`id` FROM `VokabelBox2Content` WHERE `type` = 'voc' AND `path` = '$userid/lang/$list/' AND `value` LIKE '%$n%' ORDER BY RAND() LIMIT 1";
|
|
$result_articles = $conn->query($sql);
|
|
if(mysqli_num_rows($result_articles))
|
|
{
|
|
|
|
while ($articleDb = mysqli_fetch_object($result_articles))
|
|
{
|
|
|
|
$voc = json_decode($articleDb->value, true);
|
|
$_SESSION["active-voc"] = $articleDb->id;
|
|
|
|
$question = $voc[0]['1'];
|
|
$answer = $voc[0]['2'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($_SESSION["difficulty"] == '1') {
|
|
|
|
?>
|
|
<div class="fixed-title">
|
|
<div class="left">
|
|
<h2 id="learn-progress">1/<?php echo $number_pending; ?></h2>
|
|
</div>
|
|
<div class="progress-bar">
|
|
<div style="width: 0%"></div>
|
|
</div>
|
|
<div class="right">
|
|
<h2 id="learn-correct-incorrect"><span>0</span> <span>0</span></h2>
|
|
</div>
|
|
</div>
|
|
<div class="center-wrapper">
|
|
<div class="center">
|
|
<img class="learn-feedback-ghost" src="" />
|
|
<h2 id="learn-voc-question"><?php echo $question; ?></h2>
|
|
<h5 id="learn-voc-correct" style="display: none;"><?php echo $answer; ?></h5>
|
|
<br>
|
|
<div class="form" id="learn-form">
|
|
<button onclick="showHint()" class="default-button">Lösung zeigen</button>
|
|
</div>
|
|
<div class="folder-view-wrapper">
|
|
<div class="learn-card-choicebox" style="display: none;">
|
|
<div onclick="getContent('action:learn','false')">
|
|
<img src="files/red-x.svg" />
|
|
<h2>Falsch</h2>
|
|
</div>
|
|
<div onclick="getContent('action:learn','true')">
|
|
<img src="files/green-checkmark.svg" />
|
|
<h2>Richtig</h2>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
|
|
}
|
|
else {
|
|
|
|
|
|
?>
|
|
|
|
<div class="fixed-title">
|
|
<div class="left">
|
|
<h2 id="learn-progress">1/<?php echo $number_pending; ?></h2>
|
|
</div>
|
|
<div class="progress-bar">
|
|
<div style="width: 0%"></div>
|
|
</div>
|
|
<div class="right">
|
|
<h2 id="learn-correct-incorrect"><span>0</span> <span>0</span></h2>
|
|
</div>
|
|
</div>
|
|
<div class="center-wrapper">
|
|
<div class="center">
|
|
<img class="learn-feedback-ghost" src="" />
|
|
<h2 id="learn-voc-question"><?php echo $question; ?></h2>
|
|
<h5 id="learn-voc-correct"></h5>
|
|
<form id="learn-form" class="form" autocomplete="off" onsubmit="return getContent('action:learn','','');">
|
|
<div class="input-wrapper">
|
|
<input required autocomplete="off" type="text" id="learn-suggestion" oninput="checkIfFilled('learn-suggestion')" />
|
|
<span>Übersetzung</span>
|
|
</div>
|
|
<p align="center">Bestätigen Sie mit "Enter"</p>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|