19 declare(strict_types=1);
76 if (!is_string($format_id)) {
77 throw new ilException(
'The format must be of type string.');
80 if (!strlen($format_id)) {
84 if (strtolower($format_id) != $format_id) {
85 throw new ilException(
'Please use a lowercase format.');
88 if (in_array($format_id, self::$reserved_formats)) {
89 throw new ilException(
'The format must not be one of: ' . implode(
', ', self::$reserved_formats));
98 final public function export():
void 103 $tpl = $DIC->ui()->mainTemplate();
104 $ctrl = $DIC->ctrl();
105 $lng = $DIC->language();
108 throw new ilException(
'Incomplete object configuration. Please pass an instance of ilObjTest before calling the export!');
114 if ($this->
txt($e->getMessage()) ==
'-' . $e->getMessage() .
'-') {
115 $tpl->setOnScreenMessage(
'failure', $e->getMessage(),
true);
117 $tpl->setOnScreenMessage(
'failure', $this->
txt($e->getMessage()),
true);
119 $ctrl->redirectByClass(
'iltestexportgui');
122 $tpl->setOnScreenMessage(
'success',
$lng->txt(
'exp_file_created'),
true);
123 $ctrl->redirectByClass(
'iltestexportgui');
setTimestmap(int $timestmap)
Abstract parent class for all event hook plugin classes.
Writeable part of repository interface to ilComponentDataDB.
getFormatLabel()
This method should return a human readable label for your export.
__construct(\ilDBInterface $db, \ilComponentRepositoryWrite $component_repository, string $id)
getFormatIdentifier()
A unique identifier which describes your export type, e.g.
ilComponentRepositoryWrite $component_repository
ilGlobalTemplateInterface $main_tpl
txt(string $a_var)
Get Language Variable (prefix will be prepended automatically)
buildExportFile(ilTestExportFilename $export_path)
This method is called if the user wants to export a test of YOUR export type If you throw an exceptio...