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