Administration: can edit exercices

This commit is contained in:
nemunaire 2014-01-14 16:14:31 +01:00
commit aeb4b5dd52
9 changed files with 138 additions and 31 deletions

View file

@ -102,6 +102,11 @@ class Exercice
return "Exercice ".$this->number;
}
function get_statement()
{
return $this->statement;
}
// retourne le nombre d'equipes qui ont résolues l'exercice
// trié par date
function get_solved()
@ -177,7 +182,7 @@ class Exercice
$db->deconnexion();
}
function update($create)
function update($create=false)
{
$id = $this->id;
$theme = intval($this->theme->get_id());
@ -202,7 +207,7 @@ class Exercice
else
{
$db->query("UPDATE exercices
SET `theme` = '".$theme."', `require` = '".$require."', `level` = '".$level."', `point` = '".$point."', `statement` = '".$statement."'
SET `id_theme` = '".$theme."', `require` = '".$require."', `level` = '".$level."', `points` = '".$points."', `statement` = '".$statement."'
WHERE id = '$id'");
$aff = $db->affected();
@ -276,9 +281,16 @@ class Exercice
function add_key($format, $value)
{
$this->keys[] = array(
"format" => $format,
"value" => $value
if ($format == "raw")
{
$this->add_key("sha1", hash("sha1", $value));
$this->add_key("sha512", hash("sha512", $value));
$this->add_key("md5", hash("md5", $value));
}
else
$this->keys[] = array(
"format" => $format,
"value" => $value
);
}