ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSoapTestAdministration Class Reference
+ Inheritance diagram for ilSoapTestAdministration:
+ Collaboration diagram for ilSoapTestAdministration:

Public Member Functions

 ilSoapTestAdministration ()
 isAllowedCall ($sid, $active_id, $saveaction=true)
 saveQuestion ($sid, $active_id, $question_id, $pass, $solution)
 saveQuestionSolution ($sid, $active_id, $question_id, $pass, $solution)
 Save the solution of a question.
 getQuestionSolution ($sid, $active_id, $question_id, $pass)
 Get the the answers of a given question and pass for a given user.
 getTestUserData ($sid, $active_id)
 get active user data
 getPositionOfQuestion ($sid, $active_id, $question_id, $pass)
 get active user data
 getPreviousReachedPoints ($sid, $active_id, $question_id, $pass)
 Returns the previous reached points in a given pass.
 getNrOfQuestionsInPass ($sid, $active_id, $pass)
 Get the number of questions in a given pass for a given user.
 getTestResults ($sid, $test_ref_id, $sum_only)
 get results of test
 getTestIdByObjId ($sid, $test_obj_id)
 Get test ID for an object ID.
 getTestRunDates ($sid, $obj_id)
 Return array of YYYY-MM-DD date strings for which the test with object ID obj_id has archived runs.
 packageTestRun ($sid, $obj_id, $date)
 Trigger packaging of archived run for date with YYYY-MM-DD string $date for test with object ID $obj_id.
 getTestRunPackageDates ($sid, $obj_id)
 Return array of YYYY-MM-DD date strings for which the test with object ID obj_id has ZIP packages of archived runs.
 fetchTestRunPackage ($sid, $obj_id, $date)
 Return ZIP package of archived run for date.
 deleteTestRunPackage ($sid, $obj_id, $date)
 Delete package of archived run for $date for test with object ID $obj_id.
 obliterateTestRun ($sid, $obj_id, $date)
 Delete all remnants of archived run for $date for test with object ID $obj_id.
- Public Member Functions inherited from ilSoapAdministration
 ilSoapAdministration ($use_nusoap=true)
 __checkSession ($sid)
 initErrorWriter ()
 Overwrite error handler.
 __explodeSid ($sid)
 __setMessage ($a_str)
 __getMessage ()
 __appendMessage ($a_str)
 __setMessageCode ($a_code)
 __getMessageCode ()
 initAuth ($sid)
 initIlias ()
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 __raiseError ($a_message, $a_code)
 getNIC ($sid)
 get client information from current as xml result set
 isFault ($object)
 checkObjectAccess ($ref_id, $expected_type, $permission, $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true
 getInstallationInfoXML ()
 getClientInfoXML ($clientid)

Private Member Functions

 hasWritePermissionForTest ($active_id)

Additional Inherited Members

- Static Public Member Functions inherited from ilSoapAdministration
static return_bytes ($val)
 calculate bytes from K,M,G modifiers e.g: 8M = 8 * 1024 * 1024 bytes
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 $error_method = null
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true

Detailed Description

Definition at line 35 of file class.ilSoapTestAdministration.php.

Member Function Documentation

ilSoapTestAdministration::deleteTestRunPackage (   $sid,
  $obj_id,
  $date 
)

Delete package of archived run for $date for test with object ID $obj_id.

Parameters
string$sidSession ID
int$obj_idTest object ID
string$dateDate of run package to delete, YYYY-MM-DD format
Returns
boolean $result TRUE if successful

Definition at line 863 of file class.ilSoapTestAdministration.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($obj_id))
{
return $this->__raiseError('No test object id given. Aborting!',
'Client');
}
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$test_obj->loadFromDb();
return $test_obj->deleteRunPackage($date);
}

+ Here is the call graph for this function:

ilSoapTestAdministration::fetchTestRunPackage (   $sid,
  $obj_id,
  $date 
)

Return ZIP package of archived run for date.

Parameters
string$sidSession ID
int$obj_idTest object ID
string$dateYYYY-MM-DD string specifying run date
Returns
string ZIP file of run package as Base64-encoded string

Definition at line 820 of file class.ilSoapTestAdministration.php.

