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');
68 $lng->loadLanguageModule(
'dcl');
81 $dangerous_filename_characters =
array(
" ",
'"',
"'",
"&",
"/",
"\\",
"?",
"#",
"`");
82 return str_replace($dangerous_filename_characters,
"_", iconv(
"utf-8",
"ascii//TRANSLIT",
$filename));
107 foreach ($table->
getFields() as $field) {
108 if ($field->getExportable()) {
125 foreach ($table->
getFields() as $field) {
126 if ($field->getExportable()) {
127 $field->fillHeaderExcel($worksheet,
$row, $col);
152 public function export($format = self::EXPORT_EXCEL, $filepath = null, $send =
false) {
154 if(count($this->tables) == 0) {
158 if(empty($filepath)) {
162 $basename = (isset($this->table_id))? $this->tables[0]->getTitle() :
'complete';
163 $filename =
time() .
'__' . $basename .
"_".date(
"Y-m-d_H-i");
167 $filename = pathinfo($filepath, PATHINFO_FILENAME);
170 $in_progress_file = $filepath.self::IN_PROGRESS_POSTFIX;
171 file_put_contents($in_progress_file,
"");
173 $data_available =
false;
174 $fields_available =
false;
176 case self::EXPORT_EXCEL:
177 require_once
"./Services/Excel/classes/class.ilExcel.php";
180 foreach($this->tables as
$table) {
183 $list = $table->getPartialRecords(null, null, null, 0, $this->filter);
184 $data_available = $data_available || ($list[
'total'] > 0);
185 $fields_available = $fields_available || (count($table->getExportableFields()) > 0);
186 if ($list[
'total'] > 0 && count($table->getExportableFields()) > 0) {
188 $title = substr($table->getTitle(), 0, 31);
201 foreach ($list[
'records'] as $set) {
206 $data_available =
true;
212 if (file_exists($in_progress_file)) {
213 unlink($in_progress_file);
216 if (!$data_available) {
221 if (!$fields_available) {
224 $ilCtrl->getLinkTargetByClass(
array(
'ilDclTableListGUI',
'ilDclTableEditGUI',
'ilDclFieldListGUI'),
'listFields')));
246 public function exportAsync($format = self::EXPORT_EXCEL, $filepath = null) {
250 $method = self::SOAP_FUNCTION_NAME;
252 $soap_params =
array($this->dcl->getRefId());
253 array_push($soap_params, $this->table_id, $format, $filepath);
259 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
262 $soap_client->setResponseTimeout(5);
263 $soap_client->enableWSDL(
true);
265 $ilLog->write(__METHOD__.
': Trying to call Soap client...');
267 array_unshift($soap_params, $new_session_id.
'::'.
$client_id);
269 if($soap_client->init())
271 $ilLog->info(
'Calling soap '.$method.
' method with params '.print_r($soap_params,
true));
272 $res = $soap_client->call($method, $soap_params);
276 $ilLog->warning(
'SOAP clone call failed. Calling clone method manually');
277 require_once(
'./webservice/soap/include/inc.soap_functions.php');
278 if(method_exists(
'ilSoapFunctions', $method)) {
281 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.
fillMetaExcel($table, $worksheet, $row)
Fill Excel meta-data.
sanitizeFilename($filename)
Sanitize the given filename The ilUtil::_sanitizeFilemame() does not clean enough.
Create styles array
The data for the language used.
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...
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
const IN_PROGRESS_POSTFIX
Class ilObjDataCollection.