ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjTestAccess Class Reference

Class ilObjTestAccess. More...

+ Inheritance diagram for ilObjTestAccess:
+ Collaboration diagram for ilObjTestAccess:

Public Member Functions

 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)
 _getMaxPointsForTestPass ($random, $user_id, $test_id, $pass)
 Returns the maximum number of points available for a test pass.
 _isPassed ($user_id, $a_obj_id)
 Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id.
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id=0)
 check condition
 _getCommands ()
 get commands
 _lookupCreationComplete ($a_obj_id)
 checks wether all necessary parts of the test are given
 _getTestIDFromObjectID ($object_id)
 Returns the ILIAS test id for a given object id.
_getTestQuestions ($active_id, $pass=NULL)
 _isComplete ($a_obj_id)
 Returns true, if a test is complete for use.
_getTestData ($test_id)
 Returns the database content of a test with a given id.
 _getQuestionCount ($test_id)
 Calculates the number of questions in a test.
 _lookupOnlineTestAccess ($a_test_id, $a_user_id)
 Checks if a user is allowd to run an online exam.
 _getParticipantData ($active_id)
 Retrieves a participant name from active id.
_getPassedUsers ($a_obj_id)
 Returns an array containing the users who passed the test.
 _checkGoto ($a_target)
 check whether goto script will succeed

Static Public Member Functions

 _hasFinished ($a_user_id, $a_obj_id)
 Returns information if a specific user has finished a test.

Detailed Description

Class ilObjTestAccess.

This class contains methods that check object specific conditions for accessing test objects.

Author
Helmut Schottmueller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilObjTestAccess.php 22005 2009-10-01 11:19:23Z hschottm

Definition at line 39 of file class.ilObjTestAccess.php.

Member Function Documentation

ilObjTestAccess::_checkAccess (   $a_cmd,
  $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id = "" 
)

Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)

Please do not check any preconditions handled by ilConditionHandler here.

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok

Reimplemented from ilObjectAccess.

Definition at line 56 of file class.ilObjTestAccess.php.

References $lng, _lookupCreationComplete(), and IL_NO_OBJECT_ACCESS.

{
global $ilUser, $lng, $rbacsystem, $ilAccess;
if ($a_user_id == "")
{
$a_user_id = $ilUser->getId();
}
switch ($a_permission)
{
case "read":
case "visible":
(!$rbacsystem->checkAccess('write', $a_ref_id)))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("tst_warning_test_not_complete"));
return false;
}
break;
}
switch ($a_cmd)
{
case "eval_a":
case "eval_stat":
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("tst_warning_test_not_complete"));
return false;
}
break;
}
return true;
}

+ Here is the call graph for this function:

ilObjTestAccess::_checkCondition (   $a_obj_id,
  $a_operator,
  $a_value,
  $a_usr_id = 0 
)

check condition

this method is called by ilConditionHandler

Reimplemented from ilObjectAccess.

Definition at line 220 of file class.ilObjTestAccess.php.

References _hasFinished(), and _isPassed().

Referenced by ilCourseStart\isFullfilled().

