ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLMPagesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  protected ilSetting $lm_set;
29 
30  public function __construct(
31  object $a_parent_obj,
32  string $a_parent_cmd,
34  ) {
35  global $DIC;
36 
37  $this->ctrl = $DIC->ctrl();
38  $this->lng = $DIC->language();
39  $this->access = $DIC->access();
40  $ilCtrl = $DIC->ctrl();
41  $lng = $DIC->language();
42 
43  $this->lm = $a_lm;
44  $this->lm_set = new ilSetting("lm");
45  parent::__construct($a_parent_obj, $a_parent_cmd);
46  $this->setData(ilLMPageObject::getPageList($this->lm->getId()));
47  $this->setTitle($lng->txt("cont_pages"));
48 
49  $this->addColumn($this->lng->txt(""), "", "1");
50  $this->addColumn($this->lng->txt("type"), "", "1");
51  $this->addColumn($this->lng->txt("title"));
52  $this->addColumn($this->lng->txt("cont_usage"));
53 
54  $this->setSelectAllCheckbox("id[]");
55 
56  if ($this->lm->getLayoutPerPage()) {
57  $this->addColumn($this->lng->txt("cont_layout"));
58  }
59 
60  $this->setLimit(9999);
61 
62  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
63  $this->setRowTemplate("tpl.page_list_row.html", "Modules/LearningModule");
64 
66  ilEditClipboard::getAction() == "copy") {
67  $this->addMultiCommand("pastePage", $lng->txt("pastePage"));
68  }
69 
70  if ($this->lm->getLayoutPerPage()) {
71  $this->addMultiCommand("setPageLayout", $lng->txt("cont_set_layout"));
72  }
73 
74  $this->addMultiCommand("activatePages", $lng->txt("cont_de_activate"));
75  $this->addMultiCommand("movePage", $lng->txt("movePage"));
76  $this->addMultiCommand("copyPage", $lng->txt("copyPage"));
77  $this->addMultiCommand("delete", $lng->txt("delete"));
78  $this->addMultiCommand("selectHeader", $lng->txt("selectHeader"));
79  $this->addMultiCommand("selectFooter", $lng->txt("selectFooter"));
80  }
81 
82  protected function fillRow(array $a_set): void
83  {
84  $lng = $this->lng;
85  $ilCtrl = $this->ctrl;
86 
87  // icon...
88 
89  // check activation
90  $active = ilLMPage::_lookupActive(
91  $a_set["obj_id"],
92  $this->lm->getType(),
93  (bool) $this->lm_set->get("time_scheduled_page_activation")
94  );
95 
96  // is page scheduled?
97  $img_sc = ($this->lm_set->get("time_scheduled_page_activation") &&
98  ilLMPage::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()))
99  ? "_sc"
100  : "";
101 
102  if (!$active) {
103  $img = "icon_pg_d" . $img_sc . ".svg";
104  $alt = $lng->txt("cont_page_deactivated");
105  } else {
107  $a_set["obj_id"],
108  $this->lm->getType()
109  )) {
110  $img = "icon_pg_del" . $img_sc . ".svg";
111  $alt = $lng->txt("cont_page_deactivated_elements");
112  } else {
113  $img = "icon_pg" . $img_sc . ".svg";
114  $alt = $this->lng->txt("pg");
115  }
116  }
117  $this->tpl->setVariable("ICON", ilUtil::img(ilUtil::getImagePath($img), $alt));
118 
119  // title/link
120  $ilCtrl->setParameter($this, "backcmd", null);
121  $ilCtrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_set["obj_id"]);
122  $this->tpl->setVariable(
123  "HREF_TITLE",
124  $ilCtrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit")
125  );
126  $this->tpl->setVariable("TITLE", $a_set["title"]);
127  $this->tpl->setVariable("ID", $a_set["obj_id"]);
128 
129  // context
130  if ($this->lm->lm_tree->isInTree($a_set["obj_id"])) {
131  $path_str = $this->parent_obj->getContextPath($a_set["obj_id"]);
132  } else {
133  $path_str = "---";
134  }
135 
136  // check whether page is header or footer
137  $add_str = "";
138  if ($a_set["obj_id"] == $this->lm->getHeaderPage()) {
139  $add_str = " <b>(" . $lng->txt("cont_header") . ")</b>";
140  }
141  if ($a_set["obj_id"] == $this->lm->getFooterPage()) {
142  $add_str .= " <b>(" . $lng->txt("cont_footer") . ")</b>";
143  }
144 
145  $this->tpl->setVariable("USAGE", $path_str . $add_str);
146 
147  // layout
148  if ($this->lm->getLayoutPerPage()) {
149  if (($l = ilLMObject::lookupLayout($a_set["obj_id"])) != "") {
150  $this->tpl->setVariable(
151  "LAYOUT",
152  $lng->txt("cont_layout_" . $l)
153  );
154  }
155  }
156  }
157 }
setData(array $a_data)
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _isScheduledActivation(int $a_id, string $a_parent_type, string $a_lang="-")
Check whether page is activated by time schedule.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjLearningModule $a_lm)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
ilLanguage $lng
global $DIC
Definition: feed.php:28
static _lookupContainsDeactivatedElements(int $a_id, string $a_parent_type, string $a_lang="-")
lookup whether page contains deactivated elements
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
ilObjLearningModule $lm
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
$img
Definition: imgupload.php:83
static getPageList(int $lm_id)
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
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)
static lookupLayout(int $a_obj_id)
Lookup type.
addMultiCommand(string $a_cmd, string $a_text)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...