Exercice page done with submission and confirmation
This commit is contained in:
parent
42c31a9315
commit
0f18ed8dcf
@ -50,7 +50,7 @@ else if ($n && $p[0] == SALT_USER)
|
|||||||
{
|
{
|
||||||
$connected = true;
|
$connected = true;
|
||||||
if ($n <= 1)
|
if ($n <= 1)
|
||||||
$page = require("team/home.php");
|
$page = require("team/home.php");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$TEAM = $p[1];
|
$TEAM = $p[1];
|
||||||
@ -70,6 +70,10 @@ else if ($n && $p[0] == SALT_USER)
|
|||||||
case "summary/":
|
case "summary/":
|
||||||
$page = require("team/summary.php");
|
$page = require("team/summary.php");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "confirmation":
|
||||||
|
$page = require("team/confirmation.php");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SALT/$team/$theme
|
// SALT/$team/$theme
|
||||||
@ -82,6 +86,11 @@ else if ($n && $p[0] == SALT_USER)
|
|||||||
$EXERCICE = $p[3];
|
$EXERCICE = $p[3];
|
||||||
$page = require("team/exercice.php");
|
$page = require("team/exercice.php");
|
||||||
}
|
}
|
||||||
|
else if ($n == 5)
|
||||||
|
{
|
||||||
|
if ($p[4] == "submission")
|
||||||
|
$page = require("team/submission.php");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class Exercice
|
|||||||
|
|
||||||
if (!empty($res))
|
if (!empty($res))
|
||||||
{
|
{
|
||||||
$this->files = $db->query("SELECT `id`, `path`, `name`
|
$this->files = $db->query("SELECT `id`, `path`, `name`, `sha1`
|
||||||
FROM exercice_files
|
FROM exercice_files
|
||||||
WHERE id_exercice = '$id'");
|
WHERE id_exercice = '$id'");
|
||||||
$this->keys = $db->query("SELECT `id`, `format`, `value`
|
$this->keys = $db->query("SELECT `id`, `format`, `value`
|
||||||
|
5
onyx/include/team/confirmation.php
Normal file
5
onyx/include/team/confirmation.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(!defined('ONYX')) exit;
|
||||||
|
|
||||||
|
return "teams/confirmation";
|
@ -15,7 +15,9 @@ try
|
|||||||
$solved = count($exercice->get_solved());
|
$solved = count($exercice->get_solved());
|
||||||
|
|
||||||
$template->assign("Exercice", $exercice);
|
$template->assign("Exercice", $exercice);
|
||||||
|
$template->assign("team", $TEAM);
|
||||||
$template->assign("solved", $solved);
|
$template->assign("solved", $solved);
|
||||||
|
$template->assign("files", $exercice->files);
|
||||||
|
|
||||||
return "teams/exercice";
|
return "teams/exercice";
|
||||||
}
|
}
|
||||||
|
11
onyx/include/team/submission.php
Normal file
11
onyx/include/team/submission.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(!defined('ONYX')) exit;
|
||||||
|
|
||||||
|
$file = ONYX . "../submission/".$p[1]."-".$p[2]."-".$p[3];
|
||||||
|
|
||||||
|
file_put_contents($file, $_POST['solution'], LOCK_EX);
|
||||||
|
|
||||||
|
header('Location: /connected/'.$p[1].'/confirmation');
|
||||||
|
|
||||||
|
exit;
|
12
onyx/tpl/bootstrap/teams/confirmation.tpl
Normal file
12
onyx/tpl/bootstrap/teams/confirmation.tpl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{extends file="layout-nav.tpl"}
|
||||||
|
|
||||||
|
{block name=head}
|
||||||
|
<link href="/css/common.css" rel="stylesheet">
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name=content}
|
||||||
|
<h1>
|
||||||
|
<!-- Add java script refresh ?-->
|
||||||
|
COMFIMATION PLEASE WAIT...
|
||||||
|
</h1>
|
||||||
|
{/block}
|
@ -15,9 +15,25 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Difficulté : {$Exercice->level}</li>
|
<li>Difficulté : {$Exercice->level}</li>
|
||||||
<li>Gain : {$Exercice->points}</li>
|
<li>Gain : {$Exercice->points}</li>
|
||||||
<!-- Dowloads files -->
|
{if isset($files)}
|
||||||
|
<li>Telechargement : </li>
|
||||||
|
{foreach from=$files item=file}
|
||||||
|
<div>
|
||||||
|
<a href="/{$file['path']}">{$file['name']}</a>
|
||||||
|
{$file['sha1']}
|
||||||
|
</div>
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
<li>Description : {$Exercice->statement}</li>
|
<li>Description : {$Exercice->statement}</li>
|
||||||
<!-- Input solution -->
|
|
||||||
<ul>
|
<!-- action a revoir -->
|
||||||
|
<form method="post" action="{$Exercice->id}/submission">
|
||||||
|
<p>
|
||||||
|
Soumettre la solution
|
||||||
|
<input type="text" name="solution" />
|
||||||
|
<input type="submit" value="Valider" />
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</ul>
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
|
Loading…
Reference in New Issue
Block a user