53 $this->tables = (
$table_id) ? array($this->dcl->getTableById(
$table_id)) : $this->dcl->getTables();
55 $lng->loadLanguageModule(
'dcl');
70 $dangerous_filename_characters = array(
" ",
'"',
"'",
"&",
"/",
"\\",
"?",
"#",
"`");
72 return str_replace($dangerous_filename_characters,
"_", iconv(
"utf-8",
"ascii//TRANSLIT",
$filename));
100 foreach ($table->
getFields() as $field) {
101 if ($field->getExportable()) {
119 foreach ($table->
getFields() as $field) {
120 if ($field->getExportable()) {
121 $field->fillHeaderExcel($worksheet, $row, $col);
148 public function export(
$format = self::EXPORT_EXCEL, $filepath = null, $send =
false)
150 if (count($this->tables) == 0) {
154 if (empty($filepath)) {
158 $basename = (isset($this->table_id)) ? $this->tables[0]->getTitle() :
'complete';
159 $filename = time() .
'__' . $basename .
"_" . date(
"Y-m-d_H-i");
163 $filename = pathinfo($filepath, PATHINFO_FILENAME);
166 $in_progress_file = $filepath . self::IN_PROGRESS_POSTFIX;
167 file_put_contents($in_progress_file,
"");
169 $data_available =
false;
170 $fields_available =
false;
172 case self::EXPORT_EXCEL:
174 foreach ($this->tables as
$table) {
177 $list = $table->getPartialRecords(null, null, null, 0, $this->
filter);
178 $data_available = $data_available || ($list[
'total'] > 0);
179 $fields_available = $fields_available || (count($table->getExportableFields()) > 0);
180 if ($list[
'total'] > 0 && count($table->getExportableFields()) > 0) {
182 $title = substr($table->getTitle(), 0, 31);
183 $adapter->addSheet($title);
195 foreach ($list[
'records'] as $set) {
200 $data_available =
true;
206 if (file_exists($in_progress_file)) {
207 unlink($in_progress_file);
210 if (!$data_available) {
216 if (!$fields_available) {
220 $this->lng->txt(
'dcl_no_export_fields_available'),
221 $ilCtrl->getLinkTargetByClass(array(
'ilDclTableListGUI',
'ilDclTableEditGUI',
'ilDclFieldListGUI'),
'listFields')
232 $adapter->writeToFile($filepath);
249 $ilLog = $DIC[
'ilLog'];
251 $method = self::SOAP_FUNCTION_NAME;
253 $soap_params = array($this->dcl->getRefId());
254 array_push($soap_params, $this->table_id,
$format, $filepath);
261 $soap_client->setResponseTimeout(5);
262 $soap_client->enableWSDL(
true);
264 $ilLog->write(__METHOD__ .
': Trying to call Soap client...');
266 array_unshift($soap_params, $new_session_id .
'::' .
$client_id);
268 if ($soap_client->init()) {
269 $ilLog->info(
'Calling soap ' . $method .
' method with params ' . print_r($soap_params,
true));
270 $res = $soap_client->call($method, $soap_params);
272 $ilLog->warning(
'SOAP clone call failed. Calling clone method manually');
273 require_once(
'./webservice/soap/include/inc.soap_functions.php');
274 if (method_exists(
'ilSoapFunctions', $method)) {
275 $res = ilSoapFunctions::$method($new_session_id .
'::' . $client_id, $this->dcl->getRefId(),
$this->table_id,
$format, $filepath);
277 throw new ilDclException(
"SOAP call " . $method .
" does not exists!");
static makeDirParents($a_dir)
Create a new directory and all parent directories.
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.