19 declare(strict_types=1);
39 object $a_parent_class,
41 ilExportHandlerFactoryInterface $export_handler
45 $this->post_data = ($DIC->http()->request()->getParsedBody() ?? []);
47 $this->tree = $DIC->repositoryTree();
48 $this->objDefinition = $DIC[
'objDefinition'];
49 $this->
access = $DIC->access();
54 $this->
lng->loadLanguageModule(
'export');
55 $this->
setTitle($this->
lng->txt(
'export_select_resources'));
57 $this->
addColumn($this->
lng->txt(
'export_last_export'),
'');
58 $this->
addColumn($this->
lng->txt(
'export_last_export_file'),
'');
59 $this->
addColumn($this->
lng->txt(
'export_create_new_file'),
'');
60 $this->
addColumn($this->
lng->txt(
'export_omit_resource'),
'');
64 $this->
setRowTemplate(
"tpl.export_item_selection_row.html",
"components/ILIAS/Export");
75 protected function fillRow(array $a_set): void
77 $a_set[
'copy'] = $a_set[
'copy'] ??
false;
78 $a_set[
'perm_copy'] = $a_set[
'perm_copy'] ??
false;
79 $a_set[
'link'] = $a_set[
'link'] ??
false;
80 $a_set[
'perm_export'] = $a_set[
'perm_export'] ??
false;
84 if ((!$a_set[
'copy'] or !$a_set[
'perm_copy']) and (!$a_set[
'link'])) {
87 if ($a_set[
'perm_export'] and $a_set[
'last_export']) {
88 $selected =
"EXPORT_E";
90 if (isset($this->post_data[
"cp_options"])) {
91 if (isset($a_set[
'ref_id']) && isset($this->post_data[
"cp_options"][$a_set[
'ref_id']][
"type"])) {
92 switch ($this->post_data[
"cp_options"][$a_set[
'ref_id']][
"type"]) {
97 $selected =
"EXPORT_E";
103 if ($a_set[
'last']) {
104 $this->tpl->setCurrentBlock(
'footer_export_e');
105 $this->tpl->setVariable(
'TXT_EXPORT_E_ALL', $this->
lng->txt(
'select_all'));
106 $this->tpl->parseCurrentBlock();
107 $this->tpl->setCurrentBlock(
'footer_export');
108 $this->tpl->setVariable(
'TXT_EXPORT_ALL', $this->
lng->txt(
'select_all'));
109 $this->tpl->parseCurrentBlock();
110 $this->tpl->setCurrentBlock(
'footer_omit');
111 $this->tpl->setVariable(
'TXT_OMIT_ALL', $this->
lng->txt(
'select_all'));
112 $this->tpl->parseCurrentBlock();
116 for ($i = 0; $i < $a_set[
'depth']; $i++) {
117 $this->tpl->touchBlock(
'padding');
118 $this->tpl->touchBlock(
'end_padding');
120 $this->tpl->setVariable(
124 $this->tpl->setVariable(
'TREE_ALT_IMG', $this->
lng->txt(
'obj_' . $a_set[
'type']));
125 $this->tpl->setVariable(
'TREE_TITLE', $a_set[
'title']);
127 if ($a_set[
'last_export']) {
128 $this->tpl->setVariable(
133 $this->tpl->setVariable(
'VAL_LAST_EXPORT', $this->
lng->txt(
'no_file'));
136 if ($a_set[
'source']) {
141 if ($a_set[
'perm_export'] and $a_set[
'last_export']) {
142 $this->tpl->setCurrentBlock(
'radio_export_e');
143 $this->tpl->setVariable(
'TXT_EXPORT_E', $this->
lng->txt(
'export_existing'));
144 $this->tpl->setVariable(
'NAME_EXPORT_E',
'cp_options[' . ($a_set[
'ref_id'] ?? 0) .
'][type]');
146 $this->tpl->setVariable(
148 $a_set[
'depth'] .
'_' . $a_set[
'type'] .
'_' . ($a_set[
'ref_id'] ?? 0) .
'_export_e' 150 $this->tpl->setVariable(
'EXPORT_E_CHECKED',
'checked="checked"');
151 $this->tpl->parseCurrentBlock();
152 } elseif (!$a_set[
'perm_export']) {
153 $this->tpl->setCurrentBlock(
'missing_export_perm');
154 $this->tpl->setVariable(
'TXT_MISSING_EXPORT_PERM', $this->
lng->txt(
'missing_perm'));
155 $this->tpl->parseCurrentBlock();
159 if ($a_set[
'perm_export'] and $a_set[
'export']) {
160 $this->tpl->setCurrentBlock(
'radio_export');
161 $this->tpl->setVariable(
'TXT_EXPORT', $this->
lng->txt(
'export'));
162 $this->tpl->setVariable(
'NAME_EXPORT',
'cp_options[' . ($a_set[
'ref_id'] ?? 0) .
'][type]');
164 $this->tpl->setVariable(
166 $a_set[
'depth'] .
'_' . $a_set[
'type'] .
'_' . ($a_set[
'ref_id'] ?? 0) .
'_export' 168 if ($selected ==
"EXPORT") {
169 $this->tpl->setVariable(
'EXPORT_CHECKED',
'checked="checked"');
171 $this->tpl->parseCurrentBlock();
172 } elseif ($a_set[
'export']) {
173 $this->tpl->setCurrentBlock(
'missing_export_perm');
174 $this->tpl->setVariable(
'TXT_MISSING_EXPORT_PERM', $this->
lng->txt(
'missing_perm'));
175 $this->tpl->parseCurrentBlock();
179 $this->tpl->setCurrentBlock(
'omit_radio');
180 $this->tpl->setVariable(
'TXT_OMIT', $this->
lng->txt(
'omit'));
181 $this->tpl->setVariable(
'NAME_OMIT',
'cp_options[' . ($a_set[
'ref_id'] ?? 0) .
'][type]');
183 $this->tpl->setVariable(
'ID_OMIT', $a_set[
'depth'] .
'_' . $a_set[
'type'] .
'_' . ($a_set[
'ref_id'] ?? 0) .
'_omit');
184 if ($selected ==
"OMIT") {
185 $this->tpl->setVariable($selected .
'_CHECKED',
'checked="checked"');
187 $this->tpl->parseCurrentBlock();
194 foreach ($this->tree->getSubTree($root = $this->tree->getNodeData($a_source)) as $node) {
195 if ($node[
'type'] ==
'rolf') {
198 if (!$this->objDefinition->allowExport($node[
'type'])) {
201 if ($node[
'type'] ==
"file" &&
207 $reference_id =
new ReferenceId((
int) $node[
'ref_id']);
208 $keys = $this->export_handler->repository()->key()->collection()->withElement(
209 $this->export_handler->repository()->key()->handler()->withObjectId($reference_id->toObjectId())
211 $elements = $this->export_handler->repository()->handler()->getElements($keys);
212 if ($elements->count() > 0) {
213 $r[
'last_export'] = $elements->newest()->getValues()->getCreationDate()->getTimestamp();
215 $r[
'last_export'] = 0;
219 $r[
'source'] = $first;
220 $r[
'ref_id'] = $node[
'child'];
221 $r[
'depth'] = $node[
'depth'] - $root[
'depth'];
222 $r[
'type'] = $node[
'type'];
223 $r[
'title'] = $node[
'title'];
224 $r[
'export'] = $this->objDefinition->allowExport($node[
'type']);
225 $r[
'perm_export'] = $this->
access->checkAccess(
'write',
'', (
int) $node[
'child']);
232 $rows[] = array(
'last' =>
true);
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
setFormAction(string $a_form_action, bool $a_multipart=false)
setEnableTitle(bool $a_enabletitle)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
__construct(object $a_parent_class, string $a_parent_cmd, ilExportHandlerFactoryInterface $export_handler)
static _isFileHidden(string $a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user. ...
setFormName(string $a_name="")
Object selection for export.
static _lookupObjId(int $ref_id)
parseContainer(int $a_source)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
ilExportHandlerFactoryInterface $export_handler
setEnableNumInfo(bool $a_val)
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
ilObjectDefinition $objDefinition
setEnableHeader(bool $a_enableheader)