References $filename, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($obj_id))
{
return $this->__raiseError('No test object id given. Aborting!',
'Client');
}
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$test_obj->loadFromDb();
$filename = $test_obj->getRunPackageFilename($date);
if ('' == $filename)
{
return $this->__raiseError('Test with ID $obj_id has no packaged run for $date. Aborting!',
'Client');
}
else
{
$content = file_get_contents($filename);
$content = base64_encode($content);
return $content;
}
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getNrOfQuestionsInPass (   $sid,
  $active_id,
  $pass 
)

Get the number of questions in a given pass for a given user.

Parameters
string$sidSession ID
long$active_idActive user ID
integer$passTest pass
Returns
integer Question position in the given test pass

Definition at line 532 of file class.ilSoapTestAdministration.php.

References $ilDB, $lng, $pass, $row, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and isAllowedCall().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if (!$this->isAllowedCall($sid, $active_id, false))
{
return $this->__raiseError("The required user information is only available for active users.", "");
}
global $lng, $ilDB;
$result = $ilDB->queryF("SELECT tst_tests.random_test FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
array('integer'),
array($active_id)
);
if ($result->numRows() != 1) return 0;
$row = $ilDB->fetchAssoc($result);
$is_random = $row["random_test"];
include_once "./Modules/Test/classes/class.ilTestSequence.php";
$sequence = new ilTestSequence($active_id, $pass, $is_random);
return $sequence->getUserQuestionCount();
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getPositionOfQuestion (   $sid,
  $active_id,
  $question_id,
  $pass 
)

get active user data

Parameters
string$sidSession ID
long$active_idActive user ID
integer$question_idQuestion ID
integer$passTest pass
Returns
integer Question position in the given test pass

Definition at line 429 of file class.ilSoapTestAdministration.php.

References $ilDB, $lng, $pass, $row, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and isAllowedCall().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if (!$this->isAllowedCall($sid, $active_id, false))
{
return $this->__raiseError("The required user information is only available for active users.", "");
}
global $lng, $ilDB;
$result = $ilDB->queryF("SELECT tst_tests.random_test FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
array('integer'),
array($active_id)
);
if ($result->numRows() != 1) return -1;
$row = $ilDB->fetchAssoc($result);
$is_random = $row["random_test"];
include_once "./Modules/Test/classes/class.ilTestSequence.php";
$sequence = new ilTestSequence($active_id, $pass, $is_random);
return $sequence->getSequenceForQuestion($question_id);
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getPreviousReachedPoints (   $sid,
  $active_id,
  $question_id,
  $pass 
)

Returns the previous reached points in a given pass.

Parameters
string$sidSession ID
long$active_idActive user ID
integer$question_idQuestion ID
integer$passTest pass
Returns
array Reached points of the previous questions in this pass

Definition at line 468 of file class.ilSoapTestAdministration.php.

References $ilDB, $lng, $pass, $row, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and isAllowedCall().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if (!$this->isAllowedCall($sid, $active_id, false))
{
return $this->__raiseError("The required user information is only available for active users.", "");
}
global $lng, $ilDB;
$result = $ilDB->queryF("SELECT tst_tests.random_test FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
array('integer'),
array($active_id)
);
if ($result->numRows() != 1) return -1;
$row = $ilDB->fetchAssoc($result);
$is_random = $row["random_test"];
include_once "./Modules/Test/classes/class.ilTestSequence.php";
$sequence = new ilTestSequence($active_id, $pass, $is_random);
$result = $ilDB->queryF("SELECT question_fi, points FROM tst_test_result WHERE active_fi = %s AND pass = %s",
array('integer', 'integer'),
array($active_id, $pass)
);
$reachedpoints = array();
while ($row = $ilDB->fetchAssoc($result))
{
$reachedpoints[$row["question_fi"]] = $row["points"];
}
$atposition = FALSE;
$pointsforposition = array();
foreach ($sequence->getUserSequence() as $seq)
{
if (!$atposition)
{
$qid = $sequence->getQuestionForSequence($seq);
if ($qid == $question_id)
{
$atposition = TRUE;
}
else
{
array_push($pointsforposition, $reachedpoints[$qid]);
}
}
}
return $pointsforposition;
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getQuestionSolution (   $sid,
  $active_id,
  $question_id,
  $pass 
)

