Admin part: home and teams part done

This commit is contained in:
Némunaire 2013-11-08 19:15:17 +01:00
commit 166be860c8
11 changed files with 249 additions and 54 deletions

View file

@ -49,7 +49,6 @@ class Team
$key_hash = $this->key_hash;
$auth_level = intval($this->auth_level);
$slogan = $this->slogan;
$company = $this->company;
$team_name = $this->team_name;
$db = new BDD();
@ -60,14 +59,14 @@ class Team
if (empty($this->id))
{
$db->query("INSERT INTO teams
VALUES (NULL, '".$key_hash."', ".$auth_level.", '".$slogan."')");
VALUES (NULL, '".$team_name."', '".$key_hash."', ".$auth_level.", '".$slogan."')");
$this->id = $db->insert_id();
$aff = ($this->id > 0);
}
else
{
$db->query("UPDATE teams
SET team_name = '".$team_name."', auth_level = ".$auth_level.", key_hash = '".$key_hash."', company = '".$slogan."'
SET team_name = '".$team_name."', auth_level = ".$auth_level.", key_hash = '".$key_hash."', slogan = '".$slogan."'
WHERE id = ".intval($this->id));
$aff = $db->affected();
}
@ -173,7 +172,7 @@ class Team
{
if ($id_theme != -1)
{
$db = new BDD();
$db = new BDD();
$ids = $db->query("SELECT id_theme, id_exercice
FROM `solved`
LEFT OUTER JOIN exercices ON `solved`.id_exercice = `exercices`.id
@ -208,9 +207,9 @@ class Team
$db->deconnexion();
$array = array();
foreach ($ids as $id){
$array[] = new Team($id['id']);
}
if ($ids)
foreach ($ids as $id)
$array[] = new Team($id['id']);
return $array;
}