ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
65  $usr_id_list = $input_params['usrIdList'];
66  }
67  if(isset($input_params['discloseMap']))
68  {
69  foreach($input_params['discloseMap'] as $map_entry)
70  {
71  $usr_id_list[] = $map_entry['Anon User'];
72  }
73  }
74 
75  $test_object = new ilObjTest($input_params['tstRefId']);
76  foreach($usr_id_list as $user_id)
77  {
78  $test_object->inviteUser($user_id);
79  }
80  }
81 }
Class ilModulesTestTasks.
static createTestInCourse($context, $params)
Create styles array
The data for the language used.
static assignUsersToTest($context, $params)
$params
Definition: example_049.php:96