Get the the answers of a given question and pass for a given user.

Parameters
string$sidSession ID
long$active_idActive user ID
integer$question_idQuestion ID
integer$passTest pass
Returns
array String array containing the question solution (in triplets of value1, value2, points)

Definition at line 278 of file class.ilSoapTestAdministration.php.

References $ilDB, $pass, $row, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and isAllowedCall().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if (!$this->isAllowedCall($sid, $active_id, false))
{
return $this->__raiseError("The required user information is only available for active users.", "");
}
$solution = array();
// Include main header
global $ilDB;
$use_previous_answers = 1;
$result = $ilDB->queryF("SELECT tst_tests.use_previous_answers FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
array('integer'),
array($active_id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
$use_previous_answers = $row["use_previous_answers"];
}
$lastpass = 0;
if ($use_previous_answers)
{
$result = $ilDB->queryF("SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
array('integer', 'integer'),
array($active_id, $question_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$lastpass = $row["maxpass"];
}
}
else
{
$lastpass = $pass;
}
if (($active_id > 0) && ($question_id > 0) && (strlen($lastpass) > 0))
{
$result = $ilDB->queryF("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array('integer', 'integer', 'integer'),
array($active_id, $question_id, $lastpass)
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
array_push($solution, $row["value1"]);
array_push($solution, $row["value2"]);
array_push($solution, $row["points"]);
}
}
}
return $solution;
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getTestIdByObjId (   $sid,
  $test_obj_id 
)

Get test ID for an object ID.

Parameters
string$sidSession ID
int$test_obj_idTest object ID
Returns
int Test ID

Definition at line 689 of file class.ilSoapTestAdministration.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($test_obj_id))
{
return $this->__raiseError('No test object id given. Aborting!',
'Client');
}
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($test_obj_id, false);
$test_obj->loadFromDb();
$test_id = $test_obj->getTestId();
return $test_id ? $test_id : "0";
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getTestResults (   $sid,
  $test_ref_id,
  $sum_only 
)

get results of test

Parameters
string$sid
int$test_ref_id
boolean$sum_only
Returns
XMLResultSet with columns sum only = true: user_id, login, firstname, lastname, matriculation, maximum points, received points sum only = false: user_id, login, firstname, lastname, matriculation, question id, question title, question points, received points

Definition at line 573 of file class.ilSoapTestAdministration.php.

References $data, $ilLog, $ref_id, $row, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ilObject\_lookupObjectId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($test_ref_id))
{
return $this->__raiseError('No test id given. Aborting!',
'Client');
}
global $rbacsystem, $tree, $ilLog;
if(ilObject::_isInTrash($test_ref_id))
{
return $this->__raiseError('Test is trashed. Aborting!',
'Client');
}
// get obj_id
if(!$obj_id = ilObject::_lookupObjectId($test_ref_id))
{
return $this->__raiseError('No test found for id: '.$test_ref_id,
'Client');
}
// Check access
$permission_ok = false;
foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
{
if($rbacsystem->checkAccess('write',$ref_id))
{
$permission_ok = true;
break;
}
}
if(!$permission_ok)
{
return $this->__raiseError('No permission to edit the object with id: '.$test_ref_id,
'Server');
}
// store into xml result set
include_once './webservice/soap/classes/class.ilXMLResultSet.php';
include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
$xmlResultSet = new ilXMLResultSet();
$xmlResultSet->addColumn("user_id");
$xmlResultSet->addColumn("login");
$xmlResultSet->addColumn("firstname");
$xmlResultSet->addColumn("lastname");
$xmlResultSet->addColumn("matriculation");
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$participants = $test_obj->getTestParticipants();
if ($sum_only)
{
$data = $test_obj->getAllTestResults($participants, false);
// create xml
$xmlResultSet->addColumn("maximum_points");
$xmlResultSet->addColumn("received_points");
// skip titles
$titles = array_shift($data);
foreach ($data as $row) {
$xmlRow = new ilXMLResultSetRow();
$xmlRow->setValue(0, $row["user_id"]);
$xmlRow->setValue(1, $row["login"]);
$xmlRow->setValue(2, $row["firstname"]);
$xmlRow->setValue(3, $row["lastname"]);
$xmlRow->setValue(4, $row["matriculation"]);
$xmlRow->setValue(5, $row["max_points"]);
$xmlRow->setValue(6, $row["reached_points"]);
$xmlResultSet->addRow($xmlRow);
}
} else {
$data = $test_obj->getDetailedTestResults($participants);
// create xml
$xmlResultSet->addColumn("question_id");
$xmlResultSet->addColumn("question_title");
$xmlResultSet->addColumn("maximum_points");
$xmlResultSet->addColumn("received_points");
foreach ($data as $row) {
$xmlRow = new ilXMLResultSetRow();
$xmlRow->setValue(0, $row["user_id"]);
$xmlRow->setValue(1, $row["login"]);
$xmlRow->setValue(2, $row["firstname"]);
$xmlRow->setValue(3, $row["lastname"]);
$xmlRow->setValue(4, $row["matriculation"]);
$xmlRow->setValue(5, $row["question_id"]);
$xmlRow->setValue(6, $row["question_title"]);
$xmlRow->setValue(7, $row["max_points"]);
$xmlRow->setValue(8, $row["reached_points"]);
$xmlResultSet->addRow($xmlRow);
}
}
// create writer
$xmlWriter = new ilXMLResultSetWriter($xmlResultSet);
$xmlWriter->start();
return $xmlWriter->getXML();
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getTestRunDates (   $sid,
  $obj_id 
)

