ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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
- Public Member Functions inherited from ilSoapAdministration
 ilSoapAdministration ($use_nusoap=true)
 __checkSession ($sid)
 initErrorWriter ()
 Overwrite error handler.
 __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
 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
 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
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true

Detailed Description

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

Member Function Documentation

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

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

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

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($target_id))
{
return $this->__raiseError('No valid target id given. Please choose an existing reference id of an ILIAS category',
'Client');
}
global $rbacsystem;
if(!$target_obj =& ilObjectFactory::getInstanceByRefId($target_id, false))
{
return $this->__raiseError('No valid target given.', 'Client');
}
{
return $this->__raiseError("Parent with ID $target_id has been deleted.", 'CLIENT_OBJECT_DELETED');
}
if(!$rbacsystem->checkAccess('create',$target_id,'crs'))
{
return $this->__raiseError('Check access failed. No permission to create courses','Server');
}
// Start import
include_once("Modules/Course/classes/class.ilObjCourse.php");
$newObj = new ilObjCourse();
$newObj->setType('crs');
$newObj->setTitle('dummy');
$newObj->setDescription("");
$newObj->create(true); // true for upload
$newObj->createReference();
$newObj->putInTree($target_id);
$newObj->setPermissions($target_id);
include_once 'Modules/Course/classes/class.ilCourseXMLParser.php';
$xml_parser = new ilCourseXMLParser($newObj);
$xml_parser->setXMLContent($crs_xml);
$xml_parser->startParsing();
return $newObj->getRefId() ? $newObj->getRefId() : "0";
}

+ Here is the call graph for this function:

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

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

References ilSoapAdministration\__checkSession(), 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().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($course_id))
{
return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
'Client');
}
global $rbacsystem;
if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
{
$course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
{
return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
}
}
if(!$rbacsystem->checkAccess('write',$course_id))
{
return $this->__raiseError('Check access failed. No permission to write to course','Server');
}
if(ilObject::_lookupType($user_id) != 'usr')
{
return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
}
if($type != 'Admin' and
$type != 'Tutor' and
$type != 'Member')
{
return $this->__raiseError('Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"','Client');
}
if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
{
return $this->__raiseError('Cannot create course instance!','Server');
}
if(!$tmp_user = ilObjectFactory::getInstanceByObjId($user_id,false))
{
return $this->__raiseError('Cannot create user instance!','Server');
}
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$course_members = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
switch($type)
{
case 'Admin':
$course_members->add($tmp_user->getId(),IL_CRS_ADMIN);
$course_members->updateNotification($tmp_user->getId(),1);
break;
case 'Tutor':
$course_members->add($tmp_user->getId(),IL_CRS_TUTOR);
break;
case 'Member':
$course_members->add($tmp_user->getId(),IL_CRS_MEMBER);
break;
}
return true;
}

+ Here is the call graph for this function:

ilSoapCourseAdministration::deleteCourse (   $sid,
  $course_id 
)

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

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

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($course_id))
{
return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
'Client');
}
include_once "./Services/Utilities/classes/class.ilUtil.php";
global $rbacsystem;
if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
{
$course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
{
return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
}
}
if(!$rbacsystem->checkAccess('delete',$course_id))
{
return $this->__raiseError('Check access failed. No permission to delete course','Server');
}
global $tree,$rbacadmin,$log;
if($tree->isDeleted($course_id))
{
return $this->__raiseError('Node already deleted','Server');
}
$subnodes = $tree->getSubtree($tree->getNodeData($course_id));
foreach ($subnodes as $subnode)
{
$rbacadmin->revokePermission($subnode["child"]);
// remove item from all user desktops
$affected_users = ilUtil::removeItemFromDesktops($subnode["child"]);
}
if(!$tree->saveSubTree($course_id))
{
return $this->__raiseError('Node already deleted','Client');
}
// write log entry
$log->write("SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id ".$course_id." to trash");
// remove item from all user desktops
$affected_users = ilUtil::removeItemFromDesktops($course_id);
return true;
}

