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

@ -2,6 +2,8 @@
if(!defined('ONYX')) exit;
$template->assign("fortyp", array("raw" => "RAW", "sha1" => "SHA-1", "md5" => "MD5", "sha224" => "SHA-224", "sha256" => "SHA-256", "sha384" => "SHA-384", "sha512" => "SHA-512"));
$p = $out[0];
//TODO maybe move the try catch to index.html ?
@ -18,7 +20,28 @@ try
}
if (isset($p[3]))
$template->assign("ex", new Exercice($p[3], $theme));
{
$exercice = new Exercice($p[3], $theme);
if (!empty($_POST))
{
$exercice->points = intval($_POST["points"]);
$exercice->statement = $_POST["desc"];
$exercice->require = $_POST["require"];
$exercice->level = intval($_POST["level"]);
$exercice->keys = array();
foreach ($_POST as $k => $key)
{
if (preg_match("/k([0-9]+)_value/", $k, $out) && !empty($key) && !empty($_POST["k".$out[1]."_type"]))
$exercice->add_key($_POST["k".$out[1]."_type"], $key);
}
//$exercice->update();
}
$template->assign("ex", $exercice);
}
}
catch (ThemeNotFoundException $e)
{