Return array of YYYY-MM-DD date strings for which the test with object ID obj_id has archived runs.

Parameters
string$sidSession ID
int$obj_idTest object ID
Returns
array Array of date strings

Definition at line 722 of file class.ilSoapTestAdministration.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($obj_id))
{
return $this->__raiseError('No test object id given. Aborting!',
'Client');
}
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$test_obj->loadFromDb();
return $test_obj->getRunDates();
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getTestRunPackageDates (   $sid,
  $obj_id 
)

Return array of YYYY-MM-DD date strings for which the test with object ID obj_id has ZIP packages of archived runs.

Parameters
string$sidSession ID
int$obj_idTest object ID
Returns
array Array of date strings

Definition at line 788 of file class.ilSoapTestAdministration.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($obj_id))
{
return $this->__raiseError('No test object id given. Aborting!',
'Client');
}
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$test_obj->loadFromDb();
return $test_obj->getRunPackageDates();
}

+ Here is the call graph for this function:

ilSoapTestAdministration::getTestUserData (   $sid,
  $active_id 
)

get active user data

Parameters
string$sid
long$active_id
Returns
array String array containing fullname, title, firstname, lastname, login

Definition at line 351 of file class.ilSoapTestAdministration.php.

References $data, $ilDB, $lng, $row, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and isAllowedCall().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if (!$this->isAllowedCall($sid, $active_id, false))
{
return $this->__raiseError("The required user information is only available for active users.", "");
}
global $lng, $ilDB;
$result = $ilDB->queryF("SELECT user_fi, test_fi FROM tst_active WHERE active_id = %s",
array('integer'),
array($active_id)
);
$row = $ilDB->fetchAssoc($result);
$user_id = $row["user_fi"];
$test_id = $row["test_fi"];
$result = $ilDB->queryF("SELECT anonymity FROM tst_tests WHERE test_id = %s",
array('integer'),
array($test_id)
);
$row = $ilDB->fetchAssoc($result);
$anonymity = $row["anonymity"];
$result = $ilDB->queryF("SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
array('integer'),
array($user_id)
);
$userdata = array();
if ($result->numRows() == 0)
{
$userdata["fullname"] = $lng->txt("deleted_user");
$userdata["title"] = "";
$userdata["firstname"] = "";
$userdata["lastname"] = $lng->txt("anonymous");
$userdata["login"] = "";
}
else
{
$data = $ilDB->fetchAssoc($result);
if (($user_id == ANONYMOUS_USER_ID) || ($anonymity))
{
$userdata["fullname"] = $lng->txt("anonymous");
$userdata["title"] = "";
$userdata["firstname"] = "";
$userdata["lastname"] = $lng->txt("anonymous");
$userdata["login"] = "";
}
else
{
$userdata["fullname"] = trim($data["title"] . " " . $data["firstname"] . " " . $data["lastname"]);
$userdata["title"] = $data["title"];
$userdata["firstname"] = $data["firstname"];
$userdata["lastname"] = $data["lastname"];
$userdata["login"] = $data["login"];
}
}
return array_values($userdata);
}

