ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilAsqService.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
13 {
18  public function fetchNextAuthoringCommandClass($nextClass) : string
19  {
20  global $DIC; /* @var ILIAS\DI\Container $DIC */
21 
22  $row = $DIC->database()->fetchAssoc($DIC->database()->queryF(
23  "SELECT COUNT(question_type_id) cnt FROM qpl_qst_type WHERE ctrl_class = %s",
24  array('text'),
25  array($nextClass)
26  ));
27 
28  if ($row['cnt']) {
29  // current next class is indeed an authoring ctrl class,
30  // return it to have the switch(nextclass) case matching
31  return $nextClass;
32  }
33 
34  // the interface that NOT represents a valid ctrl class,
35  // this will lead to a non matching switch(nextclass) case
36  return 'ilasqquestionauthoring';
37  }
38 
43  public function determineQuestionTypeByQtiItem(ilQTIItem $qtiItem) : string
44  {
45  // the qti service parses ILIAS question types, so use it
46  // although this may get changed in the future
47  return $qtiItem->getQuestiontype();
48  }
49 
55  public function questionTitleExists($parentObjectId, $questionTitle) : bool
56  {
57  global $DIC; /* @var ILIAS\DI\Container $DIC */
58 
59  $row = $DIC->database()->fetchAssoc($DIC->database()->queryF(
60  "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE obj_fi = %s AND title = %s",
61  array('integer', 'text'),
62  array($parentObjectId, $questionTitle)
63  ));
64 
65  return $row['cnt'] > 0;
66  }
67 }
determineQuestionTypeByQtiItem(ilQTIItem $qtiItem)
fetchNextAuthoringCommandClass($nextClass)
$DIC
Definition: xapitoken.php:46
questionTitleExists($parentObjectId, $questionTitle)