Plein de trucs fonctionnent maintenant
This commit is contained in:
parent
8758598104
commit
e3384eaa6b
@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS `exercice_files` (
|
||||
`id_exercice` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`path` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`sha1` binary(32) NOT NULL,
|
||||
`sha1` binary(20) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
|
||||
|
||||
|
@ -6,7 +6,7 @@ define("SALT_USER", "connected");
|
||||
define("SALT_ADMIN", "admin");
|
||||
|
||||
//On active le débogage si l'on est sur le domaine de debug
|
||||
if ($_SERVER["SERVER_NAME"] == "localhost" || $_SERVER["SERVER_NAME"] == "fic" || $_SERVER["SERVER_NAME"] == "atlantis.chen.li")
|
||||
if ($_SERVER["SERVER_NAME"] == "localhost" || $_SERVER["SERVER_NAME"] == "fic" || $_SERVER["SERVER_NAME"] == "fic.nemunai.re" || $_SERVER["SERVER_NAME"] == "atlantis.chen.li")
|
||||
define("DEBUG", true);
|
||||
|
||||
//Chargement de tout le nécessaire pour le site
|
||||
@ -50,10 +50,15 @@ else if ($n && $p[0] == SALT_USER)
|
||||
{
|
||||
$connected = true;
|
||||
if ($n <= 1)
|
||||
$page = require("team/home.php");
|
||||
{
|
||||
require("public/home.php");
|
||||
$page = "teams/list";
|
||||
}
|
||||
else
|
||||
{
|
||||
$TEAM = $p[1];
|
||||
$TEAM = new Team($p[1]);
|
||||
$template->assign("my_team", $TEAM);
|
||||
$template->assign("themes", Theme::get_themes());
|
||||
|
||||
if ($n <= 2)
|
||||
$page = require("team/team.php");
|
||||
@ -79,18 +84,38 @@ else if ($n && $p[0] == SALT_USER)
|
||||
// SALT/$team/$theme
|
||||
if (empty($page))
|
||||
{
|
||||
$THEME = $p[2];
|
||||
$tmp = explode("-", $p[2]);
|
||||
$id = intval($tmp[0]);
|
||||
$THEME = new Theme($id);
|
||||
unset($tmp, $id);
|
||||
$template->assign("cur_theme", $THEME);
|
||||
|
||||
if ($n == 4)
|
||||
if ($n == 4 || ($n == 5 && $p[4] == "submission"))
|
||||
$id_exo = $p[3];
|
||||
else if ($n == 3)
|
||||
{
|
||||
$EXERCICE = $p[3];
|
||||
foreach($THEME->get_exercicesOrdered() as $exo)
|
||||
{
|
||||
if (! $exo->has_solved($TEAM))
|
||||
break;
|
||||
}
|
||||
$id_exo = $exo->id;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$EXERCICE = new Exercice($id_exo, $THEME);
|
||||
$template->assign("cur_exercice", $EXERCICE);
|
||||
$page = require("team/exercice.php");
|
||||
}
|
||||
else if ($n == 5)
|
||||
{
|
||||
if ($p[4] == "submission")
|
||||
$page = require("team/submission.php");
|
||||
}
|
||||
catch(ExerciceNotFoundException $e)
|
||||
{
|
||||
$page = "404";
|
||||
}
|
||||
catch(InvalidThemeException $e)
|
||||
{
|
||||
$page = "404";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +135,7 @@ else
|
||||
}
|
||||
|
||||
// No page here...?
|
||||
if (empty($page))
|
||||
if (empty($page) || $page == "404" || ! file_exists(ONYX . "/tpl/bootstrap/".$page.".tpl"))
|
||||
{
|
||||
$template->assign("err", 404);
|
||||
$template->display("404.tpl");
|
||||
|
@ -1,6 +1,6 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80 ipv6only=on;
|
||||
listen [::]:80;
|
||||
server_name fic fic.p0m.fr fic.nemunai.re;
|
||||
|
||||
access_log /var/log/nginx/fic.access_log;
|
||||
@ -25,7 +25,7 @@ server {
|
||||
add_header Cache-Control public;
|
||||
}
|
||||
|
||||
location ~ ^/(img|cjs|ccss)/ {
|
||||
location ~ ^/(img|js|css)/ {
|
||||
access_log off;
|
||||
expires 7d;
|
||||
add_header Cache-Control public;
|
||||
|
@ -16,29 +16,41 @@ class Exercice
|
||||
var $files = array();
|
||||
var $keys = array();
|
||||
|
||||
function Exercice($id=null)
|
||||
function Exercice($id=null, $theme=null)
|
||||
{
|
||||
if (!empty($id))
|
||||
{
|
||||
$db = new BDD();
|
||||
// TODO escape id ?
|
||||
$res = $db->unique_query("SELECT `id`, `id_theme`, `require`, `level`, `points`, `statement`
|
||||
FROM exercices
|
||||
WHERE id= '$id'");
|
||||
$res = $db->unique_query("SELECT id, id_theme, `require`, level, points, statement FROM exercices WHERE id = '$id'");
|
||||
|
||||
if (!empty($res))
|
||||
{
|
||||
$this->files = $db->query("SELECT `id`, `path`, `name`, `sha1`
|
||||
FROM exercice_files
|
||||
WHERE id_exercice = '$id'");
|
||||
// Decode sha1
|
||||
if ($this->files)
|
||||
foreach($this->files as &$f)
|
||||
$f["sha1"] = strhex($f["sha1"]);
|
||||
|
||||
$this->keys = $db->query("SELECT `id`, `format`, `value`
|
||||
FROM exercice_keys
|
||||
WHERE id_exercice = '$id'");
|
||||
|
||||
$db->deconnexion();
|
||||
|
||||
if (!empty($theme))
|
||||
{
|
||||
if ($res['id_theme'] == $theme->get_id())
|
||||
$this->theme = $theme;
|
||||
else
|
||||
throw new InvalidThemeException();
|
||||
}
|
||||
else
|
||||
$this->theme = new Theme($res['id_theme']);
|
||||
|
||||
$this->id = $res['id'];
|
||||
$this->theme = new Theme($res['id_theme']);
|
||||
$this->require = $res['require'];
|
||||
$this->level = $res['level'];
|
||||
$this->points = $res['points'];
|
||||
@ -49,6 +61,7 @@ class Exercice
|
||||
else
|
||||
{
|
||||
$db->deconnexion();
|
||||
throw new ExerciceNotFoundException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,6 +71,11 @@ class Exercice
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
function get_name()
|
||||
{
|
||||
return "Exercice ".$this->number;
|
||||
}
|
||||
|
||||
// retourne le nombre d'equipes qui ont résolues l'exercice
|
||||
// trié par date
|
||||
function get_solved()
|
||||
@ -66,7 +84,7 @@ class Exercice
|
||||
|
||||
// TODO rename time by date in db ?
|
||||
$res = $db->query("SELECT `id_team`, `time` FROM solved
|
||||
WHERE id_exercice= '$this->id'
|
||||
WHERE id_exercice = '$this->id'
|
||||
ORDER BY time");
|
||||
|
||||
$db->deconnexion();
|
||||
@ -74,6 +92,23 @@ class Exercice
|
||||
return $res;
|
||||
}
|
||||
|
||||
function is_unlocked($team)
|
||||
{
|
||||
//TODO
|
||||
return mt_rand(0,1);
|
||||
}
|
||||
|
||||
function has_solved($team)
|
||||
{
|
||||
$db = new BDD();
|
||||
|
||||
$res = $db->unique_query("SELECT `time` FROM solved WHERE id_exercice = '$this->id' AND id_team = ".intval($team->get_id()));
|
||||
|
||||
$db->deconnexion();
|
||||
|
||||
return $res["time"];
|
||||
}
|
||||
|
||||
function set_number()
|
||||
{
|
||||
if ($this->require == "")
|
||||
@ -223,3 +258,11 @@ class Exercice
|
||||
return $res['max'];
|
||||
}
|
||||
}
|
||||
|
||||
class ExerciceNotFoundException extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
class InvalidThemeException extends Exception
|
||||
{
|
||||
}
|
@ -65,7 +65,7 @@ class Theme
|
||||
$db = new BDD();
|
||||
$res = $db->unique_query("SELECT count( id ) as nb_exercices FROM exercices
|
||||
WHERE id_theme = ".$this->id."
|
||||
GROUP BY id_theme");
|
||||
GROUP BY id_theme");
|
||||
$db->deconnexion();
|
||||
|
||||
return $res['nb_exercices'];
|
||||
@ -81,20 +81,6 @@ class Theme
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function get_themes()
|
||||
{
|
||||
$db = new BDD();
|
||||
$ids = $db->query("SELECT `id` FROM `themes`");
|
||||
$db->deconnexion();
|
||||
|
||||
$array = array();
|
||||
foreach ($ids as $id){
|
||||
$array[] = new Theme($id['id']);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
function get_exercicesOrdered()
|
||||
{
|
||||
$db = new BDD();
|
||||
@ -136,4 +122,18 @@ class Theme
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function get_themes()
|
||||
{
|
||||
$db = new BDD();
|
||||
$ids = $db->query("SELECT `id` FROM `themes`");
|
||||
$db->deconnexion();
|
||||
|
||||
$array = array();
|
||||
foreach ($ids as $id) {
|
||||
$array[] = new Theme($id['id']);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
@ -2,4 +2,9 @@
|
||||
|
||||
if(!defined('ONYX')) exit;
|
||||
|
||||
$page = "public/score";
|
||||
$template->assign("themes", Theme::get_themes());
|
||||
$template->assign("nbExoMax", Exercice::get_nbExoMax());
|
||||
|
||||
$template->assign("my_team", new TEAM($TEAM));
|
||||
|
||||
return "public/score";
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
if(!defined('ONYX')) exit;
|
||||
|
||||
return "teams/confirmation";
|
@ -2,35 +2,20 @@
|
||||
|
||||
if(!defined('ONYX')) exit;
|
||||
|
||||
try
|
||||
$solved = count($EXERCICE->get_solved());
|
||||
|
||||
if ($n == 5 && $p[4] == "submission")
|
||||
{
|
||||
$exercice = new Exercice($EXERCICE);
|
||||
$template->assign("ERRcolor", "success");
|
||||
$template->assign("ERRmessage", "Votre réponse a bien été prise en compte et sera évaluée dans quelques instants...");
|
||||
|
||||
//TOP10
|
||||
// $template->assign("top10", Team::get_top(10));
|
||||
//
|
||||
// //RANK
|
||||
// $template->assign("my_team", new Team($TEAM));
|
||||
//
|
||||
// //BEGIN LISTING THEMES
|
||||
// $template->assign("themes", Theme::get_themes());
|
||||
|
||||
if (!isset($exercice->id))
|
||||
return "404";
|
||||
|
||||
if (!isset($exercice->theme) || $exercice->theme->name != $THEME)
|
||||
return "404";
|
||||
|
||||
$solved = count($exercice->get_solved());
|
||||
|
||||
$template->assign("Exercice", $exercice);
|
||||
$template->assign("team", $TEAM);
|
||||
$template->assign("solved", $solved);
|
||||
$template->assign("files", $exercice->files);
|
||||
|
||||
return "teams/exercice";
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
return "404";
|
||||
if (!empty($_POST["solution"]))
|
||||
{
|
||||
header("Location: /".implode("/", $p));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign("solved", $solved);
|
||||
|
||||
return "teams/exercice";
|
||||
|
@ -2,12 +2,10 @@
|
||||
|
||||
if(!defined('ONYX')) exit;
|
||||
|
||||
$team = new Team($TEAM);
|
||||
//$solvedExercices = $team->get_solvedExercices();
|
||||
//$solvedExercices = $TEAM->get_solvedExercices();
|
||||
|
||||
$template->assign("themes", Theme::get_themes());
|
||||
$template->assign("nbExoMax", Exercice::get_nbExoMax());
|
||||
$template->assign("team", $team);
|
||||
//$template->assign("solvedExercices", $solvedExercices);
|
||||
|
||||
return "teams/summary";
|
||||
|
@ -2,15 +2,4 @@
|
||||
|
||||
if(!defined('ONYX')) exit;
|
||||
|
||||
try
|
||||
{
|
||||
$team = new Team($TEAM);
|
||||
|
||||
$template->assign("team", $team);
|
||||
|
||||
return "teams/team";
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
return "404";
|
||||
}
|
||||
return "teams/team";
|
||||
|
@ -1,34 +0,0 @@
|
||||
{extends file="layout.tpl"}
|
||||
{block name=body}
|
||||
<!-- TODO: message dans lang-->
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/{$SALT_USER}/">FIC</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/{$SALT_USER}/themes">Thèmes</a></li>
|
||||
<li><a href="/{$SALT_USER}/scores">Scores</a></li>
|
||||
<li><a href="/{$SALT_USER}/me">Ma team</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $ERRmessage}
|
||||
<div class="alert alert-{$ERRcolor}">
|
||||
<button class="close" data-dismiss="alert">×</button>
|
||||
<i class="icon-warning-sign"></i> {$ERRmessage}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="container">
|
||||
{block name=content}{/block}
|
||||
</div>
|
||||
{/block}
|
@ -5,130 +5,5 @@
|
||||
{/block}
|
||||
|
||||
{block name=content}
|
||||
|
||||
<div class="clock">
|
||||
<div id="Date"></div>
|
||||
<ul>
|
||||
<li id="hours">00</li>
|
||||
<li id="point">:</li>
|
||||
<li id="min">00</li>
|
||||
<li id="point">:</li>
|
||||
<li id="sec">00</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<h3>TOP #10</h3>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>a</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>b</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td>c</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>4</td>
|
||||
<td>d</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>5</td>
|
||||
<td>e</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>6</td>
|
||||
<td>f</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>7</td>
|
||||
<td>g</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td>h</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>9</td>
|
||||
<td>i</td>
|
||||
</td>
|
||||
<tr>
|
||||
<td>10</td>
|
||||
<td>j</td>
|
||||
</td>
|
||||
</table>
|
||||
</div>
|
||||
<!-- example -->
|
||||
<div class="col-md-10">
|
||||
<div class="jumbotron">
|
||||
<h1>Example</h1>
|
||||
<p><div id="test">This is a example</div></p>
|
||||
<p>This is a example</p>
|
||||
<p>This is a example</p>
|
||||
<p>This is a example</p>
|
||||
<p>This is a example</p>
|
||||
<p>This is a example</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="carousel-team" class="carousel slide">
|
||||
<div class="carousel-inner">
|
||||
<div class="item active">
|
||||
<div class="well">
|
||||
<center><h1>Team Alpha</h1></center>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="well">
|
||||
<center><h1>Team Beta</h1></center>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="well">
|
||||
<center><h1>Team Gamma</h1></center>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="well">
|
||||
<center><h1>Team Delta</h1></center>
|
||||
</div>
|
||||
<!--div class="carousel-caption">
|
||||
<p>#</p>
|
||||
<p><a href="#">#</a></p>
|
||||
</div-->
|
||||
</div>
|
||||
</div><!-- .carousel-inner -->
|
||||
<!-- next and previous controls here
|
||||
href values must reference the id for this carousel -->
|
||||
<!--a class="carousel-control left" href="#carousel-team" data-slide="prev">‹</a>
|
||||
<a class="carousel-control right" href="#carousel-team" data-slide="next">›</a-->
|
||||
</div><!-- .carousel -->
|
||||
|
||||
{/block}
|
||||
{block name=end}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var time = {$END};
|
||||
$('#carousel-team').carousel({
|
||||
interval: 2000 });
|
||||
|
||||
setInterval( function() {
|
||||
var heure = Math.floor(time / 3600);
|
||||
var min = Math.floor((time / 60) % 60);
|
||||
var sec = Math.floor(time % 60);
|
||||
$("#hours").html(( heure < 10 ? "0" : "" ) + heure);
|
||||
$("#min").html(( min < 10 ? "0" : "" ) + min);
|
||||
$("#sec").html(( sec < 10 ? "0" : "" ) + sec);
|
||||
time--;
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{include file="summary.tpl"}
|
||||
{/block}
|
||||
|
41
onyx/tpl/bootstrap/summary.tpl
Normal file
41
onyx/tpl/bootstrap/summary.tpl
Normal file
@ -0,0 +1,41 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
{for $i=1 to $nbExoMax}
|
||||
<th>Exercice {$i}</th>
|
||||
{/for}
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{$total=0}
|
||||
{foreach from=$themes item=theme}
|
||||
<tr>
|
||||
<th>{$theme->get_name()}</th>
|
||||
{$sum=0}
|
||||
{$themeID=$theme->get_id()}
|
||||
{$solvedExercices=$my_team->get_solvedExercices($themeID)} {*TODO: This line give a Warning*}
|
||||
{foreach from=$theme->get_exercicesOrdered() item=exo}
|
||||
{$pts=0}
|
||||
{for $i=0 to $nbExoMax}
|
||||
{if !empty($solvedExercices.$i)}
|
||||
{if $solvedExercices.$i->get_id() == $exo->get_id()}
|
||||
{$pts=$solvedExercices.$i->points}{$sum=$sum + $pts}
|
||||
{/if}
|
||||
{/if}
|
||||
{/for}
|
||||
<td>{$pts}</td>
|
||||
{/foreach}
|
||||
<th>{$sum}</th>
|
||||
</tr>
|
||||
{$total=$total+$sum}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="{$nbExoMax+1}" style="text-align: right">Total :</th>
|
||||
<th>{$total}</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
@ -1,12 +0,0 @@
|
||||
{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}
|
@ -1,55 +1,73 @@
|
||||
{extends file="layout-nav.tpl"}
|
||||
{extends file="teams/theme.tpl"}
|
||||
|
||||
{block name=head}
|
||||
<link href="/css/common.css" rel="stylesheet">
|
||||
{/block}
|
||||
|
||||
{block name=content}
|
||||
<div>
|
||||
|
||||
{if $solved < 1}
|
||||
<h1>Exercice {$Exercice->number} - {$solved} équipe a résolu cet exercice</h1>
|
||||
{else}
|
||||
<h1>Exercice {$Exercice->number} - {$solved} équipes ont résolu cet exercice</h1>
|
||||
{/if}
|
||||
<ul>
|
||||
<li>Difficulté : {$Exercice->level}</li>
|
||||
<li>Gain : {$Exercice->points}</li>
|
||||
{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>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<ol>
|
||||
{foreach from=$top10 item=team key=pos}
|
||||
<li>{$team->get_name()} <small>({$team->get_pts()})</small></li>
|
||||
{/foreach}
|
||||
</ol>
|
||||
|
||||
<div id="my_team">
|
||||
{$my_team->get_rank(10)}/{Team::get_nbTeams()}
|
||||
{block name=exercices}
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Exercice {$cur_exercice->number} <small>{$solved} équipe{if $solved > 1}s{/if} a résolu cet exercice</small></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul>
|
||||
<li><strong>Difficulté :</strong> {$cur_exercice->level}</li>
|
||||
<li><strong>Gain :</strong> {$cur_exercice->points}</li>
|
||||
<li><strong>Description :</strong> {$cur_exercice->statement}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="theme_list">
|
||||
{foreach from=$themes item=theme key=k}
|
||||
<strong>{$theme->get_name()}</strong><br>
|
||||
{$my_team->get_nbResExercisesByTheme($theme->get_id())}/{$theme->get_nbExercices()}<br>
|
||||
{/foreach}
|
||||
{if $cur_exercice->files}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Téléchargements</h3>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Nom</th>
|
||||
<th>SHA1</th>
|
||||
<th>Taille</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$cur_exercice->files item=file}
|
||||
{if file_exists($file['path'])}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/{$file['path']}">
|
||||
<span class="glyphicon glyphicon-download"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td>{$file['name']}</td>
|
||||
<td>{$file['sha1']}</td>
|
||||
<td>{filesize($file['path'])}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Soumettre une solution</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{if $cur_exercice->has_solved($my_team)}
|
||||
Déjà résolu à {$cur_exercice->has_solved($my_team)|date_format:"%H:%M:%S"} :)
|
||||
{else}
|
||||
<form role="form" method="post" action="/{$SALT_USER}/{$my_team->get_id()}/{$cur_theme->get_id()}-{$cur_theme->get_name()}/{$cur_exercice->id}/submission">
|
||||
<div class="form-group">
|
||||
<label for="solution">Soumettre la solution :</label>
|
||||
<input type="text" class="form-control" id="solution" name="solution">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">Soumettre</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{extends file="layout-nav.tpl"}
|
||||
{extends file="teams/layout.tpl"}
|
||||
|
||||
{block name=head}
|
||||
<link href="/css/common.css" rel="stylesheet">
|
||||
|
63
onyx/tpl/bootstrap/teams/layout.tpl
Normal file
63
onyx/tpl/bootstrap/teams/layout.tpl
Normal file
@ -0,0 +1,63 @@
|
||||
{extends file="layout.tpl"}
|
||||
|
||||
{block name=body}
|
||||
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/{$SALT_USER}/{$my_team->get_id()}">FIC</a>
|
||||
</div>
|
||||
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="/{$SALT_USER}/{$my_team->get_id()}/themes">Thèmes</a></li>
|
||||
<li><a href="/{$SALT_USER}/{$my_team->get_id()}/scores">Scores</a></li>
|
||||
<li><a href="/{$SALT_USER}/{$my_team->get_id()}/me">Ma team</a></li>
|
||||
</ul>
|
||||
|
||||
<p class="navbar-right navbar-text">01:23:42</p>
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</nav>
|
||||
|
||||
<div class="container" style="margin-top: 25px">
|
||||
|
||||
{if $ERRmessage}
|
||||
<div class="alert alert-{$ERRcolor}">
|
||||
<button class="close" data-dismiss="alert">×</button>
|
||||
<i class="icon-warning-sign"></i> {$ERRmessage}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<aside>
|
||||
<p>
|
||||
<span style="font-weight: bolder;">{$my_team->get_name()}<a class="badge pull-right" href="/{$SALT_USER}/{$my_team->get_id()}/me">Modifier</a></span>
|
||||
<em>{$my_team->get_slogan()}</em>
|
||||
</p>
|
||||
<p>
|
||||
{$my_team->get_pts()} points<a class="badge pull-right" href="/{$SALT_USER}/{$my_team->get_id()}/summary">Synthèse</a><br>
|
||||
{$my_team->get_rank()}<sup>e</sup> sur {Team::get_nbTeams()}
|
||||
</p>
|
||||
</aside>
|
||||
|
||||
<div class="list-group">
|
||||
{foreach from=$themes item=t key=k}
|
||||
<a class="list-group-item" href="/{$SALT_USER}/{$my_team->get_id()}/{$t->get_id()}-{$t->get_name()}">
|
||||
<span class="badge">{$my_team->get_nbResExercisesByTheme($t->get_id())}/{$t->get_nbExercices()}</span>
|
||||
{$t->get_name()}
|
||||
</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-10">
|
||||
{block name=content}{/block}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
9
onyx/tpl/bootstrap/teams/list.tpl
Normal file
9
onyx/tpl/bootstrap/teams/list.tpl
Normal file
@ -0,0 +1,9 @@
|
||||
{extends file="layout.tpl"}
|
||||
{block name=body}
|
||||
<h3>Choisissez la team que vous voulez représenter :</h3>
|
||||
{foreach from=$teams item=i}
|
||||
<ul>
|
||||
<li><a href="/{$SALT_USER}/{$i->id}/">{$i->team_name}</a></li>
|
||||
</ul>
|
||||
{/foreach}
|
||||
{/block}
|
@ -1,4 +1,4 @@
|
||||
{extends file="layout-nav.tpl"}
|
||||
{extends file="teams/layout.tpl"}
|
||||
|
||||
{block name=head}
|
||||
<link href="/css/common.css" rel="stylesheet">
|
||||
|
@ -1,54 +1,9 @@
|
||||
{extends file="layout-nav.tpl"}
|
||||
{extends file="teams/layout.tpl"}
|
||||
|
||||
{block name=head}
|
||||
<link href="/css/common.css" rel="stylesheet">
|
||||
{/block}
|
||||
|
||||
{block name=content}
|
||||
<h1>
|
||||
THIS IS SUMMARY
|
||||
</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
{for $i=1 to $nbExoMax}
|
||||
<th>exo{$i}</th>
|
||||
{/for}
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{$total=0}
|
||||
{foreach from=$themes item=theme}
|
||||
<tr>
|
||||
<th>{$theme->get_name()}</th>
|
||||
{$sum=0}
|
||||
{$themeID=$theme->get_id()}
|
||||
{$solvedExercices=$team->get_solvedExercices($themeID)} {*TODO: This line give a Warning*}
|
||||
{foreach from=$theme->get_exercicesOrdered() item=exo}
|
||||
{$pts=0}
|
||||
{for $i=0 to $nbExoMax}
|
||||
{if !empty($solvedExercices.$i)}
|
||||
{if $solvedExercices.$i->get_id() == $exo->get_id()}
|
||||
{$pts=$solvedExercices.$i->points}{$sum=$sum + $pts}
|
||||
{/if}
|
||||
{/if}
|
||||
{/for}
|
||||
<td>{$pts}</td>
|
||||
{/foreach}
|
||||
<td>{$sum}</td>
|
||||
</tr>
|
||||
{$total=$total+$sum}
|
||||
{/foreach}
|
||||
<tr>
|
||||
{for $i=1 to $nbExoMax}
|
||||
<td></td>
|
||||
{/for}
|
||||
<td>Total :</td>
|
||||
<td>{$total}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{include file="summary.tpl"}
|
||||
{/block}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{extends file="layout-nav.tpl"}
|
||||
{extends file="teams/layout.tpl"}
|
||||
|
||||
{block name=head}
|
||||
<link href="/css/common.css" rel="stylesheet">
|
||||
|
14
onyx/tpl/bootstrap/teams/theme.tpl
Normal file
14
onyx/tpl/bootstrap/teams/theme.tpl
Normal file
@ -0,0 +1,14 @@
|
||||
{extends file="teams/layout.tpl"}
|
||||
|
||||
{block name=content}
|
||||
<div class="jumbotron">
|
||||
<h3 style="font-variant: small-caps">{$cur_theme->get_name()}</h3>
|
||||
<p>
|
||||
{foreach from=$cur_theme->get_exercicesOrdered() item=exercice}
|
||||
<a class="btn btn-{if $exercice->has_solved($my_team)}success{elseif $exercice->is_unlocked($my_team)}primary{else}danger{/if}" role="button" href="/{$SALT_USER}/{$my_team->get_id()}/{$cur_theme->get_id()}-{$cur_theme->get_name()}/{$exercice->get_id()}">{$exercice->get_name()}</a>
|
||||
{/foreach}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{block name=exercices}{/block}
|
||||
{/block}
|
Loading…
Reference in New Issue
Block a user