ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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", "components/ILIAS/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 {
85 $ilCtrl = $this->ctrl;
86
87 // icon...
88
89 // check activation
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 = ((bool) $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 = "standard/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 = "standard/icon_pg_del" . $img_sc . ".svg";
111 $alt = $lng->txt("cont_page_deactivated_elements");
112 } else {
113 $img = "standard/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 = " <strong>(" . $lng->txt("cont_header") . ")</strong>";
140 }
141 if ($a_set["obj_id"] == $this->lm->getFooterPage()) {
142 $add_str .= " <strong>(" . $lng->txt("cont_footer") . ")</strong>";
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}
static lookupLayout(int $a_obj_id)
Lookup type.
static getPageList(int $lm_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjLearningModule $lm
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjLearningModule $a_lm)
fillRow(array $a_set)
Standard Version of Fill Row.
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...
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.
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
static _lookupContainsDeactivatedElements(int $a_id, string $a_parent_type, string $a_lang="-")
lookup whether page contains deactivated elements
ILIAS Setting Class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26