3 declare(strict_types=1);
22 $this->
setId(
'tbl_didactic_tpl_settings');
24 $this->
access = $DIC->access();
30 public function init(): void
33 $this->
lng->loadLanguageModule(
'search');
34 $this->
lng->loadLanguageModule(
'meta');
36 $this->
addColumn($this->
lng->txt(
'search_title_description'),
'title',
'30%');
37 $this->
addColumn($this->
lng->txt(
'didactic_applicable_for'),
'applicable',
'20%');
38 $this->
addColumn($this->
lng->txt(
'didactic_scope'),
'scope',
'20%');
39 $this->
addColumn($this->
lng->txt(
'active'),
'active',
'10%');
42 $this->
setTitle($this->
lng->txt(
'didactic_available_templates'));
44 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
51 $this->
setRowTemplate(
'tpl.didactic_template_overview_row.html',
'Services/DidacticTemplate');
63 $tpls->readInactive();
64 $templates = $filter->
filter($tpls->getTemplates());
68 foreach ($templates as
$tpl) {
70 $data[$counter][
'id'] = $tpl->getId();
71 $data[$counter][
'icon'] = $tpl->getIconHandler()->getAbsolutePath();
72 $data[$counter][
'title'] = $tpl->getPresentationTitle();
73 $data[$counter][
'description'] = $tpl->getPresentationDescription();
74 $data[$counter][
'info'] = $tpl->getInfo();
75 $data[$counter][
'enabled'] = (
int) $tpl->isEnabled();
76 $data[$counter][
'assignments'] = $tpl->getAssignments();
79 foreach ($tpl->getAssignments() as $obj_type) {
80 $atxt .= ($this->
lng->txt(
'objs_' . $obj_type) .
'<br/>');
82 $data[$counter][
'applicable'] = $atxt;
83 $data[$counter][
'automatic_generated'] = $tpl->isAutoGenerated();
84 $data[$counter][
'scope'] = (array) $tpl->getEffectiveFrom();
92 protected function fillRow(array $a_set): void
94 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
95 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
98 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
99 $this->tpl->setVariable(
'VAL_DESC', $a_set[
'description']);
101 if (($a_set[
'icon'] ??
'') !==
'') {
102 $this->tpl->setVariable(
'ICON_SRC', $a_set[
'icon']);
103 foreach ((array) $a_set[
'assignments'] as $obj_type) {
104 $this->tpl->setVariable(
'ICON_ALT', $this->
lng->txt(
'objs_' . $obj_type));
108 foreach ((array) explode(
"\n", $a_set[
'info']) as $info) {
109 $trimmed_info = trim($info);
111 $this->tpl->setCurrentBlock(
'info');
112 $this->tpl->setVariable(
'VAL_INFO', $trimmed_info);
113 $this->tpl->parseCurrentBlock();
117 if ($a_set[
'automatic_generated']) {
118 $this->tpl->setVariable(
"VAL_AUTOMATIC_GENERATED", $this->
lng->txt(
"didactic_auto_generated"));
121 $this->tpl->setVariable(
127 $this->tpl->setVariable(
130 $this->
lng->txt(
'active') :
131 $this->
lng->txt(
'inactive')
135 foreach ((array) $a_set[
'assignments'] as $obj_type) {
136 $atxt .= ($this->
lng->txt(
'objs_' . $obj_type) .
'<br/>');
138 $this->tpl->setVariable(
'VAL_APPLICABLE', $atxt);
140 $this->
ctrl->setParameterByClass(
146 if (count($a_set[
'scope'])) {
147 $this->tpl->setCurrentBlock(
'scope_txt');
148 $this->tpl->setVariable(
'LOCAL_OR_GLOBAL', $this->
lng->txt(
'didactic_scope_list_header'));
149 $this->tpl->parseCurrentBlock();
151 foreach ($a_set[
'scope'] as
$ref_id) {
152 $this->tpl->setCurrentBlock(
'scope_entry');
155 $this->tpl->parseCurrentBlock();
158 $this->tpl->setCurrentBlock(
'scope_txt');
159 $this->tpl->setVariable(
161 isset($a_set[
'local']) ? $this->
lng->txt(
'meta_local') : $this->
lng->txt(
'meta_global')
163 $this->tpl->parseCurrentBlock();
166 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
168 $actions->setId((
string) $a_set[
'id']);
169 $actions->setListTitle($this->
lng->txt(
"actions"));
172 $this->
lng->txt(
'settings'),
179 $this->
lng->txt(
'copy'),
185 if (!$a_set[
'automatic_generated']) {
187 $this->
lng->txt(
'didactic_do_export'),
192 $this->tpl->setVariable(
'ACTION_DROPDOWN', $actions->getHTML());
193 } elseif (!$a_set[
'automatic_generated']) {
196 $this->tpl->setCurrentBlock(
'action_link');
197 $this->tpl->setVariable(
201 $this->tpl->setVariable(
'A_TEXT', $this->
lng->txt(
'didactic_do_export'));
202 $this->tpl->parseCurrentBlock();
204 $this->tpl->touchBlock(
'action_link');
Description of ilDidacticTemplateSettingsTableGUI.
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)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(object $a_parent_obj, string $a_parent_cmd, int $ref_id)
__construct(Container $dic, ilPlugin $plugin)
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)
parse(ilDidacticTemplateSettingsTableFilter $filter)
Parse didactic templates.
addMultiCommand(string $a_cmd, string $a_text)