ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSoapStructureObjectAdministration.php
Go to the documentation of this file.
1 <?php
2  /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22  */
23 
24 
34 include_once './webservice/soap/classes/class.ilSoapAdministration.php';
35 
37 {
38  function getStructureObjects ($sid, $ref_id)
39  {
40  $this->initAuth($sid);
41  $this->initIlias();
42 
43  if(!$this->__checkSession($sid))
44  {
45  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
46  }
47 
48  if(!$target_obj =& ilObjectFactory::getInstanceByRefId($ref_id, false))
49  {
50  return $this->__raiseError('No valid reference id given.', 'Client');
51  }
52 
53  $structureReaderClassname = "ilSoap".strtoupper($target_obj->getType())."StructureReader";
54  $filename = "./webservice/soap/classes/class.".$structureReaderClassname.".php";
55 
56  if (!file_exists($filename))
57  {
58  return $this->__raiseError("Object type '".$target_obj->getType()."'is not supported.", 'Client');
59  }
60 
61  include_once $filename;
62 
63  $structureReader = new $structureReaderClassname($target_obj);
64 
65  include_once './webservice/soap/classes/class.ilSoapStructureObjectXMLWriter.php';
66 
67  $xml_writer = new ilSoapStructureObjectXMLWriter();
68 
69  $structureObject = & $structureReader->getStructureObject();
70 
71  $xml_writer->setStructureObject ($structureObject);
72 
73  if(!$xml_writer->start())
74  {
75  return $this->__raiseError('Cannot create object xml !','Server');
76  }
77 
78  return $xml_writer->getXML();
79 
80  }
81 }
82 
83 ?>
__raiseError($a_message, $a_code)
$ref_id
Definition: sahs_server.php:39
initAuth($sid)
Init authentication.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id