ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $participants->add($user_id, IL_CRS_MEMBER);
167  }
168 
169  return;
170  }
171 
176  public static function assignTutorsToCourse($context, $params)
177  {
178  /*
179  * Modelling:
180 
181  <bpmn2:extensionElements>
182  <ilias:properties>
183  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="assignTutorsToCourse" />
184  </ilias:properties>
185  </bpmn2:extensionElements>
186 
187  */
188 
189  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
190  $input_params = $params[0];
191  $output_params = $params[1];
192 
193  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
194  foreach ($input_params['usrIdList'] as $user_id) {
195  $participants->add($user_id, IL_CRS_TUTOR);
196  }
197  return;
198  }
199 
204  public static function assignAdminsToCourse($context, $params)
205  {
206  /*
207  * Modelling:
208 
209  <bpmn2:extensionElements>
210  <ilias:properties>
211  <ilias:libraryCall location="Services/WorkflowEngine/classes/tasks/class.ilModulesCourseTasks.php" api="ilModulesCourseTasks" method="assignAdminsToCourse" />
212  </ilias:properties>
213  </bpmn2:extensionElements>
214 
215  */
216 
217  require_once './Modules/Course/classes/class.ilCourseParticipants.php';
218  $input_params = $params[0];
219  $output_params = $params[1];
220 
221  $participants = ilCourseParticipants::_getInstanceByObjId(ilObject::_lookupObjectId($input_params['crsRefId']));
222  foreach ($input_params['usrIdList'] as $user_id) {
223  $participants->add($user_id, IL_CRS_ADMIN);
224  }
225  return;
226  }
227 }
$params
Definition: disable.php:11
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)