+ Here is the call graph for this function:

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

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

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

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($course_id))
{
return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
'Client');
}
global $rbacsystem;
if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
{
$course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
{
return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
}
}
if(ilObject::_lookupType($user_id) != 'usr')
{
return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
}
if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
{
return $this->__raiseError('Cannot create course instance!','Server');
}
if(!$rbacsystem->checkAccess('write',$course_id))
{
return $this->__raiseError('Check access failed. No permission to write to course','Server');
}
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$course_members = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
if(!$course_members->checkLastAdmin(array($user_id)))
{
return $this->__raiseError('Cannot deassign last administrator from course','Server');
}
$course_members->delete($user_id);
return true;
}

+ Here is the call graph for this function:

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 481 of file class.ilSoapCourseAdministration.php.

References $ref_id, $row, ilSoapAdministration\__checkSession(), 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.

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
global $rbacreview, $ilObjDataCache, $tree;
include_once 'webservice/soap/classes/class.ilXMLResultSetParser.php';
$parser = new ilXMLResultSetParser($parameters);
try {
$parser->startParsing();
} catch (ilSaxParserException $exception) {
return $this->__raiseError($exception->getMessage(), "Client");
}
$xmlResultSet = $parser->getXMLResultSet();
if (!$xmlResultSet->hasColumn ("user_id"))
return $this->__raiseError("parameter user_id is missing", "Client");
if (!$xmlResultSet->hasColumn ("status"))
return $this->__raiseError("parameter status is missing", "Client");
$user_id = (int) $xmlResultSet->getValue (0, "user_id");
$status = (int) $xmlResultSet->getValue (0, "status");
$ref_ids = array();
// get roles
#var_dump($xmlResultSet);
#echo "uid:".$user_id;
#echo "status:".$status;
foreach($rbacreview->assignedRoles($user_id) as $role_id)
{
if($role = ilObjectFactory::getInstanceByObjId($role_id,false))
{
#echo $role->getType();
if ($role->getType() != "role")
continue;
if ($role->getParent() == ROLE_FOLDER_ID)
{
continue;
}
$role_title = $role->getTitle();
if ($ref_id = ilUtil::__extractRefId($role_title))
{
continue;
#echo $role_title;
if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title, "member") !== false)
{
$ref_ids [] = $ref_id;
} elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title, "tutor") !== false)
{
$ref_ids [] = $ref_id;
} elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title, "admin") !== false)
{
$ref_ids [] = $ref_id;
} elseif (($status & ilSoapCourseAdministration::OWNER) == ilSoapCourseAdministration::OWNER && $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($ref_id)) == $user_id)
{
$ref_ids [] = $ref_id;
}
}
}
}
{
$owned_objects = ilObjectFactory::getObjectsForOwner("crs", $user_id);
foreach ($owned_objects as $obj_id) {
$allrefs = ilObject::_getAllReferences($obj_id);
foreach($allrefs as $r)
{
if($tree->isDeleted($r))
{
continue;
}
if ($tree->isInTree($r))
{
$refs[] = $r;
}
}
if (count($refs) > 0)
$ref_ids[] = array_pop($refs);
}
}
$ref_ids = array_unique($ref_ids);
$ref_ids = array_unique($ref_ids);
#print_r($ref_ids);
include_once 'webservice/soap/classes/class.ilXMLResultSetWriter.php';
include_once 'Modules/Course/classes/class.ilObjCourse.php';
include_once 'Modules/Course/classes/class.ilCourseXMLWriter.php';
$xmlResultSet = new ilXMLResultSet();
$xmlResultSet->addColumn("ref_id");
$xmlResultSet->addColumn("xml");
$xmlResultSet->addColumn("parent_ref_id");
foreach ($ref_ids as $course_id) {
$course_obj = $this->checkObjectAccess($course_id,"crs","write", true);
if ($course_obj instanceof ilObjCourse) {
$row->setValue("ref_id", $course_id);
$xmlWriter = new ilCourseXMLWriter($course_obj);
$xmlWriter->setAttachUsers(false);
$xmlWriter->start();
$row->setValue("xml", $xmlWriter->getXML());
$row->setValue("parent_ref_id", $tree->getParentId($course_id));
$xmlResultSet->addRow($row);
}
}
$xmlResultSetWriter = new ilXMLResultSetWriter($xmlResultSet);
$xmlResultSetWriter->start();
return $xmlResultSetWriter->getXML();
}

