ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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 }
$query
foreach($_POST as $key=> $value) $res

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

Referenced by saveToDb().

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

170 {
172 $this->solutionComparisonExpressionList->delete();
173 }

References initSolutionComparisonExpressionList().

Referenced by deleteFromDb().

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

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 }

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

+ Here is the call graph for this function:

◆ getEvalMode()

ilAssQuestionSkillAssignment::getEvalMode ( )

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

348 {
349 if ($this->hasEvalModeBySolution()) {
350 $maxPoints = 0;
351
352 foreach ($this->solutionComparisonExpressionList->get() as $expression) {
353 if ($expression->getPoints() > $maxPoints) {
354 $maxPoints = $expression->getPoints();
355 }
356 }
357
358 return $maxPoints;
359 }
360
361 return $this->getSkillPoints();
362 }

References getSkillPoints(), and hasEvalModeBySolution().

Referenced by ilAssQuestionSkillAssignmentList\incrementMaxPointsBySkill().

+ 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()

◆ 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 ( )

◆ initSolutionComparisonExpressionList()

ilAssQuestionSkillAssignment::initSolutionComparisonExpressionList ( )

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

336 {
337 $this->solutionComparisonExpressionList->setQuestionId($this->getQuestionId());
338 $this->solutionComparisonExpressionList->setSkillBaseId($this->getSkillBaseId());
339 $this->solutionComparisonExpressionList->setSkillTrefId($this->getSkillTrefId());
340 }

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

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

+ 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 368 of file class.ilAssQuestionSkillAssignment.php.

369 {
370 return (
371 is_numeric($skillPoints) &&
372 str_replace(array('.', ','), '', $skillPoints) == $skillPoints &&
373 $skillPoints > 0
374 );
375 }

References $skillPoints.

◆ loadAdditionalSkillData()

ilAssQuestionSkillAssignment::loadAdditionalSkillData ( )

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

278 {
279 $this->setSkillTitle(
281 );
282
283 $tree = new ilSkillTree();
284
285 $path = $tree->getSkillTreePath(
286 $this->getSkillBaseId(),
287 $this->getSkillTrefId()
288 );
289
290 $nodes = array();
291 foreach ($path as $node) {
292 if ($node['child'] > 1 && $node['skill_id'] != $this->getSkillBaseId()) {
293 $nodes[] = $node['title'];
294 }
295 }
296
297 $this->setSkillPath(implode(' > ', $nodes));
298 }
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.

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

+ Here is the call graph for this function:

◆ loadComparisonExpressions()

ilAssQuestionSkillAssignment::loadComparisonExpressions ( )

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

107 {
109 $this->solutionComparisonExpressionList->load();
110 }

References initSolutionComparisonExpressionList().

Referenced by loadFromDb().

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

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) {
103 }
104 }

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

+ Here is the call graph for this function:

◆ saveComparisonExpressions()

ilAssQuestionSkillAssignment::saveComparisonExpressions ( )

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

145 {
147 $this->solutionComparisonExpressionList->save();
148 }

References initSolutionComparisonExpressionList().

Referenced by saveToDb().

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

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) {
141 }
142 }

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

+ Here is the call graph for this function:

◆ setEvalMode()

ilAssQuestionSkillAssignment::setEvalMode (   $evalMode)

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

326 {
327 $this->evalMode = $evalMode;
328 }

References $evalMode.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setParentObjId()

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

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

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

References $parentObjId.

◆ setQuestionId()

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

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

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

References $questionId.

◆ setSkillBaseId()

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

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

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

References $skillBaseId.

◆ setSkillPath()

ilAssQuestionSkillAssignment::setSkillPath (   $skillPath)

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

311 {
312 $this->skillPath = $skillPath;
313 }

References $skillPath.

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillPoints()

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

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

201 {
202 $this->skillPoints = $skillPoints;
203 }

References $skillPoints.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSkillTitle()

ilAssQuestionSkillAssignment::setSkillTitle (   $skillTitle)

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

301 {
302 $this->skillTitle = $skillTitle;
303 }

References $skillTitle.

Referenced by loadAdditionalSkillData().

+ Here is the caller graph for this function:

◆ setSkillTrefId()

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

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

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

References $skillTrefId.

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: