ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAssQuestionSkillAssignment Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignment:

Public Member Functions

 __construct (ilDBInterface $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 ()
 
 isValidSkillPoint ($skillPoints)
 

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 ( ilDBInterface  $db)

Member Function Documentation

◆ dbRecordExists()

ilAssQuestionSkillAssignment::dbRecordExists ( )

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

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

Referenced by saveToDb().

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

◆ deleteComparisonExpressions()

ilAssQuestionSkillAssignment::deleteComparisonExpressions ( )

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

References initSolutionComparisonExpressionList().

Referenced by deleteFromDb().

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

◆ deleteFromDb()

ilAssQuestionSkillAssignment::deleteFromDb ( )

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

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

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

◆ getEvalMode()

ilAssQuestionSkillAssignment::getEvalMode ( )

Definition at line 323 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 350 of file class.ilAssQuestionSkillAssignment.php.

References getSkillPoints(), and hasEvalModeBySolution().

Referenced by ilAssQuestionSkillAssignmentList\incrementMaxPointsBySkill().

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

◆ getParentObjId()

ilAssQuestionSkillAssignment::getParentObjId ( )
Returns
int

Definition at line 272 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 208 of file class.ilAssQuestionSkillAssignment.php.

References $skillPoints.

Referenced by ilAssQuestionSkillAssignmentsTableGUI\buildSkillPointsInput(), getMaxSkillPoints(), and saveToDb().

+ Here is the caller graph for this function:

◆ getSkillTitle()

ilAssQuestionSkillAssignment::getSkillTitle ( )

◆ getSkillTrefId()

◆ getSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::getSolutionComparisonExpressionList ( )

◆ hasEvalModeBySolution()

ilAssQuestionSkillAssignment::hasEvalModeBySolution ( )

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

References getEvalMode().

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

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

◆ initSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::initSolutionComparisonExpressionList ( )

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

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

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

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

◆ isValidSkillPoint()

ilAssQuestionSkillAssignment::isValidSkillPoint (   $skillPoints)
Parameters
mixed$skillPoints
Returns
bool

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

References $skillPoints.

372  {
373  return (
374  is_numeric($skillPoints) &&
375  str_replace(array('.', ','), '', $skillPoints) == $skillPoints &&
376  $skillPoints > 0
377  );
378  }

◆ loadAdditionalSkillData()

ilAssQuestionSkillAssignment::loadAdditionalSkillData ( )

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

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

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

◆ loadComparisonExpressions()

ilAssQuestionSkillAssignment::loadComparisonExpressions ( )

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

References initSolutionComparisonExpressionList().

Referenced by loadFromDb().

107  {
109  $this->solutionComparisonExpressionList->load();
110  }
+ 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,
90  array('integer', 'integer', 'integer', 'integer'),
91  array($this->getParentObjId(), $this->getQuestionId(), $this->getSkillBaseId(), $this->getSkillTrefId())
92  );
93 
94  $row = $this->db->fetchAssoc($res);
95 
96  if (is_array($row)) {
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  $this->loadComparisonExpressions();
103  }
104  }
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:

◆ saveComparisonExpressions()

ilAssQuestionSkillAssignment::saveComparisonExpressions ( )

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

References initSolutionComparisonExpressionList().

Referenced by saveToDb().

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

◆ saveToDb()

ilAssQuestionSkillAssignment::saveToDb ( )

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

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

113  {
114  if ($this->dbRecordExists()) {
115  $this->db->update(
116  'qpl_qst_skl_assigns',
117  array(
118  'skill_points' => array('integer', (int) $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  } else {
129  $this->db->insert('qpl_qst_skl_assigns', array(
130  'obj_fi' => array('integer', $this->getParentObjId()),
131  'question_fi' => array('integer', $this->getQuestionId()),
132  'skill_base_fi' => array('integer', $this->getSkillBaseId()),
133  'skill_tref_fi' => array('integer', $this->getSkillTrefId()),
134  'skill_points' => array('integer', (int) $this->getSkillPoints()),
135  'eval_mode' => array('text', $this->getEvalMode())
136  ));
137  }
138 
139  if ($this->getEvalMode() == self::EVAL_MODE_BY_QUESTION_SOLUTION) {
140  $this->saveComparisonExpressions();
141  }
142  }
+ Here is the call graph for this function:

◆ setEvalMode()

ilAssQuestionSkillAssignment::setEvalMode (   $evalMode)

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

References $evalMode.

Referenced by loadFromDb().

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

◆ setParentObjId()

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

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

References $parentObjId.

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

◆ setQuestionId()

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

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

References $questionId.

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

◆ setSkillBaseId()

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

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

References $skillBaseId.

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

◆ setSkillPath()

ilAssQuestionSkillAssignment::setSkillPath (   $skillPath)

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

References $skillPath.

Referenced by loadAdditionalSkillData().

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

◆ setSkillPoints()

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

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

References $skillPoints.

Referenced by loadFromDb().

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

◆ setSkillTitle()

ilAssQuestionSkillAssignment::setSkillTitle (   $skillTitle)

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

References $skillTitle.

Referenced by loadAdditionalSkillData().

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

◆ setSkillTrefId()

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

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

References $skillTrefId.

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

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

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


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