Exercice.class: fixed set_number
This commit is contained in:
parent
744a674f74
commit
3c4b6296ba
@ -74,14 +74,20 @@ class Exercice
|
|||||||
if ($this->require == "")
|
if ($this->require == "")
|
||||||
$this->number = 1;
|
$this->number = 1;
|
||||||
|
|
||||||
$exo = $this;
|
$db = new BDD();
|
||||||
$ret = 1;
|
|
||||||
|
$exo = $this->id;
|
||||||
|
$ret = 0;
|
||||||
|
|
||||||
|
$checked = array();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
$exo = new Exercice($exo->require);
|
array_push($checked, $exo);
|
||||||
|
$res = $db->unique_query("SELECT `require` FROM exercices WHERE id = ".intval($exo));
|
||||||
|
$exo = $res['require'];
|
||||||
$ret++;
|
$ret++;
|
||||||
} while ($exo->require != "");
|
} while ($exo != "" && !in_array($exo, $checked));
|
||||||
|
|
||||||
$this->number = $ret;
|
$this->number = $ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user