+ Here is the call graph for this function:

ilSoapCourseAdministration::getCourseXML (   $sid,
  $course_id 
)

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

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

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($course_id))
{
return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
'Client');
}
global $rbacsystem;
$tmp_course = $this->checkObjectAccess($course_id, "crs", "read", true);
if ($this->isFault($tmp_course)) {
return $tmp_course;
}
/*if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
{
$course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
if(ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs')
{
return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
}
}
if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
{
return $this->__raiseError('Cannot create course instance!','Server');
}
if(!$rbacsystem->checkAccess('read',$course_id))
{
return $this->__raiseError('Check access failed. No permission to read course','Server');
}*/
include_once 'Modules/Course/classes/class.ilCourseXMLWriter.php';
$xml_writer = new ilCourseXMLWriter($tmp_course);
$xml_writer->start();
return $xml_writer->getXML();
}

+ Here is the call graph for this function:

ilSoapCourseAdministration::ilSoapCourseAdministration ( )

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

References ilSoapAdministration\ilSoapAdministration().

+ Here is the call graph for this function:

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

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

References ilSoapAdministration\__checkSession(), 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().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($course_id))
{
return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
'Client');
}
global $rbacsystem;
if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
{
$course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
{
return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
}
}
if(ilObject::_lookupType($user_id) != 'usr')
{
return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
}
if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
{
return $this->__raiseError('Cannot create course instance!','Server');
}
if(!$rbacsystem->checkAccess('write',$course_id))
{
return $this->__raiseError('Check access failed. No permission to write to course','Server');
}
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$crs_members = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
if($crs_members->isAdmin($user_id))
{
return IL_CRS_ADMIN;
}
if($crs_members->isTutor($user_id))
{
return IL_CRS_TUTOR;
}
if($crs_members->isMember($user_id))
{
return IL_CRS_MEMBER;
}
return "0";
}

+ Here is the call graph for this function:

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

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

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

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($course_id))
{
return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course',
'Client');
}
global $rbacsystem;
if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs')
{
$course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
{
return $this->__raiseError('Invalid course id. Object with id "'. $course_id.'" is not of type "course"','Client');
}
}
if(!$tmp_course = ilObjectFactory::getInstanceByRefId($course_id,false))
{
return $this->__raiseError('Cannot create course instance!','Server');
}
if(!$rbacsystem->checkAccess('write',$course_id))
{
return $this->__raiseError('Check access failed. No permission to write course','Server');
}
// First delete old meta data
include_once 'Services/MetaData/classes/class.ilMD.php';
$md = new ilMD($tmp_course->getId(),0,'crs');
$md->deleteAll();
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
include_once 'Modules/Course/classes/class.ilCourseWaitingList.php';
ilCourseWaitingList::_deleteAll($tmp_course->getId());
include_once 'Modules/Course/classes/class.ilCourseXMLParser.php';
$xml_parser = new ilCourseXMLParser($tmp_course);
$xml_parser->setXMLContent($xml);
$xml_parser->startParsing();
$tmp_course->MDUpdateListener('General');
return true;
}

+ Here is the call graph for this function:

Field Documentation

const ilSoapCourseAdministration::ADMIN = 4

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

Referenced by getCoursesForUser().

const ilSoapCourseAdministration::MEMBER = 1

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

Referenced by getCoursesForUser().

const ilSoapCourseAdministration::OWNER = 8

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

Referenced by getCoursesForUser().

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: