ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 
29 {
34  public function exportDataCollectionContent(
35  string $sid,
36  int $target_ref_id,
37  ?int $table_id = null,
38  string $format = ilDclContentExporter::EXPORT_EXCEL,
39  ?string $filepath = null
40  ) {
41  $this->initAuth($sid);
42  $this->initIlias();
43  if (!$this->checkSession($sid)) {
44  return $this->raiseError($this->getMessage(), $this->getMessageCode());
45  }
46 
47  if (!$target_obj = new ilObjDataCollection($target_ref_id)) {
48  return $this->raiseError('No valid target given.', 'CLIENT');
49  }
50 
51  if (ilObject::_isInTrash($target_ref_id)) {
52  return $this->raiseError(
53  "Parent with ID $target_ref_id has been deleted.",
54  'CLIENT_TARGET_DELETED'
55  );
56  }
57 
58  if (!ilObjDataCollectionAccess::hasReadAccess($target_ref_id)) {
59  return $this->raiseError(
60  'Check access failed. No permission to read DataCollection',
61  "CLIENT_PERMISSION_ISSUE"
62  );
63  }
64 
65  try {
66  $exporter = new ilDclContentExporter($target_ref_id, $table_id);
67  return $exporter->export($format, $filepath);
68  } catch (ilException $exception) {
69  return $this->raiseError($exception->getMessage(), $exception->getCode());
70  }
71  }
72 }
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...