ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.exObjQuestionPoolGUI.php
Go to the documentation of this file.
1 <?php
2 
9 {
26  public function executeCommand()
27  {
28  global $DIC; /* @var ILIAS\DI\Container $DIC */
29 
30  switch ($DIC->ctrl()->getNextClass($this)) {
31  case $DIC->question()->service()->fetchNextAuthoringCommandClass($DIC->ctrl()->getNextClass()):
32 
33  $questionId = 0; // Fetch questionId from Request Parameters
34  $backLink = ''; // Initialise with Back Link to Consumers Back-Landing Page
35 
36  $questionInstance = $DIC->question()->getQuestionInstance($questionId);
37  $questionAuthoringGUI = $DIC->question()->getAuthoringCommandInstance($questionInstance);
38 
39  $questionAuthoringGUI->setBackLink($backLink);
40 
41  $DIC->ctrl()->forwardCommand($questionAuthoringGUI);
42  }
43  }
44 
50  public function showQuestions()
51  {
52  global $DIC; /* @var ILIAS\DI\Container $DIC */
53 
54  $parentObjectId = 0; // init with question pool object id
55 
56  $questionDataArray = $DIC->question()->getQuestionDataArray($parentObjectId);
57 
63  $tableGUI = new exQuestionsTableGUI($this, 'showQuestions', '');
64  $tableGUI->setData($questionDataArray);
65 
66  $tableHTML = $tableGUI->getHTML(); // render table
67  }
68 
80  public function importQuestions()
81  {
82  global $DIC; /* @var ILIAS\DI\Container $DIC */
83 
84  $parentObjectId = 0; // init with question pool object id
85 
90  $qtiItems = array(); /* @var ilQTIItem[] $qtiItems */
91 
92  foreach ($qtiItems as $qtiItem) {
93  $questionType = $DIC->question()->service()->determineQuestionTypeByQtiItem($qtiItem);
94  $questionInstance = $DIC->question()->getEmptyQuestionInstance($questionType);
95 
96  $questionInstance->fromQtiItem($qtiItem);
97  $questionInstance->setParentId($parentObjectId);
98  $questionInstance->save();
99  }
100  }
101 
111  public function exportQuestions()
112  {
113  global $DIC; /* @var ILIAS\DI\Container $DIC */
114 
115  $parentObjectId = 0; // init with question pool object id
116 
120  $questions = $DIC->question()->getQuestionInstances($parentObjectId);
121 
126  $qtiXML = '';
127 
128  foreach ($questions as $questionInstance) {
129  $qtiXML .= $questionInstance->toQtiXML();
130  }
131  }
132 
138  public function deleteQuestion()
139  {
140  global $DIC; /* @var ILIAS\DI\Container $DIC */
141 
142  $questionId = 0; // init from GET parameters
143 
149  $questionInstance = $DIC->question()->getQuestionInstance($questionId);
150  $questionInstance->delete();
151  }
152 }
showQuestions()
For question listings the ilAsqQuestionFactory provides a factory method to retrieve an array of asso...
When a component consumes the assessment question service for purposes of authoring and managing ques...
executeCommand()
The question creation and editing is handled by the the ilAsqQuestionAuthoring interface.
global $DIC
Definition: goto.php:24
For that questions that are actually shown in the rows limit of the table corresponding question link...
importQuestions()
When a component provides import functionality for assessment questions, it needs to make use of the ...
deleteQuestion()
For the deletion of questions ilAsqQuestion provides the interface method deleteQuestion.
exportQuestions()
When a component provides export functionality for assessment questions, it needs the ilAsqQuestion i...