Admin can login to access private pages (such as add courses)
This commit is contained in:
parent
0d084a69e3
commit
ec1ed49996
12 changed files with 221 additions and 24 deletions
|
|
@ -47,6 +47,11 @@ class QuestionsFile
|
|||
$this->tmp[$question->getId()] = $question;
|
||||
}
|
||||
|
||||
public function del_question($question)
|
||||
{
|
||||
unset($this->tmp[$question->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a question from its unique identifiant
|
||||
*/
|
||||
|
|
@ -67,6 +72,28 @@ class QuestionsFile
|
|||
return NULL;
|
||||
}
|
||||
|
||||
public function get_ids()
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
$qs = $this->treeXML->getElementsByTagName("question");
|
||||
foreach($qs as $q)
|
||||
$ret[] = $q->getAttribute("xml:id");
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function get_questions()
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
$qs = $this->treeXML->getElementsByTagName("question");
|
||||
foreach($qs as $q)
|
||||
$ret[] = new Question($q);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write changes into the real file
|
||||
*/
|
||||
|
|
@ -84,8 +111,15 @@ class QuestionsFile
|
|||
$this->treeXML->formatOutput = true;
|
||||
$this->treeXML->save($this->filename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
$file = new QuestionsFile("questions.xml");
|
||||
foreach ($file->get_ids() as $id)
|
||||
{
|
||||
$q = $file->get_question($id);
|
||||
echo $q->convert()."<br>";
|
||||
}
|
||||
$file->save();
|
||||
//*/
|
||||
?>
|
||||
Reference in a new issue