Friday release

This commit is contained in:
nemunaire 2013-12-14 06:11:14 +01:00
commit c349769425
16 changed files with 319 additions and 89 deletions

View file

@ -29,6 +29,16 @@ class Theme
}
}
static function __set_state(array $array)
{
$tmp = new Theme();
$tmp->id = $array["id"];
$tmp->name = $array["name"];
return $tmp;
}
function update()
{
$name = $this->name;
@ -52,6 +62,8 @@ class Theme
}
$db->deconnexion();
Cache::del("ordered_th".$this->id);
return ($aff == 1);
}
@ -93,6 +105,10 @@ class Theme
function get_exercices_ordered()
{
$res = Cache::read("ordered_th".$this->id);
if (!empty($res))
return $res;
$db = new BDD();
$res = $db->query("SELECT E.id, E.require FROM exercices E
INNER JOIN themes T ON T.id = E.id_theme
@ -130,13 +146,14 @@ class Theme
foreach($res as &$r)
$r = new Exercice($r["id"]);
Cache::set("ordered_th".$this->id, $res);
return $res;
}
public static function get_themes()
{
$db = new BDD();
$ids = $db->query("SELECT `id` FROM `themes`");
$ids = $db->query("SELECT `id` FROM `themes` ORDER BY `name`");
$db->deconnexion();
$array = array();