ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilAssQuestionSkillAssignment Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignment:

Public Member Functions

 __construct (ilDB $db)
 
 loadFromDb ()
 
 loadComparisonExpressions ()
 
 saveToDb ()
 
 saveComparisonExpressions ()
 
 deleteFromDb ()
 
 deleteComparisonExpressions ()
 
 dbRecordExists ()
 
 setSkillPoints ($skillPoints)
 
 getSkillPoints ()
 
 setQuestionId ($questionId)
 
 getQuestionId ()
 
 setSkillBaseId ($skillBaseId)
 
 getSkillBaseId ()
 
 setSkillTrefId ($skillTrefId)
 
 getSkillTrefId ()
 
 setParentObjId ($parentObjId)
 
 getParentObjId ()
 
 loadAdditionalSkillData ()
 
 setSkillTitle ($skillTitle)
 
 getSkillTitle ()
 
 setSkillPath ($skillPath)
 
 getSkillPath ()
 
 getEvalMode ()
 
 setEvalMode ($evalMode)
 
 hasEvalModeBySolution ()
 
 initSolutionComparisonExpressionList ()
 
 getSolutionComparisonExpressionList ()
 
 getMaxSkillPoints ()
 

Data Fields

const DEFAULT_COMPETENCE_POINTS = 1
 
const EVAL_MODE_BY_QUESTION_RESULT = 'result'
 
const EVAL_MODE_BY_QUESTION_SOLUTION = 'solution'
 

Private Attributes

 $db
 
 $parentObjId
 
 $questionId
 
 $skillBaseId
 
 $skillTrefId
 
 $skillPoints
 
 $skillTitle
 
 $skillPath
 
 $evalMode
 
 $solutionComparisonExpressionList
 

Detailed Description

Definition at line 12 of file class.ilAssQuestionSkillAssignment.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignment::__construct ( ilDB  $db)

Member Function Documentation

◆ dbRecordExists()

ilAssQuestionSkillAssignment::dbRecordExists ( )

Definition at line 177 of file class.ilAssQuestionSkillAssignment.php.

References $query, $res, $row, getParentObjId(), getQuestionId(), getSkillBaseId(), and getSkillTrefId().

Referenced by saveToDb().

