ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 {
35  public function exportDataCollectionContent(
36  string $sid,
37  int $target_ref_id,
38  ?int $table_id = null,
39  string $format = ilDclContentExporter::EXPORT_EXCEL,
40  ?string $filepath = null
41  ) {
42  $this->initAuth($sid);
43  $this->initIlias();
44  if (!$this->checkSession($sid)) {
45  return $this->raiseError($this->getMessage(), $this->getMessageCode());
46  }
47 
48  require_once "Modules/DataCollection/classes/class.ilObjDataCollection.php";
49  if (!$target_obj = new ilObjDataCollection($target_ref_id)) {
50  return $this->raiseError('No valid target given.', 'CLIENT');
51  }
52 
53  if (ilObject::_isInTrash($target_ref_id)) {
54  return $this->raiseError(
55  "Parent with ID $target_ref_id has been deleted.",
56  'CLIENT_TARGET_DELETED'
57  );
58  }
59 
60  if (!ilObjDataCollectionAccess::hasReadAccess($target_ref_id)) {
61  return $this->raiseError(
62  'Check access failed. No permission to read DataCollection',
63  "CLIENT_PERMISSION_ISSUE"
64  );
65  }
66 
67  try {
68  require_once "Modules/DataCollection/classes/Content/class.ilDclContentExporter.php";
69  $exporter = new ilDclContentExporter($target_ref_id, $table_id);
70  return $exporter->export($format, $filepath);
71  } catch (ilException $exception) {
72  return $this->raiseError($exception->getMessage(), $exception->getCode());
73  }
74  }
75 }
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)
static hasReadAccess(int $ref, ?int $user_id=0)
Hook-Class for exporting data-collections (used in SOAP-Class) This Class avoids duplicated code by r...