ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssQuestionTypeList Class Reference
+ Inheritance diagram for ilAssQuestionTypeList:
+ Collaboration diagram for ilAssQuestionTypeList:

Public Member Functions

 __construct ()
 ilAssQuestionTypeList constructor. More...
 
 load ()
 
 existByTag ($questionTypeTag)
 
 getByTag ($questionTypeTag)
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 

Static Public Member Functions

static isImportable ($questionTypeTag)
 
static getInstance ()
 

Protected Attributes

 $db
 
 $types = []
 

Static Protected Attributes

static $instance = null
 

Detailed Description

Definition at line 25 of file class.ilAssQuestionTypeList.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionTypeList::__construct ( )

ilAssQuestionTypeList constructor.

Definition at line 45 of file class.ilAssQuestionTypeList.php.

46 {
47 global $DIC; /* @var ILIAS\DI\Container $DIC */
48 $this->db = $DIC['ilDB'];
49 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Member Function Documentation

◆ current()

ilAssQuestionTypeList::current ( )

Definition at line 90 of file class.ilAssQuestionTypeList.php.

References current().

Referenced by current().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ existByTag()

ilAssQuestionTypeList::existByTag (   $questionTypeTag)

Definition at line 68 of file class.ilAssQuestionTypeList.php.

68 : bool
69 {
70 return $this->getByTag($questionTypeTag) instanceof ilAssQuestionType;
71 }

References getByTag().

Referenced by isImportable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getByTag()

ilAssQuestionTypeList::getByTag (   $questionTypeTag)
Parameters
$questionTypeTag
Returns
ilAssQuestionType|null

Definition at line 77 of file class.ilAssQuestionTypeList.php.

78 {
79 foreach ($this as $qstType) {
80 if ($qstType->getTag() != $questionTypeTag) {
81 continue;
82 }
83
84 return $qstType;
85 }
86
87 return null;
88 }

Referenced by existByTag().

+ Here is the caller graph for this function:

◆ getInstance()

static ilAssQuestionTypeList::getInstance ( )
static
Returns
ilAssQuestionTypeList

Definition at line 131 of file class.ilAssQuestionTypeList.php.

132 {
133 if (self::$instance === null) {
134 self::$instance = new self();
135 self::$instance->load();
136 }
137
138 return self::$instance;
139 }

References $instance, and load().

Referenced by isImportable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isImportable()

static ilAssQuestionTypeList::isImportable (   $questionTypeTag)
static
Parameters
string$questionTypeTag
Returns
bool

Definition at line 119 of file class.ilAssQuestionTypeList.php.

119 : bool
120 {
121 if (!self::getInstance()->existByTag($questionTypeTag)) {
122 return false;
123 }
124
125 return self::getInstance()->getByTag($questionTypeTag)->isImportable();
126 }

References existByTag(), and getInstance().

Referenced by ilQTIParser\handlerParseEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key()

ilAssQuestionTypeList::key ( )

Definition at line 100 of file class.ilAssQuestionTypeList.php.

100 : ?string
101 {
102 return key($this->types);
103 }

References key().

Referenced by key(), and valid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load()

ilAssQuestionTypeList::load ( )

Definition at line 51 of file class.ilAssQuestionTypeList.php.

51 : void
52 {
53 $res = $this->db->query("SELECT * FROM qpl_qst_type");
54
55 while ($row = $this->db->fetchAssoc($res)) {
57
58 $qstType = new ilAssQuestionType();
59 $qstType->setId($row['question_type_id']);
60 $qstType->setTag($row['type_tag']);
61 $qstType->setPlugin($row['plugin']);
62 $qstType->setPluginName($row['plugin_name']);
63 $this->types[] = $qstType;
64 }
65 }
static completeMissingPluginName(array $question_type_data)
$res
Definition: ltiservices.php:69

References $res, and ilAssQuestionType\completeMissingPluginName().

Referenced by getInstance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ next()

ilAssQuestionTypeList::next ( )

Definition at line 95 of file class.ilAssQuestionTypeList.php.

95 : void
96 {
97 next($this->types);
98 }

References next().

Referenced by next().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewind()

ilAssQuestionTypeList::rewind ( )

Definition at line 110 of file class.ilAssQuestionTypeList.php.

110 : void
111 {
112 reset($this->types);
113 }

◆ valid()

ilAssQuestionTypeList::valid ( )

Definition at line 105 of file class.ilAssQuestionTypeList.php.

105 : bool
106 {
107 return key($this->types) !== null;
108 }

References key().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilAssQuestionTypeList::$db
protected

Definition at line 35 of file class.ilAssQuestionTypeList.php.

◆ $instance

ilAssQuestionTypeList::$instance = null
staticprotected

Definition at line 30 of file class.ilAssQuestionTypeList.php.

Referenced by getInstance().

◆ $types

ilAssQuestionTypeList::$types = []
protected

Definition at line 40 of file class.ilAssQuestionTypeList.php.


The documentation for this class was generated from the following file: