Store exercice title XML in DB
This commit is contained in:
parent
3f773dffb0
commit
b81af5aa90
10 changed files with 69 additions and 55 deletions
|
|
@ -10,6 +10,7 @@ class Exercice
|
|||
var $require;
|
||||
var $level;
|
||||
var $points;
|
||||
var $title;
|
||||
var $statement;
|
||||
var $files = array();
|
||||
var $keys = array();
|
||||
|
|
@ -24,7 +25,7 @@ class Exercice
|
|||
|
||||
$db->escape($id);
|
||||
$res = $db->unique_query("SELECT `id`, `id_theme`, `require`, `level`,
|
||||
`points`, `statement`
|
||||
`points`, `title`, `statement`
|
||||
FROM exercices WHERE id = '$id'");
|
||||
|
||||
if (!empty($res))
|
||||
|
|
@ -64,6 +65,7 @@ class Exercice
|
|||
$this->require = $res['require'];
|
||||
$this->level = $res['level'];
|
||||
$this->points = $res['points'];
|
||||
$this->title = $res['title'];
|
||||
$this->statement = $res['statement'];
|
||||
|
||||
$this->set_number();
|
||||
|
|
@ -86,6 +88,7 @@ class Exercice
|
|||
$tmp->require = $array["require"];
|
||||
$tmp->level = $array["level"];
|
||||
$tmp->points = $array["points"];
|
||||
$tmp->title = $array["title"];
|
||||
$tmp->statement = $array["statement"];
|
||||
$tmp->files = $array["files"];
|
||||
$tmp->keys = $array["keys"];
|
||||
|
|
@ -98,9 +101,12 @@ class Exercice
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
function get_name()
|
||||
function get_title($menu=false)
|
||||
{
|
||||
return "Exercice ".$this->number;
|
||||
if ($menu || empty($this->title))
|
||||
return "Exercice ".$this->number;
|
||||
else
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
function get_statement()
|
||||
|
|
@ -108,8 +114,7 @@ class Exercice
|
|||
return $this->statement;
|
||||
}
|
||||
|
||||
// retourne le nombre d'equipes qui ont résolues l'exercice
|
||||
// trié par date
|
||||
// retourne les équipes qui ont résolues l'exercice triées par date
|
||||
function get_solved()
|
||||
{
|
||||
$id = $this->id;
|
||||
|
|
@ -209,6 +214,7 @@ class Exercice
|
|||
$require = $this->require;
|
||||
$level = intval($this->level);
|
||||
$points = intval($this->points);
|
||||
$title = $this->title;
|
||||
$statement = $this->statement;
|
||||
$files = $this->files;
|
||||
$keys = $this->keys;
|
||||
|
|
@ -217,17 +223,18 @@ class Exercice
|
|||
$db->escape($id);
|
||||
$db->escape($theme);
|
||||
$db->escape($require);
|
||||
$db->escape($title);
|
||||
$db->escape($statement);
|
||||
|
||||
if ($create)
|
||||
{
|
||||
$db->query("INSERT INTO exercices
|
||||
VALUES ('".$id."', '".$theme."', '".$require."', '".$level."', '".$points."','".$statement."');");
|
||||
VALUES ('".$id."', '".$theme."', '".$require."', '".$level."', '".$points."','".$title."','".$statement."');");
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE exercices
|
||||
SET `id_theme` = '".$theme."', `require` = '".$require."', `level` = '".$level."', `points` = '".$points."', `statement` = '".$statement."'
|
||||
SET `id_theme` = '".$theme."', `require` = '".$require."', `level` = '".$level."', `points` = '".$points."', `title` = '".$title."', `statement` = '".$statement."'
|
||||
WHERE id = '$id'");
|
||||
|
||||
$aff = $db->affected();
|
||||
|
|
|
|||
Reference in a new issue