ILIAS  trunk Revision v5.2.0beta1-34115-g3a2438be29
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.

References $DIC.

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

Member Function Documentation

◆ current()

ilAssQuestionTypeList::current ( )

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

◆ existByTag()

ilAssQuestionTypeList::existByTag (   $questionTypeTag)

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

References getByTag().

Referenced by isImportable().

68  : bool
69  {
70  return $this->getByTag($questionTypeTag) instanceof ilAssQuestionType;
71  }
+ 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.

Referenced by existByTag().

78  {
79  foreach ($this as $qstType) {
80  if ($qstType->getTag() != $questionTypeTag) {
81  continue;
82  }
83 
84  return $qstType;
85  }
86 
87  return null;
88  }
+ Here is the caller graph for this function:

◆ getInstance()

static ilAssQuestionTypeList::getInstance ( )
static
Returns
ilAssQuestionTypeList

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

References load().

132  {
133  if (self::$instance === null) {
134  self::$instance = new self();
135  self::$instance->load();
136  }
137 
138  return self::$instance;
139  }
+ Here is the call graph for this function:

◆ isImportable()

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

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

References existByTag().

Referenced by ilQTIParser\handlerParseEndTag().

119  : bool
120  {
121  if (!self::getInstance()->existByTag($questionTypeTag)) {
122  return false;
123  }
124 
125  return self::getInstance()->getByTag($questionTypeTag)->isImportable();
126  }
+ 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.

Referenced by valid().

100  : ?string
101  {
102  return key($this->types);
103  }
+ Here is the caller graph for this function:

◆ load()

ilAssQuestionTypeList::load ( )

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

References $res, and ilAssQuestionType\completeMissingPluginName().

Referenced by getInstance().

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  }
$res
Definition: ltiservices.php:67
static completeMissingPluginName($question_type_data)
+ 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  }

◆ 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.

References key().

105  : bool
106  {
107  return key($this->types) !== null;
108  }
+ 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.

◆ $types

ilAssQuestionTypeList::$types = []
protected

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


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