+ Here is the call graph for this function:

ilSoapTestAdministration::hasWritePermissionForTest (   $active_id)
private

Definition at line 42 of file class.ilSoapTestAdministration.php.

References $ilDB, $ref_id, $row, and ilObject\_getAllReferences().

Referenced by isAllowedCall().

{
global $ilDB;
global $ilAccess;
$permission_ok = false;
$result = $ilDB->queryF("SELECT tst_tests.obj_fi FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
array('integer'),
array($active_id)
);
$row = $ilDB->fetchAssoc($result);
if ($row['obj_fi'])
{
$obj_id = $row['obj_fi'];
foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
{
if ($ilAccess->checkAccess("write", "", $ref_id))
{
$permission_ok = true;
break;
}
}
}
return $permission_ok;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapTestAdministration::ilSoapTestAdministration ( )

Definition at line 37 of file class.ilSoapTestAdministration.php.

References ilSoapAdministration\ilSoapAdministration().

+ Here is the call graph for this function:

ilSoapTestAdministration::isAllowedCall (   $sid,
  $active_id,
  $saveaction = true 
)

Definition at line 68 of file class.ilSoapTestAdministration.php.

References $client, $diff, $ilDB, $row, and hasWritePermissionForTest().

Referenced by getNrOfQuestionsInPass(), getPositionOfQuestion(), getPreviousReachedPoints(), getQuestionSolution(), getTestUserData(), saveQuestion(), and saveQuestionSolution().

{
global $ilDB;
global $ilUser;
if ($this->hasWritePermissionForTest($active_id)) return TRUE;
if ($saveaction)
{
$result = $ilDB->queryF("SELECT * FROM tst_times WHERE active_fi = %s ORDER BY started DESC",
array('integer'),
array($active_id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
if (preg_match("/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/", $row["started"], $matches))
{
$time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$now = time();
$diff = $now - $time;
$client = explode("::", $sid);
global $ilClientIniFile;
$expires = $ilClientIniFile->readVariable('session','expire');
if ($diff <= $expires)
{
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
else
{
$result = $ilDB->queryF("SELECT user_fi FROM tst_active WHERE active_id = %s",
array('integer'),
array($active_id)
);
$row = $ilDB->fetchAssoc($result);
if ($row['user_fi'] == $ilUser->getId())
{
return TRUE;
}
else
{
return FALSE;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapTestAdministration::obliterateTestRun (   $sid,
  $obj_id,
  $date 
)

Delete all remnants of archived run for $date for test with object ID $obj_id.

Parameters
string$sidSession ID
int$obj_idTest object ID
string$dateDate of run to package, YYYY-MM-DD format
Returns
boolean $result TRUE if successful

Definition at line 895 of file class.ilSoapTestAdministration.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($obj_id))
{
return $this->__raiseError('No test object id given. Aborting!',
'Client');
}
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$test_obj->loadFromDb();
return $test_obj->obliterateRun($date);
}

+ Here is the call graph for this function:

ilSoapTestAdministration::packageTestRun (   $sid,
  $obj_id,
  $date 
)

Trigger packaging of archived run for date with YYYY-MM-DD string $date for test with object ID $obj_id.

Parameters
string$sidSession ID
int$obj_idTest object ID
string$dateDate of run to package, YYYY-MM-DD format
Returns
boolean $result TRUE if successful

Definition at line 755 of file class.ilSoapTestAdministration.php.

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($obj_id))
{
return $this->__raiseError('No test object id given. Aborting!',
'Client');
}
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$test_obj->loadFromDb();
return $test_obj->packageRun($date);
}

+ Here is the call graph for this function:

ilSoapTestAdministration::saveQuestion (   $sid,
  $active_id,
  $question_id,
  $pass,
  $solution 
)

Definition at line 129 of file class.ilSoapTestAdministration.php.

References $GLOBALS, $ilDB, $pass, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), assQuestion\_instanciateQuestion(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and isAllowedCall().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if (!$this->isAllowedCall($sid, $active_id))
{
return $this->__raiseError("The required user information is only available for active users.", "");
}
if (is_array($solution) && (array_key_exists("item", $solution))) $solution = $solution["item"];
$ilDB = $GLOBALS['ilDB'];
if (($active_id > 0) && ($question_id > 0) && (strlen($pass) > 0))
{
$affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array('integer', 'integer', 'integer'),
array($active_id, $question_id, $pass)
);
}
$totalrows = 0;
for($i = 0; $i < count($solution); $i += 3)
{
$next_id = $ilDB->nextId('tst_solutions');
$affectedRows = $ilDB->insert("tst_solutions", array(
"solution_id" => array("integer", $next_id),
"active_fi" => array("integer", $active_id),
"question_fi" => array("integer", $question_id),
"value1" => array("clob", $solution[$i]),
"value2" => array("clob", $solution[$i+1]),
"points" => array("float", $solution[$i+2]),
"pass" => array("integer", $pass),
"tstamp" => array("integer", time())
));
$totalrows += $affectedRows;
}
if ($totalrows == 0)
{
return $this->__raiseError("Wrong solution data. ILIAS did not execute any database queries: Solution data: " . print_r($solution, true));
}
else
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question = assQuestion::_instanciateQuestion($question_id);
$question->calculateResultsFromSolution($active_id, $pass);
}
return true;
}

+ Here is the call graph for this function:

ilSoapTestAdministration::saveQuestionSolution (   $sid,
  $active_id,
  $question_id,
  $pass,
  $solution 
)

Save the solution of a question.

Parameters
string$sidSession ID
long$active_idActive user ID
integer$question_idQuestion ID
integer$passTest pass
string$solutionXML string containing the solution
Returns
array String array containing the question solution (in triplets of value1, value2, points)

Definition at line 193 of file class.ilSoapTestAdministration.php.

References $GLOBALS, $ilDB, $pass, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), assQuestion\_instanciateQuestion(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and isAllowedCall().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if (!$this->isAllowedCall($sid, $active_id))
{
return $this->__raiseError("The required user information is only available for active users.", "");
}
$solutions = array();
if (preg_match("/<values>(.*?)<\/values>/is", $solution, $matches))
{
if (preg_match_all("/<value>(.*?)<\/value><value>(.*?)<\/value><points>(.*?)<\/points>/is", $solution, $matches, PREG_SET_ORDER))
{
foreach ($matches as $match)
{
if (count($match) == 4)
{
for ($i = 1; $i < count($match); $i++)
{
array_push($solutions, trim($match[$i]));
}
}
}
}
}
if (count($solutions) == 0)
{
return $this->__raiseError("Wrong solution data. ILIAS did not find one or more solution triplets: $solution", "");
}
// Include main header
$ilDB = $GLOBALS['ilDB'];
if (($active_id > 0) && ($question_id > 0) && (strlen($pass) > 0))
{
$affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
array('integer', 'integer', 'integer'),
array($active_id, $question_id, $pass)
);
}
$totalrows = 0;
for($i = 0; $i < count($solutions); $i += 3)
{
$next_id = $ilDB->nextId('tst_solutions');
$affectedRows = $ilDB->insert("tst_solutions", array(
"solution_id" => array("integer", $next_id),
"active_fi" => array("integer", $active_id),
"question_fi" => array("integer", $question_id),
"value1" => array("clob", $solutions[$i]),
"value2" => array("clob", $solutions[$i+1]),
"points" => array("float", $solutions[$i+2]),
"pass" => array("integer", $pass),
"tstamp" => array("integer", time())
));
$totalrows += $affectedRows;
}
if (count($totalrows) == 0)
{
return $this->__raiseError("Wrong solution data. ILIAS did not execute any database queries");
}
else
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question = assQuestion::_instanciateQuestion($question_id);
$question->calculateResultsFromSolution($active_id, $pass);
}
return "TRUE";
}

+ Here is the call graph for this function:


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