ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilModulesCourseTasks.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 readLearnersFromCourse($context, $params)
20  {
21  /*
22  * Modelling:
23 
24  <bpmn2:extensionElements>
25  <ilias:properties>
26  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="readLearnersFromCourse" />
27  </ilias:properties>
28  </bpmn2:extensionElements>
29 
30  */
31  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
32  $input_params = $params[0];
33  $output_params = $params[1];
34 
35  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
36  $learners = $participants->getMembers();
37  $retval = array($output_params[0] => $learners);
38 
39  return $retval;
40  }
41 
48  public static function readTutorsFromCourse($context, $params)
49  {
50  /*
51  * Modelling:
52 
53  <bpmn2:extensionElements>
54  <ilias:properties>
55  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="readTutorsFromCourse" />
56  </ilias:properties>
57  </bpmn2:extensionElements>
58 
59  */
60 
61  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
62  $input_params = $params[0];
63  $output_params = $params[1];
64 
65  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
66  $tutors = $participants->getTutors();
67  $retval = array($output_params[0] => $tutors);
68 
69  return $retval;
70  }
71 
78  public static function readAdminsFromCourse($context, $params)
79  {
80  /*
81  * Modelling:
82 
83  <bpmn2:extensionElements>
84  <ilias:properties>
85  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="readAdminsFromCourse" />
86  </ilias:properties>
87  </bpmn2:extensionElements>
88 
89  */
90 
91  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
92  $input_params = $params[0];
93  $output_params = $params[1];
94 
95  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
96  $admins = $participants->getAdmins();
97  $retval = array($output_params[0] => $admins);
98 
99  return $retval;
100  }
101 
108  public static function createCourse($context, $params)
109  {
110  /*
111  * Modelling:
112 
113  <bpmn2:extensionElements>
114  <ilias:properties>
115  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="createCourse" />
116  </ilias:properties>
117  </bpmn2:extensionElements>
118 
119  */
120 
121 
122  $input_params = $params[0];
123  $output_params =$params[1];
124 
125  require_once './Modules/Course/classes/class.ilObjCourse.php';
126 
127  $course_object = new ilObjCourse();
128  $course_object->setType('crs');
129  $course_object->setTitle($input_params['crsTitle']);
130  $course_object->setDescription("");
131  $course_object->create(true); // true for upload
132  $course_object->createReference();
133  $course_object->putInTree($input_params['destRefId']);
134  $course_object->setPermissions($input_params['destRefId']);
135 
136  $retval = array($output_params[0] => $course_object->getRefId());
137 
138  return $retval;
139  }
140 
147  public static function assignLearnersToCourse($context, $params)
148  {
149  /*
150  * Modelling:
151 
152  <bpmn2:extensionElements>
153  <ilias:properties>
154  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="assignLearnersToCourse" />
155  </ilias:properties>
156  </bpmn2:extensionElements>
157 
158  */
159 
160  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
161  $input_params = $params[0];
162  $output_params = $params[1];
163 
164  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
165  foreach($input_params['usrIdList'] as $user_id)
166  {
167  $participants->add($user_id, IL_CRS_MEMBER);
168  }
169 
170  return;
171  }
172 
177  public static function assignTutorsToCourse($context, $params)
178  {
179  /*
180  * Modelling:
181 
182  <bpmn2:extensionElements>
183  <ilias:properties>
184  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="assignTutorsToCourse" />
185  </ilias:properties>
186  </bpmn2:extensionElements>
187 
188  */
189 
190  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
191  $input_params = $params[0];
192  $output_params = $params[1];
193 
194  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
195  foreach($input_params['usrIdList'] as $user_id)
196  {
197  $participants->add($user_id, IL_CRS_TUTOR);
198  }
199  return;
200  }
201 
206  public static function assignAdminsToCourse($context, $params)
207  {
208  /*
209  * Modelling:
210 
211  <bpmn2:extensionElements>
212  <ilias:properties>
213  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="assignAdminsToCourse" />
214  </ilias:properties>
215  </bpmn2:extensionElements>
216 
217  */
218 
219  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
220  $input_params = $params[0];
221  $output_params = $params[1];
222 
223  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
224  foreach($input_params['usrIdList'] as $user_id)
225  {
226  $participants->add($user_id, IL_CRS_ADMIN);
227  }
228  return;
229  }
230 
231 }
static assignTutorsToCourse($context, $params)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static readTutorsFromCourse($context, $params)
const IL_CRS_TUTOR
static _lookupObjectId($a_ref_id)
lookup object id
const IL_CRS_MEMBER
static readLearnersFromCourse($context, $params)
Class ilObjCourse.
static readAdminsFromCourse($context, $params)
const IL_CRS_ADMIN
Base class for course and group participants.
Create styles array
The data for the language used.
Class ilModulesCourseTasks.
static assignLearnersToCourse($context, $params)
static createCourse($context, $params)
static assignAdminsToCourse($context, $params)
$params
Definition: example_049.php:96