{
global $ilUser;
$a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
switch($a_operator)
{
case 'passed':
return ilObjTestAccess::_isPassed($a_usr_id, $a_obj_id);
break;
case 'finished':
return ilObjTestAccess::_hasFinished($a_usr_id,$a_obj_id);
case 'not_finished':
return !ilObjTestAccess::_hasFinished($a_usr_id,$a_obj_id);
default:
return true;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 770 of file class.ilObjTestAccess.php.

{
global $ilAccess;
$t_arr = explode("_", $a_target);
if ($t_arr[0] != "tst" || ((int) $t_arr[1]) <= 0)
{
return false;
}
if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
{
return true;
}
return false;
}
ilObjTestAccess::_getCommands ( )

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Reimplemented from ilObjectAccess.

Definition at line 256 of file class.ilObjTestAccess.php.

Referenced by ilObjTestListGUI\init().

{
$commands = array
(
array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "tst_run",
"default" => true),
array("permission" => "write", "cmd" => "", "lang_var" => "edit"),
array("permission" => "tst_statistics", "cmd" => "outEvaluation", "lang_var" => "tst_statistical_evaluation")
);
return $commands;
}

+ Here is the caller graph for this function:

ilObjTestAccess::_getMaxPointsForTestPass (   $random,
  $user_id,
  $test_id,
  $pass 
)

Returns the maximum number of points available for a test pass.

Returns the maximum number of points available for a test pass

Parameters
boolean$randomTRUE if the test is a random test, otherwise FALSE
int$test_idThe test id
int$passThe test pass
Returns
int The available points for the test pass

Definition at line 102 of file class.ilObjTestAccess.php.

References $pass, and $result.

Referenced by _getPassedUsers(), and _isPassed().

{
global $ilDB;
$max = 0;
if ($random)
{
$query = sprintf("SELECT SUM(qpl_questions.points) AS maxpoints FROM tst_test_random_question, qpl_questions, tst_active WHERE tst_active.active_id = tst_test_random_question.active_fi AND tst_test_random_question.question_fi = qpl_questions.question_id AND tst_active.test_fi = %s AND tst_test_random_question.pass = %s AND tst_active.user_fi = %s",
$ilDB->quote($test_id . ""),
$ilDB->quote($pass . ""),
$ilDB->quote($user_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
$max = $row["maxpoints"];
}
}
else
{
$query = sprintf("SELECT SUM(qpl_questions.points) AS maxpoints FROM tst_test_question, qpl_questions WHERE tst_test_question.question_fi = qpl_questions.question_id AND tst_test_question.test_fi = %s",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
$max = $row["maxpoints"];
}
}
return $max;
}

+ Here is the caller graph for this function:

ilObjTestAccess::_getParticipantData (   $active_id)

Retrieves a participant name from active id.

Parameters
integer$active_idActive ID of the participant
Returns
string The output name of the user public

Definition at line 596 of file class.ilObjTestAccess.php.

References $lng, $result, ilObjTest\_lookupAnonymity(), and ilObjUser\_lookupName().

Referenced by assQuestion\_setReachedPoints().

{
global $lng, $ilDB;
$statement = $ilDB->prepare("SELECT user_fi, test_fi FROM tst_active WHERE active_id = ?",
array(
"integer"
)
);
$result = $ilDB->execute($statement,
array(
$active_id
)
);
$row = $ilDB->fetchAssoc($result);
$user_id = $row["user_fi"];
$test_id = $row["test_fi"];
$statement = $ilDB->prepare("SELECT obj_fi FROM tst_tests WHERE test_id = ?",
array(
"integer"
)
);
$result = $ilDB->execute($statement,
array(
$test_id
)
);
$row = $ilDB->fetchAssoc($result);
$obj_id = $row["obj_fi"];
include_once "./Modules/Test/classes/class.ilObjTest.php";
$is_anonymous = ilObjTest::_lookupAnonymity($obj_id);
include_once './Services/User/classes/class.ilObjUser.php';
$uname = ilObjUser::_lookupName($user_id);
$name = "";
if (strlen($uname["firstname"].$uname["lastname"]) == 0)
{
$name = $lng->txt("deleted_user");
}
else
{
if ($user_id == ANONYMOUS_USER_ID)
{
$name = $lastname;
}
else
{
$name = trim($uname["lastname"] . ", " . $uname["firstname"] . " " . $uname["title"]);
}
if ($is_anonymous)
{
$name = $lng->txt("anonymous");
}
}
return $name;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjTestAccess::_getPassedUsers (   $a_obj_id)

Returns an array containing the users who passed the test.

Returns an array containing the users who passed the test

Returns
array An array containing the users who passed the test. Format of the values of the resulting array: array( "user_id" => user ID, "max_points" => maximum available points in the test "reached_points" => maximum reached points of the user "mark_short" => short text of the passed mark "mark_official" => official text of the passed mark ) public

Definition at line 672 of file class.ilObjTestAccess.php.

References $data, $result, $test, $user, ASS_MarkSchema\_getMatchingMarkFromObjId(), and _getMaxPointsForTestPass().

Referenced by ilLPStatusTestPassed\_getStatusInfo().

{
global $ilDB;
$passed_users = array();
$query = sprintf("SELECT tst_active.user_fi FROM tst_active, tst_tests WHERE tst_tests.test_id = tst_active.test_fi AND tst_tests.obj_fi = %s",
$ilDB->quote($a_obj_id . "")
);
$userresult = $ilDB->query($query);
if ($userresult->numRows())
{
while ($userrow = $userresult->fetchRow(MDB2_FETCHMODE_ASSOC))
{
$user_id = $userrow["user_fi"];
$query = sprintf("SELECT tst_test_pass_result.*, tst_tests.pass_scoring, tst_tests.random_test, tst_tests.test_id FROM tst_test_pass_result, tst_active, tst_tests, object_data WHERE object_data.obj_id = tst_tests.obj_fi AND tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND object_data.obj_id = %s AND tst_test_pass_result.active_fi = tst_active.active_id ORDER BY tst_test_pass_result.pass",
$ilDB->quote($user_id . ""),
$ilDB->quote($a_obj_id . "")
);
$result = $ilDB->query($query);
$points = array();
while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
{
array_push($points, $row);
}
$reached = 0;
$max = 0;
if ($points[0]["pass_scoring"] == 0)
{
$reached = $points[count($points)-1]["points"];
$max = ilObjTestAccess::_getMaxPointsForTestPass($points[count($points)-1]["random_test"], $user_id, $points[count($points)-1]["test_id"], $points[count($points)-1]["pass"]);
if (!strlen($max))
{
include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
include_once "./Modules/Test/classes/class.ilObjTest.php";
$test = new ilObjTest($a_obj_id, false);
$test->loadFromDb();
$p = $data->getParticipants();
if (!is_null($p))
{
$user = $p[$points[count($points)-1]["active_fi"]];
if (!is_null($user))
{
$max = $user->getMaxpoints();
}
}
}
}
else
{
foreach ($points as $row)
{
if ($row["points"] > $reached)
{
$max = ilObjTestAccess::_getMaxPointsForTestPass($row["random_test"], $user_id, $row["test_id"], $row["pass"]);
if (!strlen($max))
{
include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
include_once "./Modules/Test/classes/class.ilObjTest.php";
$test = new ilObjTest($a_obj_id, false);
$test->loadFromDb();
$p = $data->getParticipants();
if (!is_null($p))
{
$user = $p[$points[count($points)-1]["active_fi"]];
if (!is_null($user))
{
$max = $user->getMaxpoints();
}
}
}
$reached = $row["points"];
}
}
}
include_once "./Modules/Test/classes/class.assMarkSchema.php";
$percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
$mark = ASS_MarkSchema::_getMatchingMarkFromObjId($a_obj_id, $percentage);
array_push($passed_users,
array(
"user_id" => $user_id,
"max_points" => $max,
"reached_points" => $reached,
"mark_short" => $mark["short_name"],
"mark_official" => $mark["official_name"],
"passed" => ($mark["passed"]) ? TRUE : FALSE,
"failed" => (!$mark["passed"]) ? TRUE : FALSE
)
);
}
}
return $passed_users;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestAccess::_getQuestionCount (   $test_id)

Calculates the number of questions in a test.

Calculates the number of questions in a test

Returns
int The number of questions in the test public

Definition at line 487 of file class.ilObjTestAccess.php.

References $result, $test, and _getTestData().

Referenced by _isComplete().

{
global $ilDB;
$num = 0;
if ($test["random_test"] == 1)
{
if ($test["random_question_count"] > 0)
{
$num = $test["random_question_count"];
}
else
{
$query = sprintf("SELECT SUM(num_of_q) AS questioncount FROM tst_test_random WHERE test_fi = %s ORDER BY test_random_id",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
$num = $row["questioncount"];
}
}
}
else
{
$query = sprintf("SELECT test_question_id FROM tst_test_question WHERE test_fi = %s",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
$num = $result->numRows();
}
return $num;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjTestAccess::_getTestData (   $test_id)

Returns the database content of a test with a given id.

Returns the database content of a test with a given id

Parameters
int$test_idDatabase id of the test
Returns
array An associative array with the contents of the tst_tests database row public

Definition at line 464 of file class.ilObjTestAccess.php.

References $result, and $test.

Referenced by _getQuestionCount().

{
global $ilDB;
$query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if (!$result->numRows())
{
return 0;
}
$test = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
return $test;
}

+ Here is the caller graph for this function:

ilObjTestAccess::_getTestIDFromObjectID (   $object_id)

Returns the ILIAS test id for a given object id.

Returns the ILIAS test id for a given object id

Parameters
integer$object_idThe object id
Returns
mixed The ILIAS test id or FALSE if the query was not successful public

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

References $result.

Referenced by _hasFinished(), and _isComplete().

{
global $ilDB;
$test_id = FALSE;
$query = sprintf("SELECT test_id FROM tst_tests WHERE obj_fi = %s",
$ilDB->quote($object_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
$test_id = $row["test_id"];
}
return $test_id;
}

+ Here is the caller graph for this function:

& ilObjTestAccess::_getTestQuestions (   $active_id,
  $pass = NULL 
)

Definition at line 344 of file class.ilObjTestAccess.php.

References $pass, and $result.

{
if (is_null($pass))
{
$pass = 0;
}
$questions = array();
global $ilDB;
$query = sprintf("SELECT test_fi FROM tst_active WHERE active_id = %s",
$ilDB->quote($active_id . "")
);
$result = $ilDB->query($query);
$test_id = "";
if ($result->numRows())
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
$test_id = $row["test_fi"];
}
else
{
return $questions;
}
$query = sprintf("SELECT qpl_questions.question_id, qpl_questions.points FROM qpl_questions, tst_test_question WHERE tst_test_question.question_fi = qpl_questions.question_id AND tst_test_question.test_fi = %s ORDER BY tst_test_question.sequence",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
// standard test
while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
{
array_push($questions, $row);
}
}
else
{
// random test
$query = sprintf("SELECT qpl_questions.question_id, qpl_questions.points FROM qpl_questions, tst_test_random_question WHERE tst_test_random_question.question_fi = qpl_questions.question_id AND tst_test_random_question.active_fi = %s AND tst_test_random_question.pass = %s ORDER BY tst_test_random_question.sequence",
$ilDB->quote($active_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
{
array_push($questions, $row);
}
}
}
return $questions;
}
ilObjTestAccess::_hasFinished (   $a_user_id,
  $a_obj_id 
)
static

Returns information if a specific user has finished a test.

Parameters
integer$user_idDatabase id of the user
integertest obj_id
Returns
bool public

Definition at line 306 of file class.ilObjTestAccess.php.

References $res, and _getTestIDFromObjectID().

Referenced by _checkCondition().

{
global $ilDB;
$query = sprintf("SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND tries > '0'",
$ilDB->quote($a_user_id . ""),
$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id) . "")
);
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestAccess::_isComplete (   $a_obj_id)

Returns true, if a test is complete for use.

Returns true, if a test is complete for use

Returns
boolean True, if the test is complete for use, otherwise false public

Definition at line 406 of file class.ilObjTestAccess.php.

References $result, $test, _getQuestionCount(), and _getTestIDFromObjectID().

{
global $ilDB;
$query = sprintf("SELECT tst_mark.*, tst_tests.* FROM tst_tests, tst_mark WHERE tst_mark.test_fi = tst_tests.test_id AND tst_tests.test_id = %s",
$ilDB->quote($test_id . "")
);
$result = $ilDB->query($query);
$found = $result->numRows();
if ($found)
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
// check for at least: title, author and minimum of 1 mark step
if ((strlen($row["title"])) &&
(strlen($row["author"])) &&
($found))
{
// check also for minmum of 1 question
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
$test = new ilObjTest($obj_id, false);
$test->loadFromDb();
if (($test->getTitle()) and ($test->author) and (count($test->mark_schema->mark_steps)) and (count($test->questions)))
{
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilObjTestAccess::_isPassed (   $user_id,
  $a_obj_id 
)

Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id.

Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id

Parameters
int$user_idThe user id
int$a_obj_idThe object id
Returns
boolean TRUE if the user passed the test, FALSE otherwise

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

References $data, $result, $test, $user, ASS_MarkSchema\_getMatchingMarkFromObjId(), and _getMaxPointsForTestPass().

Referenced by _checkCondition().

{
global $ilDB;
$query = sprintf("SELECT tst_test_pass_result.*, tst_tests.pass_scoring, tst_tests.random_test, tst_tests.test_id FROM tst_test_pass_result, tst_active, tst_tests, object_data WHERE object_data.obj_id = tst_tests.obj_fi AND tst_active.test_fi = tst_tests.test_id AND tst_active.user_fi = %s AND object_data.obj_id = %s AND tst_test_pass_result.active_fi = tst_active.active_id ORDER BY tst_test_pass_result.pass",
$ilDB->quote($user_id . ""),
$ilDB->quote($a_obj_id . "")
);
$result = $ilDB->query($query);
$points = array();
while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
{
array_push($points, $row);
}
$reached = 0;
$max = 0;
if ($points[0]["pass_scoring"] == 0)
{
$reached = $points[count($points)-1]["points"];
$max = ilObjTestAccess::_getMaxPointsForTestPass($points[count($points)-1]["random_test"], $user_id, $points[count($points)-1]["test_id"], $points[count($points)-1]["pass"]);
if (!strlen($max))
{
include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
include_once "./Modules/Test/classes/class.ilObjTest.php";
$test = new ilObjTest($a_obj_id, false);
$test->loadFromDb();
$p = $data->getParticipants();
if (!is_null($p))
{
$user = $p[$points[count($points)-1]["active_fi"]];
if (!is_null($user))
{
$max = $user->getMaxpoints();
}
}
}
}
else
{
foreach ($points as $row)
{
if ($row["points"] > $reached)
{
$max = ilObjTestAccess::_getMaxPointsForTestPass($row["random_test"], $user_id, $row["test_id"], $row["pass"]);
if (!strlen($max))
{
include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
include_once "./Modules/Test/classes/class.ilObjTest.php";
$test = new ilObjTest($a_obj_id, false);
$test->loadFromDb();
$p = $data->getParticipants();
if (!is_null($p))
{
$user = $p[$points[count($points)-1]["active_fi"]];
if (!is_null($user))
{
$max = $user->getMaxpoints();
}
}
}
$reached = $row["points"];
}
}
}
include_once "./Modules/Test/classes/class.assMarkSchema.php";
$percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
$mark = ASS_MarkSchema::_getMatchingMarkFromObjId($a_obj_id, $percentage);
return ($mark["passed"]) ? TRUE : FALSE;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestAccess::_lookupCreationComplete (   $a_obj_id)

checks wether all necessary parts of the test are given

Definition at line 276 of file class.ilObjTestAccess.php.

References $result.

Referenced by _checkAccess(), and ilObjTestListGUI\getProperties().

{
global $ilDB;
$q = sprintf("SELECT * FROM tst_tests WHERE obj_fi=%s",
$ilDB->quote($a_obj_id)
);
$result = $ilDB->query($q);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
}
if (!$row->complete)
{
return false;
}
return true;
}

+ Here is the caller graph for this function:

ilObjTestAccess::_lookupOnlineTestAccess (   $a_test_id,
  $a_user_id 
)

Checks if a user is allowd to run an online exam.

Checks if a user is allowd to run an online exam

Returns
mixed true if the user is allowed to run the online exam or if the test isn't an online exam, an alert message if the test is an online exam and the user is not allowed to run it public

Definition at line 533 of file class.ilObjTestAccess.php.

References $lng, and $result.

Referenced by ilObjTestListGUI\getProperties(), and ilObjTestGUI\infoScreen().

{
global $ilDB, $lng;
$query = sprintf("SELECT tst_tests.* FROM tst_tests WHERE tst_tests.obj_fi = %s",
$ilDB->quote($a_test_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
if ($row["fixed_participants"])
{
$query = sprintf("SELECT * FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
$ilDB->quote($row["test_id"] . ""),
$ilDB->quote($a_user_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
$row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
if (trim($row['clientip']) != "")
{
$row['clientip'] = preg_replace("/[^0-9.?*,:]+/","",$row['clientip']);
$row['clientip'] = str_replace(".","\\.",$row['clientip']);
$row['clientip'] = str_replace(Array("?","*",","), Array("[0-9]","[0-9]*","|"), $row['clientip']);
if (!preg_match("/^".$row['clientip']."$/", $_SERVER["REMOTE_ADDR"]))
{
return $lng->txt("tst_user_wrong_clientip");
}
else
{
return true;
}
}
else
{
return true;
}
}
else
{
return $lng->txt("tst_user_not_invited");
}
}
else
{
return true;
}
}
else
{
return true;
}
}

+ Here is the caller graph for this function:


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