ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSoapWebLinkAdministration Class Reference

Soap methods for adminstrating web links. More...

+ Inheritance diagram for ilSoapWebLinkAdministration:
+ Collaboration diagram for ilSoapWebLinkAdministration:

Public Member Functions

 __construct ()
 Constructor.
 readWebLink ($sid, $ref_id)
 Get Weblink xml.
 createWebLink ($sid, $target_id, $weblink_xml)
 add an exercise with id.
 updateWebLink ($sid, $ref_id, $weblink_xml)
 update a weblink with id.
- 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)

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
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 $error_method = null
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true

Detailed Description

Soap methods for adminstrating web links.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilSoapWebLinkAdministration.php.

Constructor & Destructor Documentation

ilSoapWebLinkAdministration::__construct ( )

Constructor.

Definition at line 18 of file class.ilSoapWebLinkAdministration.php.

Member Function Documentation

ilSoapWebLinkAdministration::createWebLink (   $sid,
  $target_id,
  $weblink_xml 
)

add an exercise with id.

Parameters
string$session_idcurrent session
int$target_idrefid of parent in repository
string$weblink_xmlxml description of weblink
Returns
int reference id in the tree, 0 if not successful

Definition at line 105 of file class.ilSoapWebLinkAdministration.php.

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

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
global $rbacsystem, $tree, $ilLog;
{
return $this->__raiseError('No valid target given.', 'Client');
}
{
return $this->__raiseError("Parent with ID $target_id has been deleted.", 'CLIENT_OBJECT_DELETED');
}
// Check access
// TODO: read from object definition
$allowed_types = array('cat','grp','crs','fold','root');
if(!in_array($target_obj->getType(), $allowed_types))
{
return $this->__raiseError('No valid target type. Target must be reference id of "course, group, root, category or folder"', 'Client');
}
if(!$rbacsystem->checkAccess('create',$target_id,"webr"))
{
return $this->__raiseError('No permission to create weblink in target '.$target_id.'!', 'Client');
}
// create object, put it into the tree and use the parser to update the settings
include_once './Modules/WebResource/classes/class.ilObjLinkResource.php';
include_once './Modules/WebResource/classes/class.ilWebLinkXmlParser.php';
$webl = new ilObjLinkResource();
$webl->setTitle('XML Import');
$webl->create(true);
$webl->createReference();
$webl->putInTree($target_id);
$webl->setPermissions($target_id);
try
{
$parser = new ilWebLinkXmlParser($webl,$weblink_xml);
$parser->start();
}
{
return $this->__raiseError($e->getMessage(),'Client');
}
catch(ilWebLinkXMLParserException $e)
{
return $this->__raiseError($e->getMessage(),'Client');
}
// Check if required
return $webl->getRefId();
}

+ Here is the call graph for this function:

ilSoapWebLinkAdministration::readWebLink (   $sid,
  $ref_id 
)

Get Weblink xml.

Parameters
string$a_sid
int$a_ref_id
Returns
string

Definition at line 29 of file class.ilSoapWebLinkAdministration.php.

References $ilLog, $ref_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ilObject\_lookupObjectId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!strlen($ref_id))
{
return $this->__raiseError('No ref id given. Aborting!',
'Client');
}
global $rbacsystem, $tree, $ilLog;
// get obj_id
{
return $this->__raiseError('No weblink found for id: '.$ref_id,
'Client');
}
{
return $this->__raiseError("Parent with ID $ref_id has been deleted.", 'Client');
}
// Check access
$permission_ok = false;
$write_permission_ok = false;
foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
{
if($rbacsystem->checkAccess('edit',$ref_id))
{
$write_permission_ok = true;
break;
}
if($rbacsystem->checkAccess('read',$ref_id))
{
$permission_ok = true;
break;
}
}
if(!$permission_ok && !$write_permission_ok)
{
return $this->__raiseError('No permission to edit the object with id: '.$ref_id,
'Server');
}
try
{
include_once './Modules/WebResource/classes/class.ilWebLinkXmlWriter.php';
$writer = new ilWebLinkXmlWriter();
$writer->setObjId($obj_id);
$writer->write();
return $writer->xmlDumpMem(true);
}
catch(UnexpectedValueException $e)
{
return $this->__raiseError($e->getMessage(), 'Client');
}
}

+ Here is the call graph for this function:

ilSoapWebLinkAdministration::updateWebLink (   $sid,
  $ref_id,
  $weblink_xml 
)

update a weblink with id.

Parameters
string$session_idcurrent session
int$ref_idrefid id of weblink in repository
string$weblink_xmlxml description
Returns
boolean true, if update successful, false otherwise

Definition at line 179 of file class.ilSoapWebLinkAdministration.php.

References $ilLog, $ref_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ilObject\_lookupObjectId(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilWebLinkXmlParser\MODE_UPDATE.

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
global $rbacsystem, $tree, $ilLog;
{
return $this->__raiseError('Cannot perform update since weblink has been deleted.', 'CLIENT_OBJECT_DELETED');
}
// get obj_id
{
return $this->__raiseError('No weblink found for id: '.$ref_id,
'CLIENT_OBJECT_NOT_FOUND');
}
// Check access
$permission_ok = false;
foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
{
if($rbacsystem->checkAccess('edit',$ref_id))
{
$permission_ok = true;
break;
}
}
if(!$permission_ok)
{
return $this->__raiseError('No permission to edit the weblink with id: '.$ref_id,
'Server');
}
$webl = ilObjectFactory::getInstanceByObjId($obj_id, false);
if(!is_object($webl) or $webl->getType()!= "webr")
{
return $this->__raiseError('Wrong obj id or type for weblink with id '.$ref_id,
'Client');
}
try
{
include_once './Modules/WebResource/classes/class.ilWebLinkXmlParser.php';
$parser = new ilWebLinkXmlParser($webl,$weblink_xml);
$parser->start();
}
{
return $this->__raiseError($e->getMessage(),'Client');
}
catch(ilWebLinkXMLParserException $e)
{
return $this->__raiseError($e->getMessage(),'Client');
}
// Check if required
return true;
}

+ Here is the call graph for this function:


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