ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilLMPagesTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
18 protected $access;
19
23 public function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
24 {
25 global $DIC;
26
27 $this->ctrl = $DIC->ctrl();
28 $this->lng = $DIC->language();
29 $this->access = $DIC->access();
30 $ilCtrl = $DIC->ctrl();
31 $lng = $DIC->language();
32 $ilAccess = $DIC->access();
33 $lng = $DIC->language();
34
35 $this->lm = $a_lm;
36 $this->lm_set = new ilSetting("lm");
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38 $this->setData(ilLMPageObject::getPageList($this->lm->getId()));
39 $this->setTitle($lng->txt("cont_pages"));
40
41 $this->addColumn($this->lng->txt(""), "", "1");
42 $this->addColumn($this->lng->txt("type"), "", "1");
43 $this->addColumn($this->lng->txt("title"));
44 $this->addColumn($this->lng->txt("cont_usage"));
45
46 $this->setSelectAllCheckbox("id[]");
47
48 if ($this->lm->getLayoutPerPage()) {
49 $this->addColumn($this->lng->txt("cont_layout"));
50 }
51
52 $this->setLimit(9999);
53
54 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
55 $this->setRowTemplate("tpl.page_list_row.html", "Modules/LearningModule");
56
58 ilEditClipboard::getAction() == "copy") {
59 $this->addMultiCommand("pastePage", $lng->txt("pastePage"));
60 }
61
62 if ($this->lm->getLayoutPerPage()) {
63 $this->addMultiCommand("setPageLayout", $lng->txt("cont_set_layout"));
64 }
65
66 $this->addMultiCommand("activatePages", $lng->txt("cont_de_activate"));
67 $this->addMultiCommand("movePage", $lng->txt("movePage"));
68 $this->addMultiCommand("copyPage", $lng->txt("copyPage"));
69 $this->addMultiCommand("delete", $lng->txt("delete"));
70 $this->addMultiCommand("selectHeader", $lng->txt("selectHeader"));
71 $this->addMultiCommand("selectFooter", $lng->txt("selectFooter"));
72
73 // $this->addCommandButton("", $lng->txt(""));
74 }
75
79 protected function fillRow($a_set)
80 {
83 //var_dump($a_set);
84
85 // icon...
86
87 // check activation
89 $a_set["obj_id"],
90 $this->lm->getType(),
91 $this->lm_set->get("time_scheduled_page_activation")
92 );
93
94 // is page scheduled?
95 $img_sc = ($this->lm_set->get("time_scheduled_page_activation") &&
96 ilLMPage::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()))
97 ? "_sc"
98 : "";
99
100 if (!$active) {
101 $img = "icon_pg_d" . $img_sc . ".svg";
102 $alt = $lng->txt("cont_page_deactivated");
103 } else {
105 $a_set["obj_id"],
106 $this->lm->getType()
107 )) {
108 $img = "icon_pg_del" . $img_sc . ".svg";
109 $alt = $lng->txt("cont_page_deactivated_elements");
110 } else {
111 $img = "icon_pg" . $img_sc . ".svg";
112 $alt = $this->lng->txt("pg");
113 }
114 }
115 $this->tpl->setVariable("ICON", ilUtil::img(ilUtil::getImagePath($img), $alt));
116
117 // title/link
118 $ilCtrl->setParameter($this, "backcmd", "");
119 $ilCtrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_set["obj_id"]);
120 $this->tpl->setVariable(
121 "HREF_TITLE",
122 $ilCtrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit")
123 );
124 $this->tpl->setVariable("TITLE", $a_set["title"]);
125 $this->tpl->setVariable("ID", $a_set["obj_id"]);
126
127 // context
128 if ($this->lm->lm_tree->isInTree($a_set["obj_id"])) {
129 $path_str = $this->parent_obj->getContextPath($a_set["obj_id"]);
130 } else {
131 $path_str = "---";
132 }
133
134 // check whether page is header or footer
135 $add_str = "";
136 if ($a_set["obj_id"] == $this->lm->getHeaderPage()) {
137 $add_str = " <b>(" . $lng->txt("cont_header") . ")</b>";
138 }
139 if ($a_set["obj_id"] == $this->lm->getFooterPage()) {
140 $add_str .= " <b>(" . $lng->txt("cont_footer") . ")</b>";
141 }
142
143 $this->tpl->setVariable("USAGE", $path_str . $add_str);
144
145 // layout
146 if ($this->lm->getLayoutPerPage()) {
147 if (($l = ilLMObject::lookupLayout($a_set["obj_id"])) != "") {
148 $this->tpl->setVariable(
149 "LAYOUT",
150 $lng->txt("cont_layout_" . $l)
151 );
152 }
153 }
154 }
155}
An exception for terminatinating execution or to throw for unit testing.
static lookupLayout($a_obj_id)
Lookup type.
static getPageList($lm_id)
static
TableGUI class for all pages of a learning module.
fillRow($a_set)
Fill table row.
__construct($a_parent_obj, $a_parent_cmd, $a_lm)
Constructor.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
ILIAS Setting Class.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46