ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilSoapCourseAdministration Class Reference
+ Inheritance diagram for ilSoapCourseAdministration:
+ Collaboration diagram for ilSoapCourseAdministration:

Public Member Functions

 ilSoapCourseAdministration ()
 
 addCourse ($sid, $target_id, $crs_xml)
 
 deleteCourse ($sid, $course_id)
 
 assignCourseMember ($sid, $course_id, $user_id, $type)
 
 excludeCourseMember ($sid, $course_id, $user_id)
 
 isAssignedToCourse ($sid, $course_id, $user_id)
 
 getCourseXML ($sid, $course_id)
 
 updateCourse ($sid, $course_id, $xml)
 
 getCoursesForUser ($sid, $parameters)
 get courses which belong to a specific user, fullilling the status More...
 
- Public Member Functions inherited from ilSoapAdministration
 ilSoapAdministration ($use_nusoap=true)
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 
 initIlias ()
 
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 
 __raiseError ($a_message, $a_code)
 
 getNIC ($sid)
 get client information from current as xml result set More...
 
 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 More...
 
 getInstallationInfoXML ()
 
 getClientInfoXML ($clientid)
 

Data Fields

const MEMBER = 1
 
const TUTOR = 2
 
const ADMIN = 4
 
const OWNER = 8
 
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 
 $error_method = null
 

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 More...
 
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true
 

Detailed Description

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

Member Function Documentation

◆ addCourse()

ilSoapCourseAdministration::addCourse (   $sid,
  $target_id,
  $crs_xml 
)

Definition at line 49 of file class.ilSoapCourseAdministration.php.

50 {
51 $this->initAuth($sid);
52 $this->initIlias();
53
54 if(!$this->__checkSession($sid))
55 {
56 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
57 }
58
59 if(!is_numeric($target_id))
60 {
61 return $this->__raiseError('No valid target id given. Please choose an existing reference id of an ILIAS category',
62 'Client');
63 }
64
65 global $rbacsystem;
66
67 if(!$target_obj =& ilObjectFactory::getInstanceByRefId($target_id, false))
68 {
69 return $this->__raiseError('No valid target given.', 'Client');
70 }
71
73 {
74 return $this->__raiseError("Parent with ID $target_id has been deleted.", 'CLIENT_OBJECT_DELETED');
75 }
76
77 if(!$rbacsystem->checkAccess('create',$target_id,'crs'))
78 {
79 return $this->__raiseError('Check access failed. No permission to create courses','Server');
80 }
81
82
83 // Start import
84 include_once("Modules/Course/classes/class.ilObjCourse.php");
85
86 $newObj = new ilObjCourse();
87 $newObj->setType('crs');
88 $newObj->setTitle('dummy');
89 $newObj->setDescription("");
90 $newObj->create(true); // true for upload
91 $newObj->createReference();
92 $newObj->putInTree($target_id);
93 $newObj->setPermissions($target_id);
94
95 include_once 'Modules/Course/classes/class.ilCourseXMLParser.php';
96
97 $xml_parser = new ilCourseXMLParser($newObj);
98 $xml_parser->setXMLContent($crs_xml);
99 $xml_parser->startParsing();
100 return $newObj->getRefId() ? $newObj->getRefId() : "0";
101
102 }
Class ilObjCourse.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
_isInTrash($a_ref_id)
checks wether object is in trash
__raiseError($a_message, $a_code)
$target_id
Definition: goto.php:88

