24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
51 $this->mark_steps = array();
70 $txt_failed_short =
"failed",
71 $txt_failed_official =
"failed",
72 $percentage_failed = 0,
74 $txt_passed_short =
"passed",
75 $txt_passed_official =
"passed",
76 $percentage_passed = 50,
81 $this->
addMarkStep($txt_failed_short, $txt_failed_official, $percentage_failed, $failed_passed);
82 $this->
addMarkStep($txt_passed_short, $txt_passed_official, $percentage_passed, $passed_passed);
103 include_once
"./Modules/Test/classes/class.assMark.php";
104 $mark =
new ASS_Mark($txt_short, $txt_official, $percentage, $passed);
105 array_push($this->mark_steps, $mark);
120 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
123 $result = $ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level",
131 $oldmarks[
$row[
"minimum_level"]] =
$row;
136 if (!$test_id)
return;
138 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_mark WHERE test_fi = %s",
142 if (count($this->mark_steps) == 0)
return;
145 foreach ($this->mark_steps as $key => $value)
147 $next_id = $ilDB->nextId(
'tst_mark');
148 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_mark (mark_id, test_fi, short_name, official_name, minimum_level, passed, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
149 array(
'integer',
'integer',
'text',
'text',
'float',
'text',
'integer'),
153 $value->getShortName(),
154 $value->getOfficialName(),
155 $value->getMinimumLevel(),
163 $result = $ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level",
172 $newmarks[
$row[
"minimum_level"]] =
$row;
175 foreach ($oldmarks as $level =>
$row)
177 if (array_key_exists($level, $newmarks))
179 $difffields = array();
180 foreach (
$row as $key => $value)
182 if (strcmp($value, $newmarks[$level][$key]) != 0)
190 array_push($difffields,
"$key: $value => " .$newmarks[$level][$key]);
195 if (count($difffields))
209 foreach ($newmarks as $level =>
$row)
211 if (!array_key_exists($level, $oldmarks))
233 if (!$test_id)
return;
234 $result = $ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level",
255 $this->mark_steps = array();
266 function level_sort($a, $b)
268 if ($a->getMinimumLevel() == $b->getMinimumLevel())
270 $res = strcmp($a->getShortName(), $b->getShortName());
273 return strcmp($a->getOfficialName(), $b->getOfficialName());
280 return ($a->getMinimumLevel() < $b->getMinimumLevel()) ? -1 : 1;
282 usort($this->mark_steps,
'level_sort');
294 if ($index < 0)
return;
295 if (count($this->mark_steps) < 1)
return;
296 if ($index >= count($this->mark_steps))
return;
297 unset($this->mark_steps[$index]);
298 $this->mark_steps = array_values($this->mark_steps);
310 foreach ($indexes as $key => $index)
312 if (!(($index < 0) or (count($this->mark_steps) < 1)))
314 unset($this->mark_steps[$index]);
317 $this->mark_steps = array_values($this->mark_steps);
330 for ($i = count($this->mark_steps) - 1; $i >= 0; $i--)
332 if ($percentage >= $this->mark_steps[$i]->getMinimumLevel())
334 return $this->mark_steps[$i];
352 $result = $ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level DESC",
358 if ($percentage >=
$row[
"minimum_level"])
378 $result = $ilDB->queryF(
"SELECT tst_mark.* FROM tst_mark, tst_tests WHERE tst_mark.test_fi = tst_tests.test_id AND tst_tests.obj_fi = %s ORDER BY minimum_level DESC",
384 if ($percentage >=
$row[
"minimum_level"])
404 $result = $ilDB->queryF(
"SELECT tst_mark.* FROM tst_active, tst_mark, tst_tests WHERE tst_mark.test_fi = tst_tests.test_id AND tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s ORDER BY minimum_level DESC",
410 if ($percentage >=
$row[
"minimum_level"])
427 $minimum_percentage = 100;
429 for ($i = 0; $i < count($this->mark_steps); $i++)
431 if ($this->mark_steps[$i]->getMinimumLevel() < $minimum_percentage)
433 $minimum_percentage = $this->mark_steps[$i]->getMinimumLevel();
435 if ($this->mark_steps[$i]->getPassed())
440 if ($minimum_percentage != 0)
442 return "min_percentage_ne_0";
446 return "no_passed_mark";
461 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";