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

Public Member Functions

 ilSoapTestAdministration ()
 saveQuestionResult ($sid, $user_id, $test_id, $question_id, $pass, $solution)
 saveQuestion ($sid, $active_id, $question_id, $pass, $solution)
 getQuestionSolution ($sid, $active_id, $question_id, $pass)
 getTestResults ($sid, $test_ref_id, $sum_only)
 get results of test
- 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)
 __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)

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

Detailed Description

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

Member Function Documentation

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

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

References $GLOBALS, $pass, $result, ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), and DB_FETCHMODE_ASSOC.

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
$solution = array();
// Include main header
include_once './include/inc.header.php';
$ilDB = $GLOBALS['ilDB'];
if (($active_id > 0) && ($question_id > 0) && (strlen($pass) > 0))
{
$query = sprintf("SELECT * FROM tst_solutions ".
"WHERE active_fi = %s AND ".
"question_fi = %s AND ".
"pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($pass . "")
);
$result = $ilDB->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
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::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 174 of file class.ilSoapTestAdministration.php.

References $data, $ilLog, $ref_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_isInTrash(), and ilObject\_lookupObjectId().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
if(!strlen($test_ref_id))
{
return $this->__raiseError('No test id given. Aborting!',
'Client');
}
include_once './include/inc.header.php';
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('edit',$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);
#print_r($data);
// 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::ilSoapTestAdministration ( )

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

References ilSoapAdministration\ilSoapAdministration().

+ Here is the call graph for this function:

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

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

References $GLOBALS, $pass, ilSoapAdministration\__checkSession(), and ilSoapAdministration\__raiseError().

{
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
if (is_array($solution) && (array_key_exists("item", $solution))) $solution = $solution["item"];
// Include main header
include_once './include/inc.header.php';
$ilDB = $GLOBALS['ilDB'];
if (($active_id > 0) && ($question_id > 0) && (strlen($pass) > 0))
{
$deletequery = sprintf("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($pass . "")
);
$ilDB->query($deletequery);
}
for($i = 0; $i < count($solution); $i += 3)
{
$query = sprintf("INSERT INTO tst_solutions ".
"SET active_fi = %s, ".
"question_fi = %s, ".
"value1 = %s, ".
"value2 = %s, ".
"points = %s, ".
"pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($solution[$i]),
$ilDB->quote($solution[$i+1]),
$ilDB->quote($solution[$i+2]),
$ilDB->quote($pass . "")
);
$ilDB->query($query);
}
return true;
}

+ Here is the call graph for this function:

ilSoapTestAdministration::saveQuestionResult (   $sid,
  $user_id,
  $test_id,
  $question_id,
  $pass,
  $solution 
)

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

References $GLOBALS, $pass, ilSoapAdministration\__checkSession(), ilSoapAdministration\__raiseError(), and ilObjTest\_getActiveIdOfUser().

{
include_once './include/inc.header.php';
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
}
// Include main header
include_once "./Modules/Test/classes/class.ilObjTest.php";
$active_id = ilObjTest::_getActiveIdOfUser($user_id, $test_id);
$ilDB = $GLOBALS['ilDB'];
if (($active_id > 0) && ($question_id > 0) && (strlen($pass) > 0))
{
$deletequery = sprintf("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($pass . "")
);
$ilDB->query($deletequery);
}
$saved_solutions = FALSE;
for($i = 0; $i < count($solution); $i += 3)
{
$query = sprintf("INSERT INTO tst_solutions ".
"SET active_fi = %s, ".
"question_fi = %s, ".
"value1 = %s, ".
"value2 = %s, ".
"points = %s, ".
"pass = %s",
$ilDB->quote($active_id . ""),
$ilDB->quote($question_id . ""),
$ilDB->quote($solution[$i]),
$ilDB->quote($solution[$i+1]),
$ilDB->quote($solution[$i+2]),
$ilDB->quote($pass . "")
);
$saved_solutions = TRUE;
$ilDB->query($query);
}
return $saved_solutions;
}

+ Here is the call graph for this function:


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