4require_once 
'./Modules/Test/classes/inc.AssessmentConstants.php';
 
   30                $this->mark_steps = array();
 
   49                $txt_failed_short = 
"failed", 
 
   50                $txt_failed_official = 
"failed", 
 
   51                $percentage_failed = 0,
 
   53                $txt_passed_short = 
"passed",
 
   54                $txt_passed_official = 
"passed",
 
   55                $percentage_passed = 50,
 
   60    $this->
addMarkStep($txt_failed_short, $txt_failed_official, $percentage_failed, $failed_passed);
 
   61    $this->
addMarkStep($txt_passed_short, $txt_passed_official, $percentage_passed, $passed_passed);
 
   75        public function addMarkStep( $txt_short = 
"", $txt_official = 
"", $percentage = 0, $passed = 0)
 
   77                require_once 
'./Modules/Test/classes/class.assMark.php';
 
   78                $mark = 
new ASS_Mark($txt_short, $txt_official, $percentage, $passed);
 
   79                array_push($this->mark_steps, $mark);
 
   93                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
   96                        $result = 
$ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level",
 
  105                                        $oldmarks[
$row[
"minimum_level"]] = 
$row;
 
  110                if (!$test_id) 
return;
 
  112                $ilDB->manipulateF(
"DELETE FROM tst_mark WHERE test_fi = %s",
 
  116                if (count($this->mark_steps) == 0) 
return;
 
  119                foreach ($this->mark_steps as $key => $value) 
 
  121                        $next_id = 
$ilDB->nextId(
'tst_mark');
 
  122                        $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)",
 
  123                                array(
'integer',
'integer',
'text',
'text',
'float',
'text',
'integer'),
 
  127                                        $value->getShortName(), 
 
  128                                        $value->getOfficialName(), 
 
  129                                        $value->getMinimumLevel(),
 
  137                        $result = 
$ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level",
 
  147                                        $newmarks[
$row[
"minimum_level"]] = 
$row;
 
  150                        foreach ($oldmarks as $level => 
$row)
 
  152                                if (array_key_exists($level, $newmarks))
 
  154                                        $difffields = array();
 
  155                                        foreach (
$row as $key => $value)
 
  157                                                if (strcmp($value, $newmarks[$level][$key]) != 0)
 
  165                                                                        array_push($difffields, 
"$key: $value => " .$newmarks[$level][$key]); 
 
  170                                        if (count($difffields))
 
  184                        foreach ($newmarks as $level => 
$row)
 
  186                                if (!array_key_exists($level, $oldmarks))
 
  207                if (!$test_id) 
return;
 
  208                $result = 
$ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level",
 
  229                $this->mark_steps = array();
 
  239                function level_sort($a, $b) 
 
  241                        if ($a->getMinimumLevel() == $b->getMinimumLevel()) 
 
  243                                $res = strcmp($a->getShortName(), $b->getShortName());
 
  246                                        return strcmp($a->getOfficialName(), $b->getOfficialName());
 
  253                        return ($a->getMinimumLevel() < $b->getMinimumLevel()) ? -1 : 1;
 
  255                usort($this->mark_steps, 
'level_sort');
 
  267                if ($index < 0) 
return;
 
  268                if (count($this->mark_steps) < 1) 
return;
 
  269                if ($index >= count($this->mark_steps)) 
return;
 
  270                unset($this->mark_steps[$index]);
 
  271                $this->mark_steps = array_values($this->mark_steps);
 
  283                foreach ($indexes as $key => $index) 
 
  285                        if (!(($index < 0) or (count($this->mark_steps) < 1))) 
 
  287                                unset($this->mark_steps[$index]);
 
  290                $this->mark_steps = array_values($this->mark_steps);
 
  304                for ($i = count($this->mark_steps) - 1; $i >= 0; $i--) 
 
  306                        $curMinLevel = $this->mark_steps[$i]->getMinimumLevel();
 
  308                        if( $percentage > $curMinLevel || (
string)$percentage == (
string)$curMinLevel )
 
  310                                return $this->mark_steps[$i];
 
  329                $result = 
$ilDB->queryF(
"SELECT * FROM tst_mark WHERE test_fi = %s ORDER BY minimum_level DESC",
 
  337                        if ($percentage >= 
$row[
"minimum_level"])
 
  358                $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",
 
  364                        if ($percentage >= 
$row[
"minimum_level"])
 
  382        public static function _getMatchingMarkFromActiveId($active_id, $percentage)
 
  386                $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",
 
  394                        if ($percentage >= 
$row[
"minimum_level"])
 
  411                $minimum_percentage = 100;
 
  413                for ($i = 0; $i < count($this->mark_steps); $i++) 
 
  415                        if ($this->mark_steps[$i]->getMinimumLevel() < $minimum_percentage)
 
  417                                $minimum_percentage = $this->mark_steps[$i]->getMinimumLevel();
 
  419                        if ($this->mark_steps[$i]->getPassed())
 
  425                if ($minimum_percentage != 0)
 
  427                        return "min_percentage_ne_0";
 
  432                        return "no_passed_mark";
 
  461        public function logAction($test_id, $logtext = 
"")
 
  465                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
A class defining mark schemas for assessment test objects.
createSimpleSchema( $txt_failed_short="failed", $txt_failed_official="failed", $percentage_failed=0, $failed_passed=0, $txt_passed_short="passed", $txt_passed_official="passed", $percentage_passed=50, $passed_passed=1)
Creates a simple mark schema for two mark steps: failed and passed.
setMarkSteps($mark_steps)
deleteMarkSteps($indexes)
Deletes multiple mark steps using their index positions.
flush()
Empties the mark schema and removes all mark steps.
sort()
Sorts the mark schema using the minimum level values.
deleteMarkStep($index=0)
Deletes the mark step with a given index.
static _getMatchingMarkFromObjId($a_obj_id, $percentage)
Returns the matching mark for a given percentage.
static _getMatchingMark($test_id, $percentage)
Returns the matching mark for a given percentage.
loadFromDb($test_id)
Loads an ASS_MarkSchema object from a database.
addMarkStep( $txt_short="", $txt_official="", $percentage=0, $passed=0)
Adds a mark step to the mark schema.
checkMarks()
Check the marks for consistency.
getMatchingMark($percentage)
Returns the matching mark for a given percentage.
saveToDb($test_id)
Saves an ASS_MarkSchema object to a database.
__construct()
ASS_MarkSchema constructor.
A class defining marks for assessment test objects.
An exception for terminatinating execution or to throw for unit testing.
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.