Friday release
This commit is contained in:
parent
10eb72688f
commit
c349769425
16 changed files with 319 additions and 89 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Reference in a new issue