Skip to content

Commit

Permalink
Php8/datacollection (#4023)
Browse files Browse the repository at this point in the history
* reformated code

* fixed fatal errors

* new code styling

* fixed content page errors

* new code style

Co-authored-by: root <[email protected]>
Co-authored-by: Martin Studer <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2022
1 parent c0e3942 commit d7d3900
Show file tree
Hide file tree
Showing 155 changed files with 1,302 additions and 2,793 deletions.
28 changes: 14 additions & 14 deletions Modules/DataCollection/LuceneObjectDefinition.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<ObjectDefinition xmlns:xi="http://www.w3.org/2001/XInclude" type="dcl" indexType="incremental">
<Document type="default">
<xi:include href="../../Services/Object/LuceneDataSource.xml" />
<xi:include href="../../Services/Tagging/LuceneDataSource.xml" />
<xi:include href="../../Modules/LearningModule/LucenePageEditorDataSource.xml" />
<DataSource type="JDBC" action="append">
<Query>
SELECT 1 as offline FROM il_dcl_data
WHERE is_online = 0
AND id IN(?)
</Query>
<Param format="list" type="int" value="objId" />
<Field store="YES" index="NOT_ANALYZED" column="offline" type="text" name="offline" />
</DataSource>
</Document>
<Document type="default">
<xi:include href="../../Services/Object/LuceneDataSource.xml"/>
<xi:include href="../../Services/Tagging/LuceneDataSource.xml"/>
<xi:include href="../../Modules/LearningModule/LucenePageEditorDataSource.xml"/>
<DataSource type="JDBC" action="append">
<Query>
SELECT 1 as offline FROM il_dcl_data
WHERE is_online = 0
AND id IN(?)
</Query>
<Param format="list" type="int" value="objId"/>
<Field store="YES" index="NOT_ANALYZED" column="offline" type="text" name="offline"/>
</DataSource>
</Document>
</ObjectDefinition>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/**
* Hook-Class for exporting data-collections (used in SOAP-Class)
* This Class avoids duplicated code by routing the request to the right place
*
* @author Michael Herren <[email protected]>
* @ingroup ModulesDataCollection
*/
Expand Down Expand Up @@ -40,7 +39,6 @@ class ilDclContentExporter
protected $table;
private \ilGlobalTemplateInterface $main_tpl;


public function __construct($ref_id, $table_id = null, $filter = array())
{
global $DIC;
Expand All @@ -58,13 +56,10 @@ public function __construct($ref_id, $table_id = null, $filter = array())
$this->lng = $lng;
}


/**
* Sanitize the given filename
* The ilUtil::_sanitizeFilemame() does not clean enough
*
* @param $filename
*
* @return string
*/
public function sanitizeFilename($filename)
Expand All @@ -74,23 +69,18 @@ public function sanitizeFilename($filename)
return str_replace($dangerous_filename_characters, "_", iconv("utf-8", "ascii//TRANSLIT", $filename));
}


/**
* Return export path
*
* @param $format
*
* @return string
*/
public function getExportContentPath($format)
{
return ilExport::_getExportDirectory($this->dcl->getId(), $format, 'dcl') . '/';
}


/**
* Fill a excel row
*
* @param ilDclTable $table
* @param ilExcel $worksheet
* @param ilDclBaseRecordModel $record
Expand All @@ -106,10 +96,8 @@ protected function fillRowExcel(ilDclTable $table, ilExcel $worksheet, ilDclBase
}
}


/**
* Fill Excel header
*
* @param ilDclTable $table
* @param ilExcel $worksheet
* @param $row
Expand All @@ -125,10 +113,8 @@ protected function fillHeaderExcel(ilDclTable $table, ilExcel $worksheet, $row)
}
}


/**
* Fill Excel meta-data
*
* @param $table
* @param $worksheet
* @param $row
Expand All @@ -137,14 +123,11 @@ protected function fillMetaExcel($table, $worksheet, $row)
{
}


/**
* Creates an export of a specific datacollection table
*
* @param string $format
* @param null $filepath
* @param bool|false $send
*
* @return null|string|void
*/
public function export($format = self::EXPORT_EXCEL, $filepath = null, $send = false)
Expand Down Expand Up @@ -221,7 +204,6 @@ public function export($format = self::EXPORT_EXCEL, $filepath = null, $send = f
$this->lng->txt('dcl_no_export_fields_available'),
$ilCtrl->getLinkTargetByClass(array('ilDclTableListGUI', 'ilDclTableEditGUI', 'ilDclFieldListGUI'), 'listFields')
));

return false;
}

Expand All @@ -233,13 +215,10 @@ public function export($format = self::EXPORT_EXCEL, $filepath = null, $send = f
}
}


/**
* Start Export async
*
* @param string $format
* @param null $filepath
*
* @return mixed
* @throws ilDclException
*/
Expand Down Expand Up @@ -272,7 +251,8 @@ public function exportAsync($format = self::EXPORT_EXCEL, $filepath = null)
$ilLog->warning('SOAP clone call failed. Calling clone method manually');
require_once('./webservice/soap/include/inc.soap_functions.php');
if (method_exists('ilSoapFunctions', $method)) {
$res = ilSoapFunctions::$method($new_session_id . '::' . $client_id, $this->dcl->getRefId(), $this->table_id, $format, $filepath);
$res = ilSoapFunctions::$method($new_session_id . '::' . $client_id, $this->dcl->getRefId(),
$this->table_id, $format, $filepath);
} else {
throw new ilDclException("SOAP call " . $method . " does not exists!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/**
* Hook-Class for exporting data-collections (used in SOAP-Class)
* This Class avoids duplicated code by routing the request to the right place
*
* @author Michael Herren <[email protected]>
* @ingroup ModulesDataCollection
*/
Expand Down Expand Up @@ -55,7 +54,6 @@ class ilDclContentImporter
*/
protected $lng;


public function __construct($ref_id, $table_id = null)
{
global $DIC;
Expand All @@ -70,7 +68,6 @@ public function __construct($ref_id, $table_id = null)
$this->tables = ($table_id) ? array($this->dcl->getTableById($table_id)) : $this->dcl->getTables();
}


public function import($file, $simulate = false)
{
global $DIC;
Expand Down Expand Up @@ -172,10 +169,8 @@ public function import($file, $simulate = false)
return array('line' => ($i - 2 < 0 ? 0 : $i - 2), 'warnings' => $this->warnings);
}


/**
* @param ilDclBaseFieldModel $field
*
* @return bool
*/
protected function checkImportType($field)
Expand All @@ -189,11 +184,9 @@ protected function checkImportType($field)
}
}


/**
* @param ilDclTable $table
* @param $titles string[]
*
* @return ilDclBaseFieldModel[]
*/
protected function getImportFieldsFromTitles($table, $titles)
Expand Down
Loading

0 comments on commit d7d3900

Please sign in to comment.