5require_once(
'./Modules/DataCollection/classes/class.ilObjDataCollectionAccess.php');
6require_once(
'./Modules/DataCollection/classes/class.ilObjDataCollectionGUI.php');
7require_once(
'./Modules/DataCollection/classes/Content/class.ilDclRecordListGUI.php');
8require_once(
'./Modules/DataCollection/classes/Table/class.ilDclTable.php');
9require_once(
'./Services/Export/classes/class.ilExport.php');
67 $this->tables = (
$table_id)? array($this->dcl->getTableById(
$table_id)) : $this->dcl->getTables();
69 $lng->loadLanguageModule(
'dcl');
83 $dangerous_filename_characters = array(
" ",
'"',
"'",
"&",
"/",
"\\",
"?",
"#",
"`");
84 return str_replace($dangerous_filename_characters,
"_", iconv(
"utf-8",
"ascii//TRANSLIT",
$filename));
111 foreach (
$table->getFields() as $field) {
112 if ($field->getExportable()) {
130 foreach (
$table->getFields() as $field) {
131 if ($field->getExportable()) {
159 public function export(
$format = self::EXPORT_EXCEL, $filepath =
null, $send =
false)
161 if (count($this->tables) == 0) {
165 if (empty($filepath)) {
169 $basename = (isset($this->table_id))? $this->tables[0]->getTitle() :
'complete';
170 $filename = time() .
'__' . $basename .
"_" .
date(
"Y-m-d_H-i");
174 $filename = pathinfo($filepath, PATHINFO_FILENAME);
178 file_put_contents($in_progress_file,
"");
180 $data_available =
false;
181 $fields_available =
false;
184 require_once
"./Services/Excel/classes/class.ilExcel.php";
187 foreach ($this->tables as
$table) {
190 $list =
$table->getPartialRecords(
null,
null,
null, 0, $this->filter);
191 $data_available = $data_available || (
$list[
'total'] > 0);
192 $fields_available = $fields_available || (count(
$table->getExportableFields()) > 0);
193 if (
$list[
'total'] > 0 && count(
$table->getExportableFields()) > 0) {
208 foreach (
$list[
'records'] as $set) {
213 $data_available =
true;
219 if (file_exists($in_progress_file)) {
220 unlink($in_progress_file);
223 if (!$data_available) {
228 if (!$fields_available) {
231 $this->lng->txt(
'dcl_no_export_fields_available'),
232 $ilCtrl->getLinkTargetByClass(array(
'ilDclTableListGUI',
'ilDclTableEditGUI',
'ilDclFieldListGUI'),
'listFields')
262 $soap_params = array($this->dcl->getRefId());
263 array_push($soap_params, $this->table_id,
$format, $filepath);
269 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
272 $soap_client->setResponseTimeout(5);
273 $soap_client->enableWSDL(
true);
275 $ilLog->write(__METHOD__ .
': Trying to call Soap client...');
277 array_unshift($soap_params, $new_session_id .
'::' .
$client_id);
279 if ($soap_client->init()) {
280 $ilLog->info(
'Calling soap ' . $method .
' method with params ' . print_r($soap_params,
true));
281 $res = $soap_client->call($method, $soap_params);
283 $ilLog->warning(
'SOAP clone call failed. Calling clone method manually');
284 require_once(
'./webservice/soap/include/inc.soap_functions.php');
285 if (method_exists(
'ilSoapFunctions', $method)) {
286 $res = ilSoapFunctions::$method($new_session_id .
'::' .
$client_id, $this->dcl->getRefId(), $this->table_id,
$format, $filepath);
288 throw new ilDclException(
"SOAP call " . $method .
" does not exists!");
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseRecordModel.
fillRecordFieldExcelExport(ilExcel $worksheet, &$row, &$col, $field_id)
static resetCache()
Resets all the cache fields.
Hook-Class for exporting data-collections (used in SOAP-Class) This Class avoids duplicated code by r...
getExportContentPath($format)
Return export path.
fillHeaderExcel(ilDclTable $table, ilExcel $worksheet, $row)
Fill Excel header.
export($format=self::EXPORT_EXCEL, $filepath=null, $send=false)
Creates an export of a specific datacollection table.
fillMetaExcel($table, $worksheet, $row)
Fill Excel meta-data.
sanitizeFilename($filename)
Sanitize the given filename The ilUtil::_sanitizeFilemame() does not clean enough.
fillRowExcel(ilDclTable $table, ilExcel $worksheet, ilDclBaseRecordModel $record, $row)
Fill a excel row.
exportAsync($format=self::EXPORT_EXCEL, $filepath=null)
Start Export async.
__construct($ref_id, $table_id=null, $filter=array())
const IN_PROGRESS_POSTFIX
Class ilDclBaseFieldModel.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
Class ilObjDataCollection.
static _duplicate($a_session_id)
Duplicate session.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_REQUEST['delete'])) $list
foreach($_POST as $key=> $value) $res