ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSoapDataCollectionAdministration.php
Go to the documentation of this file.
1 <?php
2  /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 require_once('./webservice/soap/classes/class.ilSoapAdministration.php');
24 
25 
34 {
35 
47  public function exportDataCollectionContent($sid, $target_ref_id, $table_id = null, $format = ilDclContentExporter::EXPORT_EXCEL, $filepath = null)
48  {
49  $this->initAuth($sid);
50  $this->initIlias();
51  if (!$this->__checkSession($sid)) {
52  return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
53  }
54 
55  require_once "Modules/DataCollection/classes/class.ilObjDataCollection.php";
56  if (!$target_obj = new ilObjDataCollection($target_ref_id)) {
57  return $this->__raiseError('No valid target given.', 'CLIENT');
58  }
59 
60  if (ilObject::_isInTrash($target_ref_id)) {
61  return $this->__raiseError(
62  "Parent with ID $target_ref_id has been deleted.",
63  'CLIENT_TARGET_DELETED'
64  );
65  }
66 
67  if (!ilObjDataCollectionAccess::hasReadAccess($target_ref_id)) {
68  return $this->__raiseError(
69  'Check access failed. No permission to read DataCollection',
70  "CLIENT_PERMISSION_ISSUE"
71  );
72  }
73 
74  try {
75  require_once "Modules/DataCollection/classes/Content/class.ilDclContentExporter.php";
76  $exporter = new ilDclContentExporter($target_ref_id, $table_id);
77  return $exporter->export($format, $filepath);
78  } catch (ilException $exception) {
79  return $this->__raiseError($exception->getMessage(), $exception->getCode());
80  }
81  }
82 }
$format
Definition: metadata.php:141
static _isInTrash($a_ref_id)
checks wether object is in trash
__raiseError($a_message, $a_code)
exportDataCollectionContent($sid, $target_ref_id, $table_id=null, $format=ilDclContentExporter::EXPORT_EXCEL, $filepath=null)
Export DataCollection async.
initAuth($sid)
Init authentication.
Hook-Class for exporting data-collections (used in SOAP-Class) This Class avoids duplicated code by r...
Class ilObjDataCollection.