178  {
179  $query = "
180  SELECT COUNT(*) cnt
181  FROM qpl_qst_skl_assigns
182  WHERE obj_fi = %s
183  AND question_fi = %s
184  AND skill_base_fi = %s
185  AND skill_tref_fi = %s
186  ";
187 
188  $res = $this->db->queryF(
189  $query, array('integer', 'integer', 'integer', 'integer'),
190  array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
191  );
192 
193  $row = $this->db->fetchAssoc($res);
194 
195  return $row['cnt'] > 0;
196  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteComparisonExpressions()

ilAssQuestionSkillAssignment::deleteComparisonExpressions ( )

Definition at line 171 of file class.ilAssQuestionSkillAssignment.php.

References initSolutionComparisonExpressionList().

Referenced by deleteFromDb().

172  {
174  $this->solutionComparisonExpressionList->delete();
175  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFromDb()

ilAssQuestionSkillAssignment::deleteFromDb ( )

Definition at line 153 of file class.ilAssQuestionSkillAssignment.php.

References $query, deleteComparisonExpressions(), getParentObjId(), getQuestionId(), getSkillBaseId(), and getSkillTrefId().

154  {
155  $query = "
156  DELETE FROM qpl_qst_skl_assigns
157  WHERE obj_fi = %s
158  AND question_fi = %s
159  AND skill_base_fi = %s
160  AND skill_tref_fi = %s
161  ";
162 
163  $this->db->manipulateF(
164  $query, array('integer', 'integer', 'integer', 'integer'),
165  array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
166  );
167 
169  }
+ Here is the call graph for this function:

◆ getEvalMode()

ilAssQuestionSkillAssignment::getEvalMode ( )

Definition at line 325 of file class.ilAssQuestionSkillAssignment.php.

References $evalMode.

Referenced by hasEvalModeBySolution(), loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ getMaxSkillPoints()

ilAssQuestionSkillAssignment::getMaxSkillPoints ( )

Definition at line 352 of file class.ilAssQuestionSkillAssignment.php.

References getSkillPoints(), and hasEvalModeBySolution().

Referenced by ilAssQuestionSkillAssignmentList\incrementMaxPointsBySkill().

353  {
354  if( $this->hasEvalModeBySolution() )
355  {
356  $maxPoints = 0;
357 
358  foreach($this->solutionComparisonExpressionList->get() as $expression)
359  {
360  if( $expression->getPoints() > $maxPoints )
361  {
362  $maxPoints = $expression->getPoints();
363  }
364  }
365 
366  return $maxPoints;
367  }
368 
369  return $this->getSkillPoints();
370  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentObjId()

ilAssQuestionSkillAssignment::getParentObjId ( )
Returns
int

Definition at line 273 of file class.ilAssQuestionSkillAssignment.php.

References $parentObjId.

Referenced by dbRecordExists(), deleteFromDb(), loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ getQuestionId()

ilAssQuestionSkillAssignment::getQuestionId ( )

◆ getSkillBaseId()

◆ getSkillPath()

ilAssQuestionSkillAssignment::getSkillPath ( )

◆ getSkillPoints()

ilAssQuestionSkillAssignment::getSkillPoints ( )
Returns
int

Definition at line 209 of file class.ilAssQuestionSkillAssignment.php.

References $skillPoints.

Referenced by getMaxSkillPoints(), and saveToDb().

+ Here is the caller graph for this function:

◆ getSkillTitle()

ilAssQuestionSkillAssignment::getSkillTitle ( )

◆ getSkillTrefId()

◆ getSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::getSolutionComparisonExpressionList ( )

◆ hasEvalModeBySolution()

ilAssQuestionSkillAssignment::hasEvalModeBySolution ( )

Definition at line 335 of file class.ilAssQuestionSkillAssignment.php.

References getEvalMode().

Referenced by ilAssQuestionSkillAssignmentsGUI\buildLacLegendHTML(), ilAssQuestionSkillAssignmentsTableGUI\getEvalModeLabel(), getMaxSkillPoints(), and ilAssQuestionSkillAssignmentsTableGUI\isSkillPointInputRequired().

336  {
337  return $this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION;
338  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::initSolutionComparisonExpressionList ( )

Definition at line 340 of file class.ilAssQuestionSkillAssignment.php.

References getQuestionId(), getSkillBaseId(), and getSkillTrefId().

Referenced by deleteComparisonExpressions(), loadComparisonExpressions(), and saveComparisonExpressions().

341  {
342  $this->solutionComparisonExpressionList->setQuestionId($this->getQuestionId());
343  $this->solutionComparisonExpressionList->setSkillBaseId($this->getSkillBaseId());
344  $this->solutionComparisonExpressionList->setSkillTrefId($this->getSkillTrefId());
345  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadAdditionalSkillData()

ilAssQuestionSkillAssignment::loadAdditionalSkillData ( )

Definition at line 278 of file class.ilAssQuestionSkillAssignment.php.

References $path, ilSkillTreeNode\_lookupTitle(), getSkillBaseId(), getSkillTrefId(), setSkillPath(), and setSkillTitle().

279  {
280  require_once 'Services/Skill/classes/class.ilBasicSkill.php';
281  require_once 'Services/Skill/classes/class.ilSkillTree.php';
282 
283  $this->setSkillTitle(
285  );
286 
287  $tree = new ilSkillTree();
288 
289  $path = $tree->getSkillTreePath(
290  $this->getSkillBaseId(), $this->getSkillTrefId()
291  );
292 
293  $nodes = array();
294  foreach ($path as $node)
295  {
296  if( $node['child'] > 1 && $node['skill_id'] != $this->getSkillBaseId() )
297  {
298  $nodes[] = $node['title'];
299  }
300  }
301 
302  $this->setSkillPath(implode(' > ', $nodes));
303  }
Skill tree.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
$path
Definition: index.php:22
+ Here is the call graph for this function:

◆ loadComparisonExpressions()

ilAssQuestionSkillAssignment::loadComparisonExpressions ( )

Definition at line 107 of file class.ilAssQuestionSkillAssignment.php.

References initSolutionComparisonExpressionList().

Referenced by loadFromDb().

108  {
110  $this->solutionComparisonExpressionList->load();
111  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromDb()

ilAssQuestionSkillAssignment::loadFromDb ( )

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

References $query, $res, $row, getEvalMode(), getParentObjId(), getQuestionId(), getSkillBaseId(), getSkillTrefId(), loadComparisonExpressions(), setEvalMode(), and setSkillPoints().

78  {
79  $query = "
80  SELECT obj_fi, question_fi, skill_base_fi, skill_tref_fi, skill_points, eval_mode
81  FROM qpl_qst_skl_assigns
82  WHERE obj_fi = %s
83  AND question_fi = %s
84  AND skill_base_fi = %s
85  AND skill_tref_fi = %s
86  ";
87 
88  $res = $this->db->queryF(
89  $query, array('integer', 'integer', 'integer', 'integer'),
90  array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
91  );
92 
93  $row = $this->db->fetchAssoc($res);
94 
95  if( is_array($row) )
96  {
97  $this->setSkillPoints($row['skill_points']);
98  $this->setEvalMode($row['eval_mode']);
99  }
100 
101  if( $this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION )
102  {
103  $this->loadComparisonExpressions();
104  }
105  }
+ Here is the call graph for this function:

◆ saveComparisonExpressions()

ilAssQuestionSkillAssignment::saveComparisonExpressions ( )

Definition at line 147 of file class.ilAssQuestionSkillAssignment.php.

References initSolutionComparisonExpressionList().

Referenced by saveToDb().

148  {
150  $this->solutionComparisonExpressionList->save();
151  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

ilAssQuestionSkillAssignment::saveToDb ( )

Definition at line 113 of file class.ilAssQuestionSkillAssignment.php.

References dbRecordExists(), getEvalMode(), getParentObjId(), getQuestionId(), getSkillBaseId(), getSkillPoints(), getSkillTrefId(), and saveComparisonExpressions().

114  {
115  if( $this->dbRecordExists() )
116  {
117  $this->db->update('qpl_qst_skl_assigns', array(
118  'skill_points' => array('integer', $this->getSkillPoints()),
119  'eval_mode' => array('text', $this->getEvalMode())
120  ),
121  array(
122  'obj_fi' => array('integer', $this->getParentObjId()),
123  'question_fi' => array('integer', $this->getQuestionId()),
124  'skill_base_fi' => array('integer', $this->getSkillBaseId()),
125  'skill_tref_fi' => array('integer', $this->getSkillTrefId())
126  )
127  );
128  }
129  else
130  {
131  $this->db->insert('qpl_qst_skl_assigns', array(
132  'obj_fi' => array('integer', $this->getParentObjId()),
133  'question_fi' => array('integer', $this->getQuestionId()),
134  'skill_base_fi' => array('integer', $this->getSkillBaseId()),
135  'skill_tref_fi' => array('integer', $this->getSkillTrefId()),
136  'skill_points' => array('integer', $this->getSkillPoints()),
137  'eval_mode' => array('text', $this->getEvalMode())
138  ));
139  }
140 
141  if( $this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION )
142  {
143  $this->saveComparisonExpressions();
144  }
145  }
+ Here is the call graph for this function:

◆ setEvalMode()

ilAssQuestionSkillAssignment::setEvalMode (   $evalMode)

Definition at line 330 of file class.ilAssQuestionSkillAssignment.php.

References $evalMode.

Referenced by loadFromDb().

331  {
332  $this->evalMode = $evalMode;
333  }
+ Here is the caller graph for this function:

◆ setParentObjId()

ilAssQuestionSkillAssignment::setParentObjId (   $parentObjId)
Parameters
int$parentObjId

Definition at line 265 of file class.ilAssQuestionSkillAssignment.php.

References $parentObjId.

266  {
267  $this->parentObjId = $parentObjId;
268  }

◆ setQuestionId()

ilAssQuestionSkillAssignment::setQuestionId (   $questionId)
Parameters
int$questionId

Definition at line 217 of file class.ilAssQuestionSkillAssignment.php.

References $questionId.

218  {
219  $this->questionId = $questionId;
220  }

◆ setSkillBaseId()

ilAssQuestionSkillAssignment::setSkillBaseId (   $skillBaseId)
Parameters
int$skillBaseId

Definition at line 233 of file class.ilAssQuestionSkillAssignment.php.

References $skillBaseId.

234  {
235  $this->skillBaseId = $skillBaseId;
236  }

◆ setSkillPath()

ilAssQuestionSkillAssignment::setSkillPath (   $skillPath)

Definition at line 315 of file class.ilAssQuestionSkillAssignment.php.

References $skillPath.

Referenced by loadAdditionalSkillData().

316  {
317  $this->skillPath = $skillPath;
318  }
+ Here is the caller graph for this function:

◆ setSkillPoints()

ilAssQuestionSkillAssignment::setSkillPoints (   $skillPoints)
Parameters
int$skillPoints

Definition at line 201 of file class.ilAssQuestionSkillAssignment.php.

References $skillPoints.

Referenced by loadFromDb().

202  {
203  $this->skillPoints = $skillPoints;
204  }
+ Here is the caller graph for this function:

◆ setSkillTitle()

ilAssQuestionSkillAssignment::setSkillTitle (   $skillTitle)

Definition at line 305 of file class.ilAssQuestionSkillAssignment.php.

References $skillTitle.

Referenced by loadAdditionalSkillData().

306  {
307  $this->skillTitle = $skillTitle;
308  }
+ Here is the caller graph for this function:

◆ setSkillTrefId()

ilAssQuestionSkillAssignment::setSkillTrefId (   $skillTrefId)
Parameters
int$skillTrefId

Definition at line 249 of file class.ilAssQuestionSkillAssignment.php.

References $skillTrefId.

250  {
251  $this->skillTrefId = $skillTrefId;
252  }

Field Documentation

◆ $db

ilAssQuestionSkillAssignment::$db
private

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

Referenced by __construct().

◆ $evalMode

ilAssQuestionSkillAssignment::$evalMode
private

Definition at line 63 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getEvalMode(), and setEvalMode().

◆ $parentObjId

ilAssQuestionSkillAssignment::$parentObjId
private

Definition at line 28 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getParentObjId(), and setParentObjId().

◆ $questionId

ilAssQuestionSkillAssignment::$questionId
private

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

Referenced by getQuestionId(), and setQuestionId().

◆ $skillBaseId

ilAssQuestionSkillAssignment::$skillBaseId
private

Definition at line 38 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillBaseId(), and setSkillBaseId().

◆ $skillPath

ilAssQuestionSkillAssignment::$skillPath
private

Definition at line 58 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillPath(), and setSkillPath().

◆ $skillPoints

ilAssQuestionSkillAssignment::$skillPoints
private

Definition at line 48 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillPoints(), and setSkillPoints().

◆ $skillTitle

ilAssQuestionSkillAssignment::$skillTitle
private

Definition at line 53 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillTitle(), and setSkillTitle().

◆ $skillTrefId

ilAssQuestionSkillAssignment::$skillTrefId
private

Definition at line 43 of file class.ilAssQuestionSkillAssignment.php.

Referenced by getSkillTrefId(), and setSkillTrefId().

◆ $solutionComparisonExpressionList

ilAssQuestionSkillAssignment::$solutionComparisonExpressionList
private

◆ DEFAULT_COMPETENCE_POINTS

const ilAssQuestionSkillAssignment::DEFAULT_COMPETENCE_POINTS = 1

◆ EVAL_MODE_BY_QUESTION_RESULT

◆ EVAL_MODE_BY_QUESTION_SOLUTION

const ilAssQuestionSkillAssignment::EVAL_MODE_BY_QUESTION_SOLUTION = 'solution'

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