ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSubItemSelectionTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
27  public function __construct(
28  object $a_parent_obj,
29  string $a_parent_cmd,
30  int $a_ref_id,
31  string $a_cmd = "createExportFile",
32  string $a_cmd_txt = ""
33  ) {
34  global $DIC;
35 
36  parent::__construct($a_parent_obj, $a_parent_cmd);
37  $this->lng->loadLanguageModule("export");
38 
39  if ($a_cmd_txt == "") {
40  $a_cmd_txt = $this->lng->txt("export_create_export_file");
41  }
42 
43  $this->addColumn($this->lng->txt("export_resource"));
44  $this->addColumn($this->lng->txt("export_last_export"));
45  $this->addColumn($this->lng->txt("export_last_export_file"), "", "20%");
46  $this->addColumn($this->lng->txt("export_create_new_file"), "", "20%");
47  $this->addColumn($this->lng->txt("export_omit_resource"), "", "20%");
48  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
49  $this->addCommandButton($a_cmd, $a_cmd_txt);
50  $this->setRowTemplate(
51  "tpl.sub_item_selection_row.html",
52  "Services/Export"
53  );
54  $this->setTitle($this->lng->txt("export_select_resources"));
55  $this->setData(ilExport::_getValidExportSubItems($a_ref_id));
56  $this->setLimit(99999);
57  }
58 
62  protected function fillRow(array $a_set): void
63  {
64  $now = new ilDateTime(time(), IL_CAL_UNIX);
65 
66  $this->tpl->setVariable("IMG_ALT", $this->lng->txt("obj_" . $a_set["type"]));
67  $this->tpl->setVariable("IMG_SRC", ilObject::_getIcon(
68  (int) $a_set["obj_id"],
69  "small",
70  $a_set["type"]
71  ));
72  $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
73  $this->tpl->setVariable("ID", $a_set["ref_id"]);
74  $this->tpl->setVariable("TXT_LAST_EXPORT_FILE", $this->lng->txt("export_last_file"));
75  $this->tpl->setVariable("TXT_OMIT", $this->lng->txt("export_omit"));
76  $this->tpl->setVariable("TXT_CREATE_NEW_EXPORT_FILE", $this->lng->txt("export_create"));
77  $preset = "CREATE";
78  if ($a_set["timestamp"] > 0) {
79  $last_export = new ilDateTime($a_set["timestamp"], IL_CAL_UNIX);
80  $this->tpl->setVariable(
81  "VAL_LAST_EXPORT",
82  ilDatePresentation::formatDate($last_export)
83  );
84  if (ilDateTime::_equals($last_export, $now, IL_CAL_DAY)) {
85  $preset = "LAST_FILE";
86  }
87  }
88  $this->tpl->setVariable("SEL_" . $preset, ' checked="checked" ');
89  }
90 }
setData(array $a_data)
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)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
static _getValidExportSubItems(int $a_ref_id)
Get a list of subitems of a repository resource, that implement the export.
global $DIC
Definition: feed.php:28
const IL_CAL_DAY
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id, string $a_cmd="createExportFile", string $a_cmd_txt="")