ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilModulesTestTasks.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 {
19  public static function createTestInCourse($context, $params)
20  {
21  //IN: targetref, titlestring
22  //OUT: refid
23  $input_params = $params[0];
24  $output_params =$params[1];
25 
26  require_once './Modules/Test/classes/class.ilObjTest.php';
27 
28  $test_object = new ilObjTest();
29  $test_object->setType('tst');
30  $test_object->setTitle('Prüfung'); // Input?
31  $test_object->setDescription("");
32  $test_object->create(true); // true for upload
33  $test_object->createReference();
34  $test_object->putInTree($input_params['crsRefId']);
35  $test_object->setPermissions($input_params['crsRefId']);
36  $test_object->setFixedParticipants(1);
37  $test_object->createMetaData();
38  $test_object->updateMetaData();
39  $test_object->saveToDb();
40 
41  $retval = array($output_params[0] => $test_object->getRefId());
42 
43  return $retval;
44  }
45 
52  public static function assignUsersToTest($context, $params)
53  {
54  require_once './Modules/Test/classes/class.ilObjTest.php';
55  //IN: anonuserlist
56  //OUT: void
57 
58  $input_params = $params[0];
59  $output_params =$params[1];
60 
61  $usr_id_list = array();
62 
63  if (isset($input_params['usrIdList'])) {
64  $usr_id_list = $input_params['usrIdList'];
65  }
66  if (isset($input_params['discloseMap'])) {
67  foreach ($input_params['discloseMap'] as $map_entry) {
68  $usr_id_list[] = $map_entry['Anon User'];
69  }
70  }
71 
72  $test_object = new ilObjTest($input_params['tstRefId']);
73  foreach ($usr_id_list as $user_id) {
74  $test_object->inviteUser($user_id);
75  }
76  }
77 }
$params
Definition: disable.php:11
Class ilModulesTestTasks.
static createTestInCourse($context, $params)
Create styles array
The data for the language used.
static assignUsersToTest($context, $params)