ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTestQuestionRelatedObjectivesList Class Reference
+ Collaboration diagram for ilTestQuestionRelatedObjectivesList:

Public Member Functions

 __construct ()
 
 addQuestionRelatedObjectives ($questionId, $objectiveIds)
 
 hasQuestionRelatedObjectives ($questionId)
 
 getQuestionRelatedObjectives ($questionId)
 
 loadObjectivesTitles ()
 
 getQuestionRelatedObjectiveTitles ($questionId)
 
 getUniqueObjectivesString ()
 
 getUniqueObjectivesStringForQuestions ($questionIds)
 
 getObjectiveTitleById ($objectiveId)
 
 getObjectives ()
 
 isQuestionRelatedToObjective ($questionId, $objectiveId)
 
 filterResultsByObjective ($testResults, $objectiveId)
 

Protected Attributes

 $objectivesByQuestion
 
 $objectivesTitles
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestQuestionRelatedObjectivesList::__construct ( )

Definition at line 23 of file class.ilTestQuestionRelatedObjectivesList.php.

References array.

24  {
25  $this->objectivesByQuestion = array();
26  $this->objectivesTitles = array();
27  }
Create styles array
The data for the language used.

Member Function Documentation

◆ addQuestionRelatedObjectives()

ilTestQuestionRelatedObjectivesList::addQuestionRelatedObjectives (   $questionId,
  $objectiveIds 
)
Parameters
integer$questionId
string$objectiveTitle

Definition at line 33 of file class.ilTestQuestionRelatedObjectivesList.php.

Referenced by ilLOTestQuestionAdapter\buildQuestionRelatedObjectiveListByQuestions(), and ilLOTestQuestionAdapter\buildQuestionRelatedObjectiveListByTest().

34  {
35  $this->objectivesByQuestion[$questionId] = $objectiveIds;
36  }
+ Here is the caller graph for this function:

◆ filterResultsByObjective()

ilTestQuestionRelatedObjectivesList::filterResultsByObjective (   $testResults,
  $objectiveId 
)

Definition at line 142 of file class.ilTestQuestionRelatedObjectivesList.php.

References array, and isQuestionRelatedToObjective().

143  {
144  $filteredResults = array();
145 
146  foreach($testResults as $questionId => $resultData)
147  {
148  if( !$this->isQuestionRelatedToObjective($questionId, $objectiveId) )
149  {
150  continue;
151  }
152 
153  $filteredResults[$questionId] = $resultData;
154  }
155 
156  return $filteredResults;
157  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getObjectives()

ilTestQuestionRelatedObjectivesList::getObjectives ( )

◆ getObjectiveTitleById()

ilTestQuestionRelatedObjectivesList::getObjectiveTitleById (   $objectiveId)

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

120  {
121  return $this->objectivesTitles[$objectiveId];
122  }

◆ getQuestionRelatedObjectives()

ilTestQuestionRelatedObjectivesList::getQuestionRelatedObjectives (   $questionId)
Parameters
integer$questionId
Returns
string

Definition at line 56 of file class.ilTestQuestionRelatedObjectivesList.php.

57  {
58  return $this->objectivesByQuestion[$questionId];
59  }

◆ getQuestionRelatedObjectiveTitles()

ilTestQuestionRelatedObjectivesList::getQuestionRelatedObjectiveTitles (   $questionId)
Parameters
integer$questionId
Returns
string

Definition at line 82 of file class.ilTestQuestionRelatedObjectivesList.php.

References array.

83  {
84  $titles = array();
85 
86  foreach((array) $this->objectivesByQuestion[$questionId] as $objectiveId)
87  {
88  $titles[] = $this->objectivesTitles[$objectiveId];
89  }
90 
91  return implode(', ', $titles);
92  }
Create styles array
The data for the language used.

◆ getUniqueObjectivesString()

ilTestQuestionRelatedObjectivesList::getUniqueObjectivesString ( )

Definition at line 94 of file class.ilTestQuestionRelatedObjectivesList.php.

95  {
96  return implode(', ', $this->objectivesTitles);
97  }

◆ getUniqueObjectivesStringForQuestions()

ilTestQuestionRelatedObjectivesList::getUniqueObjectivesStringForQuestions (   $questionIds)

Definition at line 99 of file class.ilTestQuestionRelatedObjectivesList.php.

References array.

100  {
101  $objectiveTitles = array();
102 
103  foreach( $this->objectivesByQuestion as $questionId => $objectiveIds )
104  {
105  if( !in_array($questionId, $questionIds) )
106  {
107  continue;
108  }
109 
110  foreach( $objectiveIds as $objectiveId )
111  {
112  $objectiveTitles[$objectiveId] = $this->objectivesTitles[$objectiveId];
113  }
114  }
115 
116  return implode(', ', $objectiveTitles);
117  }
Create styles array
The data for the language used.

◆ hasQuestionRelatedObjectives()

ilTestQuestionRelatedObjectivesList::hasQuestionRelatedObjectives (   $questionId)
Parameters
integer$questionId
Returns
bool

Definition at line 42 of file class.ilTestQuestionRelatedObjectivesList.php.

43  {
44  if( !isset($this->objectivesByQuestion[$questionId]) )
45  {
46  return false;
47  }
48 
49  return (bool)count($this->objectivesByQuestion[$questionId]);
50  }

◆ isQuestionRelatedToObjective()

ilTestQuestionRelatedObjectivesList::isQuestionRelatedToObjective (   $questionId,
  $objectiveId 
)

Definition at line 129 of file class.ilTestQuestionRelatedObjectivesList.php.

Referenced by filterResultsByObjective().

130  {
131  foreach($this->objectivesByQuestion[$questionId] as $relatedObjectiveId)
132  {
133  if($relatedObjectiveId == $objectiveId)
134  {
135  return true;
136  }
137  }
138 
139  return false;
140  }
+ Here is the caller graph for this function:

◆ loadObjectivesTitles()

ilTestQuestionRelatedObjectivesList::loadObjectivesTitles ( )

Definition at line 61 of file class.ilTestQuestionRelatedObjectivesList.php.

References ilCourseObjective\lookupObjectiveTitle().

62  {
63  require_once 'Modules/Course/classes/class.ilCourseObjective.php';
64 
65  foreach( $this->objectivesByQuestion as $objectiveIds )
66  {
67  foreach( $objectiveIds as $objectiveId )
68  {
69  if( !isset($this->objectivesTitles[$objectiveId]) )
70  {
71  $objectiveTitle = ilCourseObjective::lookupObjectiveTitle($objectiveId);
72  $this->objectivesTitles[$objectiveId] = $objectiveTitle;
73  }
74  }
75  }
76  }
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
+ Here is the call graph for this function:

Field Documentation

◆ $objectivesByQuestion

ilTestQuestionRelatedObjectivesList::$objectivesByQuestion
protected

◆ $objectivesTitles

ilTestQuestionRelatedObjectivesList::$objectivesTitles
protected

Definition at line 21 of file class.ilTestQuestionRelatedObjectivesList.php.

Referenced by getObjectives().


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