5 require_once(
'./Modules/DataCollection/classes/class.ilObjDataCollectionAccess.php');
6 require_once(
'./Modules/DataCollection/classes/class.ilObjDataCollectionGUI.php');
7 require_once(
'./Modules/DataCollection/classes/Content/class.ilDclRecordListGUI.php');
8 require_once(
'./Modules/DataCollection/classes/Table/class.ilDclTable.php');
9 require_once(
'./Services/Export/classes/class.ilExport.php');
59 $this->tables = (
$table_id) ? array($this->dcl->getTableById(
$table_id)) : $this->dcl->getTables();
61 $lng->loadLanguageModule(
'dcl');
76 $dangerous_filename_characters = array(
" ",
'"',
"'",
"&",
"/",
"\\",
"?",
"#",
"`");
78 return str_replace($dangerous_filename_characters,
"_", iconv(
"utf-8",
"ascii//TRANSLIT",
$filename));
106 foreach ($table->
getFields() as $field) {
107 if ($field->getExportable()) {
125 foreach ($table->
getFields() as $field) {
126 if ($field->getExportable()) {
127 $field->fillHeaderExcel($worksheet,
$row, $col);
154 public function export(
$format = self::EXPORT_EXCEL, $filepath = null, $send =
false)
156 if (count($this->tables) == 0) {
160 if (empty($filepath)) {
164 $basename = (isset($this->table_id)) ? $this->tables[0]->getTitle() :
'complete';
165 $filename = time() .
'__' . $basename .
"_" . date(
"Y-m-d_H-i");
169 $filename = pathinfo($filepath, PATHINFO_FILENAME);
172 $in_progress_file = $filepath . self::IN_PROGRESS_POSTFIX;
173 file_put_contents($in_progress_file,
"");
175 $data_available =
false;
176 $fields_available =
false;
178 case self::EXPORT_EXCEL:
179 require_once
"./Services/Excel/classes/class.ilExcel.php";
182 foreach ($this->tables as
$table) {
185 $list = $table->getPartialRecords(null, null, null, 0, $this->filter);
186 $data_available = $data_available || (
$list[
'total'] > 0);
187 $fields_available = $fields_available || (count($table->getExportableFields()) > 0);
188 if (
$list[
'total'] > 0 && count($table->getExportableFields()) > 0) {
190 $title = substr($table->getTitle(), 0, 31);
191 $adapter->addSheet(
$title);
203 foreach (
$list[
'records'] as $set) {
208 $data_available =
true;
214 if (file_exists($in_progress_file)) {
215 unlink($in_progress_file);
218 if (!$data_available) {
224 if (!$fields_available) {
228 $this->lng->txt(
'dcl_no_export_fields_available'),
229 $ilCtrl->getLinkTargetByClass(array(
'ilDclTableListGUI',
'ilDclTableEditGUI',
'ilDclFieldListGUI'),
'listFields')
240 $adapter->writeToFile($filepath);
259 $method = self::SOAP_FUNCTION_NAME;
261 $soap_params = array($this->dcl->getRefId());
262 array_push($soap_params, $this->table_id,
$format, $filepath);
268 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
271 $soap_client->setResponseTimeout(5);
272 $soap_client->enableWSDL(
true);
274 $ilLog->write(__METHOD__ .
': Trying to call Soap client...');
276 array_unshift($soap_params, $new_session_id .
'::' .
$client_id);
278 if ($soap_client->init()) {
279 $ilLog->info(
'Calling soap ' . $method .
' method with params ' . print_r($soap_params,
true));
280 $res = $soap_client->call($method, $soap_params);
282 $ilLog->warning(
'SOAP clone call failed. Calling clone method manually');
283 require_once(
'./webservice/soap/include/inc.soap_functions.php');
284 if (method_exists(
'ilSoapFunctions', $method)) {
285 $res = ilSoapFunctions::$method($new_session_id .
'::' . $client_id, $this->dcl->getRefId(),
$this->table_id,
$format, $filepath);
287 throw new ilDclException(
"SOAP call " . $method .
" does not exists!");
static makeDirParents($a_dir)
Create a new directory and all parent directories.
if(isset($_REQUEST['delete'])) $list
fillHeaderExcel(ilDclTable $table, ilExcel $worksheet, $row)
Fill Excel header.
getFields()
Returns all fields of this table including the standard fields.
export($format=self::EXPORT_EXCEL, $filepath=null, $send=false)
Creates an export of a specific datacollection table.
Class ilDclBaseFieldModel.
static resetCache()
Resets all the cache fields.
__construct($ref_id, $table_id=null, $filter=array())
fillRowExcel(ilDclTable $table, ilExcel $worksheet, ilDclBaseRecordModel $record, $row)
Fill a excel row.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
foreach($_POST as $key=> $value) $res
fillMetaExcel($table, $worksheet, $row)
Fill Excel meta-data.
sanitizeFilename($filename)
Sanitize the given filename The ilUtil::_sanitizeFilemame() does not clean enough.
fillRecordFieldExcelExport(ilExcel $worksheet, &$row, &$col, $field_id)
exportAsync($format=self::EXPORT_EXCEL, $filepath=null)
Start Export async.
static _duplicate($a_session_id)
Duplicate session.
Class ilDclBaseRecordModel.
getExportContentPath($format)
Return export path.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
Hook-Class for exporting data-collections (used in SOAP-Class) This Class avoids duplicated code by r...
const IN_PROGRESS_POSTFIX
Class ilObjDataCollection.