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');
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()) {
132 $field->fillHeaderExcel($worksheet,
$row, $col);
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';
174 $filename = pathinfo($filepath, PATHINFO_FILENAME);
177 $in_progress_file = $filepath . self::IN_PROGRESS_POSTFIX;
178 file_put_contents($in_progress_file,
"");
180 $data_available =
false;
181 $fields_available =
false;
183 case self::EXPORT_EXCEL:
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) {
195 $title = substr($table->getTitle(), 0, 31);
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')
260 $method = self::SOAP_FUNCTION_NAME;
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!");
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
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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.