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');
 
   66                $this->tables = (
$table_id)? array($this->dcl->getTableById(
$table_id)) : $this->dcl->getTables();
 
   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()) {
 
  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;
 
  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) {
 
  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) {
 
  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)) {
 
  279                                $res = ilSoapFunctions::$method($new_session_id.
'::'.
$client_id, $this->dcl->getRefId(), $this->table_id, $format, $filepath);
 
  281                                throw new ilDclException(
"SOAP call ".$method.
" does not exists!");
 
sprintf('%.4f', $callTime)
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.