References $target_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_isInTrash(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ assignCourseMember()

ilSoapCourseAdministration::assignCourseMember (   $sid,
  $course_id,
  $user_id,
  $type 
)

Definition at line 168 of file class.ilSoapCourseAdministration.php.

169 {
170 $this->initAuth($sid);
171 $this->initIlias();
172
173 if(!$this->__checkSession($sid))
174 {
175 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
176 }
177
178 if(!is_numeric($course_id))
179 {
180 return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
181 'Client');
182 }
183
184 global $rbacsystem;
185
186 if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
187 {
188 $course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
189 if(ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs')
190 {
191 return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
192 }
193 }
194
195 if(!$rbacsystem->checkAccess('write',$course_id))
196 {
197 return $this->__raiseError('Check access failed. No permission to write to course','Server');
198 }
199
200
201 if(ilObject::_lookupType($user_id) != 'usr')
202 {
203 return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
204 }
205 if($type != 'Admin' and
206 $type != 'Tutor' and
207 $type != 'Member')
208 {
209 return $this->__raiseError('Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"','Client');
210 }
211
212 if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
213 {
214 return $this->__raiseError('Cannot create course instance!','Server');
215 }
216
217 if(!$tmp_user = ilObjectFactory::getInstanceByObjId($user_id,false))
218 {
219 return $this->__raiseError('Cannot create user instance!','Server');
220 }
221
222 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
223
224 $course_members = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
225
226 switch($type)
227 {
228 case 'Admin':
229 require_once("Services/Administration/classes/class.ilSetting.php");
230 $settings = new ilSetting();
231 $course_members->add($tmp_user->getId(),IL_CRS_ADMIN);
232 $course_members->updateNotification($tmp_user->getId(),$settings->get('mail_crs_admin_notification', true));
233 break;
234
235 case 'Tutor':
236 $course_members->add($tmp_user->getId(),IL_CRS_TUTOR);
237 break;
238
239 case 'Member':
240 $course_members->add($tmp_user->getId(),IL_CRS_MEMBER);
241 break;
242 }
243
244 return true;
245 }
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
const IL_CRS_TUTOR
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
ILIAS Setting Class.

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ deleteCourse()

ilSoapCourseAdministration::deleteCourse (   $sid,
  $course_id 
)

Definition at line 104 of file class.ilSoapCourseAdministration.php.

105 {
106 $this->initAuth($sid);
107 $this->initIlias();
108
109 if(!$this->__checkSession($sid))
110 {
111 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
112 }
113
114 if(!is_numeric($course_id))
115 {
116 return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
117 'Client');
118 }
119
120 include_once "./Services/Utilities/classes/class.ilUtil.php";
121 global $rbacsystem;
122
123 if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
124 {
125 $course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
126 if(ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs')
127 {
128 return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
129 }
130 }
131
132 if(!$rbacsystem->checkAccess('delete',$course_id))
133 {
134 return $this->__raiseError('Check access failed. No permission to delete course','Server');
135 }
136
137
138 global $tree,$rbacadmin,$log;
139
140 if($tree->isDeleted($course_id))
141 {
142 return $this->__raiseError('Node already deleted','Server');
143 }
144
145 $subnodes = $tree->getSubtree($tree->getNodeData($course_id));
146 foreach ($subnodes as $subnode)
147 {
148 $rbacadmin->revokePermission($subnode["child"]);
149
150 // remove item from all user desktops
151 $affected_users = ilUtil::removeItemFromDesktops($subnode["child"]);
152
153 }
154 if(!$tree->saveSubTree($course_id,true))
155 {
156 return $this->__raiseError('Node already deleted','Client');
157 }
158
159 // write log entry
160 $log->write("SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id ".$course_id." to trash");
161
162 // remove item from all user desktops
163 $affected_users = ilUtil::removeItemFromDesktops($course_id);
164
165 return true;
166 }
static removeItemFromDesktops($a_id)
removes object from all user's desktops @access public

References $log, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilUtil\removeItemFromDesktops().

+ Here is the call graph for this function:

◆ excludeCourseMember()

ilSoapCourseAdministration::excludeCourseMember (   $sid,
  $course_id,
  $user_id 
)

Definition at line 247 of file class.ilSoapCourseAdministration.php.

248 {
249 $this->initAuth($sid);
250 $this->initIlias();
251
252 if(!$this->__checkSession($sid))
253 {
254 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
255 }
256 if(!is_numeric($course_id))
257 {
258 return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
259 'Client');
260 }
261
262 global $rbacsystem;
263
264 if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
265 {
266 $course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
267 if(ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs')
268 {
269 return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
270 }
271 }
272
273 if(ilObject::_lookupType($user_id) != 'usr')
274 {
275 return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
276 }
277
278 if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
279 {
280 return $this->__raiseError('Cannot create course instance!','Server');
281 }
282
283 if(!$rbacsystem->checkAccess('write',$course_id))
284 {
285 return $this->__raiseError('Check access failed. No permission to write to course','Server');
286 }
287
288 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
289
290 $course_members = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
291 if(!$course_members->checkLastAdmin(array($user_id)))
292 {
293 return $this->__raiseError('Cannot deassign last administrator from course','Server');
294 }
295
296 $course_members->delete($user_id);
297
298 return true;
299 }

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getCoursesForUser()

ilSoapCourseAdministration::getCoursesForUser (   $sid,
  $parameters 
)

get courses which belong to a specific user, fullilling the status

Parameters
string$sid
string$parametersfollowing xmlresultset, columns (user_id, status with values 1 = "MEMBER", 2 = "TUTOR", 4 = "ADMIN", 8 = "OWNER" and any xor operation e.g. 1 + 4 = 5 = ADMIN and TUTOR, 7 = ADMIN and TUTOR and MEMBER)
stringXMLResultSet, columns (ref_id, xml, parent_ref_id)

Definition at line 483 of file class.ilSoapCourseAdministration.php.

483 {
484
485 $this->initAuth($sid);
486 $this->initIlias();
487
488 if(!$this->__checkSession($sid))
489 {
490 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
491 }
492
493 global $rbacreview, $ilObjDataCache, $tree;
494
495 include_once 'webservice/soap/classes/class.ilXMLResultSetParser.php';
496 $parser = new ilXMLResultSetParser($parameters);
497 try {
498 $parser->startParsing();
499 } catch (ilSaxParserException $exception) {
500 return $this->__raiseError($exception->getMessage(), "Client");
501 }
502 $xmlResultSet = $parser->getXMLResultSet();
503
504 if (!$xmlResultSet->hasColumn ("user_id"))
505 return $this->__raiseError("parameter user_id is missing", "Client");
506
507 if (!$xmlResultSet->hasColumn ("status"))
508 return $this->__raiseError("parameter status is missing", "Client");
509
510 $user_id = (int) $xmlResultSet->getValue (0, "user_id");
511 $status = (int) $xmlResultSet->getValue (0, "status");
512
513 $ref_ids = array();
514
515 // get roles
516#var_dump($xmlResultSet);
517#echo "uid:".$user_id;
518#echo "status:".$status;
522 foreach($rbacreview->assignedRoles($user_id) as $role_id)
523 {
524 if($role = ilObjectFactory::getInstanceByObjId($role_id,false))
525 {
526 #echo $role->getType();
527 if ($role->getType() != "role")
528 continue;
529 if ($role->getParent() == ROLE_FOLDER_ID)
530 {
531 continue;
532 }
533 $role_title = $role->getTitle();
534
535 if ($ref_id = ilUtil::__extractRefId($role_title))
536 {
538 continue;
539
540 #echo $role_title;
541 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title, "member") !== false)
542 {
543 $ref_ids [] = $ref_id;
544 } elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title, "tutor") !== false)
545 {
546 $ref_ids [] = $ref_id;
547 } elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title, "admin") !== false)
548 {
549 $ref_ids [] = $ref_id;
550 } elseif (($status & ilSoapCourseAdministration::OWNER) == ilSoapCourseAdministration::OWNER && $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($ref_id)) == $user_id)
551 {
552 $ref_ids [] = $ref_id;
553 }
554 }
555 }
556 }
558 {
559 $owned_objects = ilObjectFactory::getObjectsForOwner("crs", $user_id);
560 foreach ($owned_objects as $obj_id) {
561 $allrefs = ilObject::_getAllReferences($obj_id);
562 foreach($allrefs as $r)
563 {
564 if($tree->isDeleted($r))
565 {
566 continue;
567 }
568 if ($tree->isInTree($r))
569 {
570 $refs[] = $r;
571 }
572 }
573 if (count($refs) > 0)
574 $ref_ids[] = array_pop($refs);
575
576 }
577 }
578 $ref_ids = array_unique($ref_ids);
579
580
581
582 $ref_ids = array_unique($ref_ids);
583#print_r($ref_ids);
584 include_once 'webservice/soap/classes/class.ilXMLResultSetWriter.php';
585 include_once 'Modules/Course/classes/class.ilObjCourse.php';
586 include_once 'Modules/Course/classes/class.ilCourseXMLWriter.php';
587
588 $xmlResultSet = new ilXMLResultSet();
589 $xmlResultSet->addColumn("ref_id");
590 $xmlResultSet->addColumn("xml");
591 $xmlResultSet->addColumn("parent_ref_id");
592
593 global $ilUser;
594 //#18004
595 // Enable to see own participations by reducing the needed permissions
596 $permission = $user_id == $ilUser->getId() ? 'read' : 'write';
597
598 foreach ($ref_ids as $course_id) {
599 $course_obj = $this->checkObjectAccess($course_id,"crs",$permission, true);
600 if ($course_obj instanceof ilObjCourse) {
601 $row = new ilXMLResultSetRow();
602 $row->setValue("ref_id", $course_id);
603 $xmlWriter = new ilCourseXMLWriter($course_obj);
604 $xmlWriter->setAttachUsers(false);
605 $xmlWriter->start();
606 $row->setValue("xml", $xmlWriter->getXML());
607 $row->setValue("parent_ref_id", $tree->getParentId($course_id));
608 $xmlResultSet->addRow($row);
609 }
610 }
611 $xmlResultSetWriter = new ilXMLResultSetWriter($xmlResultSet);
612 $xmlResultSetWriter->start();
613 return $xmlResultSetWriter->getXML();
614 }
getObjectsForOwner($object_type, $owner_id)
returns all objects of an owner, filtered by type, objects are not deleted!
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
SaxParserException thrown by ilSaxParser if property throwException is set.
checkObjectAccess($ref_id, $expected_type, $permission, $returnObject=false)
check access for ref id: expected type, permission, return object instance if returnobject is true
static __extractRefId($role_title)
extract ref id from role title, e.g.
XML Writer for XMLResultSet.
$r
Definition: example_031.php:79
$ref_id
Definition: sahs_server.php:39
global $ilUser
Definition: imgupload.php:15

