ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
30 {
31 
36  public function exportDataCollectionContent(
37  string $sid,
38  int $target_ref_id,
39  ?int $table_id = null,
41  ?string $filepath = null
42  ) {
43  $this->initAuth($sid);
44  $this->initIlias();
45  if (!$this->checkSession($sid)) {
46  return $this->raiseError($this->getMessage(), $this->getMessageCode());
47  }
48 
49  require_once "Modules/DataCollection/classes/class.ilObjDataCollection.php";
50  if (!$target_obj = new ilObjDataCollection($target_ref_id)) {
51  return $this->raiseError('No valid target given.', 'CLIENT');
52  }
53 
54  if (ilObject::_isInTrash($target_ref_id)) {
55  return $this->raiseError(
56  "Parent with ID $target_ref_id has been deleted.",
57  'CLIENT_TARGET_DELETED'
58  );
59  }
60 
61  if (!ilObjDataCollectionAccess::hasReadAccess($target_ref_id)) {
62  return $this->raiseError(
63  'Check access failed. No permission to read DataCollection',
64  "CLIENT_PERMISSION_ISSUE"
65  );
66  }
67 
68  try {
69  require_once "Modules/DataCollection/classes/Content/class.ilDclContentExporter.php";
70  $exporter = new ilDclContentExporter($target_ref_id, $table_id);
71  return $exporter->export($format, $filepath);
72  } catch (ilException $exception) {
73  return $this->raiseError($exception->getMessage(), $exception->getCode());
74  }
75  }
76 }
Soap data-collection administration methods.
raiseError(string $a_message, $a_code)
exportDataCollectionContent(string $sid, int $target_ref_id, ?int $table_id=null, string $format=ilDclContentExporter::EXPORT_EXCEL, ?string $filepath=null)
Export DataCollection async.
static _isInTrash(int $ref_id)
$format
Definition: metadata.php:235
static hasReadAccess(int $ref, ?int $user_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...