References $ilUser, $r, $ref_id, $row, ilUtil\__extractRefId(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_exists(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ADMIN, ilSoapAdministration\checkObjectAccess(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getObjectsForOwner(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), MEMBER, OWNER, and TUTOR.

+ Here is the call graph for this function:

◆ getCourseXML()

ilSoapCourseAdministration::getCourseXML (   $sid,
  $course_id 
)

Definition at line 362 of file class.ilSoapCourseAdministration.php.

363 {
364 $this->initAuth($sid);
365 $this->initIlias();
366
367 if(!$this->__checkSession($sid))
368 {
369 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
370 }
371 if(!is_numeric($course_id))
372 {
373 return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
374 'Client');
375 }
376
377 global $rbacsystem;
378
379 $tmp_course = $this->checkObjectAccess($course_id, "crs", "read", true);
380 if ($this->isFault($tmp_course)) {
381 return $tmp_course;
382 }
383
384 /*if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
385 {
386 $course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
387 if(ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs')
388 {
389 return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
390 }
391 }
392
393 if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
394 {
395 return $this->__raiseError('Cannot create course instance!','Server');
396 }
397
398 if(!$rbacsystem->checkAccess('read',$course_id))
399 {
400 return $this->__raiseError('Check access failed. No permission to read course','Server');
401 }*/
402
403 include_once 'Modules/Course/classes/class.ilCourseXMLWriter.php';
404
405 $xml_writer = new ilCourseXMLWriter($tmp_course);
406 $xml_writer->start();
407
408 return $xml_writer->getXML();
409 }

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\checkObjectAccess(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\isFault().

+ Here is the call graph for this function:

◆ ilSoapCourseAdministration()

ilSoapCourseAdministration::ilSoapCourseAdministration ( )

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

43 {
44 parent::ilSoapAdministration();
45 }

◆ isAssignedToCourse()

ilSoapCourseAdministration::isAssignedToCourse (   $sid,
  $course_id,
  $user_id 
)

Definition at line 302 of file class.ilSoapCourseAdministration.php.

303 {
304 $this->initAuth($sid);
305 $this->initIlias();
306
307 if(!$this->__checkSession($sid))
308 {
309 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
310 }
311 if(!is_numeric($course_id))
312 {
313 return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
314 'Client');
315 }
316 global $rbacsystem;
317
318 if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
319 {
320 $course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
321 if(ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs')
322 {
323 return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
324 }
325 }
326
327 if(ilObject::_lookupType($user_id) != 'usr')
328 {
329 return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
330 }
331
332 if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
333 {
334 return $this->__raiseError('Cannot create course instance!','Server');
335 }
336
337 if(!$rbacsystem->checkAccess('write',$course_id))
338 {
339 return $this->__raiseError('Check access failed. No permission to write to course','Server');
340 }
341
342 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
343 $crs_members = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
344
345 if($crs_members->isAdmin($user_id))
346 {
347 return IL_CRS_ADMIN;
348 }
349 if($crs_members->isTutor($user_id))
350 {
351 return IL_CRS_TUTOR;
352 }
353 if($crs_members->isMember($user_id))
354 {
355 return IL_CRS_MEMBER;
356 }
357
358 return "0";
359 }

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByRefId(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ updateCourse()

ilSoapCourseAdministration::updateCourse (   $sid,
  $course_id,
  $xml 
)

Definition at line 411 of file class.ilSoapCourseAdministration.php.

412 {
413 $this->initAuth($sid);
414 $this->initIlias();
415
416 if(!$this->__checkSession($sid))
417 {
418 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
419 }
420
421 if(!is_numeric($course_id))
422 {
423 return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
424 'Client');
425 }
426
427 global $rbacsystem;
428
429 if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
430 {
431 $course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
432 if(ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs')
433 {
434 return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
435 }
436 }
437
438 if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
439 {
440 return $this->__raiseError('Cannot create course instance!','Server');
441 }
442
443 if(!$rbacsystem->checkAccess('write',$course_id))
444 {
445 return $this->__raiseError('Check access failed. No permission to write course','Server');
446 }
447
448
449 // First delete old meta data
450 include_once 'Services/MetaData/classes/class.ilMD.php';
451
452 $md = new ilMD($tmp_course->getId(),0,'crs');
453 $md->deleteAll();
454
455 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
456 ilCourseParticipants::_deleteAllEntries($tmp_course->getId());
457
458
459 include_once 'Modules/Course/classes/class.ilCourseWaitingList.php';
460 ilCourseWaitingList::_deleteAll($tmp_course->getId());
461
462 include_once 'Modules/Course/classes/class.ilCourseXMLParser.php';
463
464 $xml_parser = new ilCourseXMLParser($tmp_course);
465 $xml_parser->setXMLContent($xml);
466
467 $xml_parser->startParsing();
468
469 $tmp_course->MDUpdateListener('General');
470
471 return true;
472 }
static _deleteAllEntries($a_obj_id)
Delete all entries Normally called for course deletion.
static _deleteAll($a_obj_id)
delete all

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilWaitingList\_deleteAll(), ilParticipants\_deleteAllEntries(), ilObject\_getAllReferences(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

Field Documentation

◆ ADMIN

const ilSoapCourseAdministration::ADMIN = 4

Definition at line 39 of file class.ilSoapCourseAdministration.php.

Referenced by getCoursesForUser().

◆ MEMBER

const ilSoapCourseAdministration::MEMBER = 1

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

Referenced by getCoursesForUser().

◆ OWNER

const ilSoapCourseAdministration::OWNER = 8

Definition at line 40 of file class.ilSoapCourseAdministration.php.

Referenced by getCoursesForUser().

◆ TUTOR

const ilSoapCourseAdministration::TUTOR = 2

Definition at line 38 of file class.ilSoapCourseAdministration.php.

Referenced by getCoursesForUser().


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