ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjBlogAdministrationGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
30 public function __construct(
31 $a_data,
32 int $a_id,
33 bool $a_call_by_reference = true,
34 bool $a_prepare_output = true
35 ) {
36 global $DIC;
37
38 $this->lng = $DIC->language();
39 $this->settings = $DIC->settings();
40 $this->ctrl = $DIC->ctrl();
41 $this->type = "blga";
42 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
43
44 $this->lng->loadLanguageModule("blog");
45 }
46
47 public function executeCommand(): void
48 {
49 $next_class = $this->ctrl->getNextClass($this);
50 $cmd = $this->ctrl->getCmd();
51
52 $this->prepareOutput();
53
54 switch ($next_class) {
55 case 'ilpermissiongui':
56 $this->tabs_gui->setTabActive('perm_settings');
57 $perm_gui = new ilPermissionGUI($this);
58 $this->ctrl->forwardCommand($perm_gui);
59 break;
60
61 default:
62 if (!$cmd || $cmd === 'view') {
63 $cmd = "editSettings";
64 }
65
66 $this->$cmd();
67 break;
68 }
69 }
70
71 public function getAdminTabs(): void
72 {
73 if ($this->checkPermissionBool("visible,read")) {
74 $this->tabs_gui->addTarget(
75 "settings",
76 $this->ctrl->getLinkTarget($this, "editSettings"),
77 array("editSettings", "view")
78 );
79 }
80
81 if ($this->checkPermissionBool('edit_permission')) {
82 $this->tabs_gui->addTarget(
83 "perm_settings",
84 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
85 array(),
86 'ilpermissiongui'
87 );
88 }
89 }
90
91 public function editSettings(?ilPropertyFormGUI $a_form = null): void
92 {
95
96 $this->tabs_gui->setTabActive('settings');
97
98 if (!$ilSetting->get("disable_wsp_blogs")) {
99 $this->tpl->setOnScreenMessage('info', $lng->txt("blog_admin_toggle_info"));
100 } else {
101 $this->tpl->setOnScreenMessage('info', $lng->txt("blog_admin_inactive_info"));
102 }
103
104 if (!$a_form) {
105 $a_form = $this->initFormSettings();
106 }
107 $this->tpl->setContent($a_form->getHTML());
108 }
109
110 public function saveSettings(): void
111 {
112 $ilCtrl = $this->ctrl;
113
114 $this->checkPermission("write");
115
116 $form = $this->initFormSettings();
117 if ($form->checkInput()) {
118
119 $blga_set = new ilSetting("blga");
120 $blga_set->set("mask", (string) (bool) $form->getInput("mask"));
121 $blga_set->set("est_reading_time", (string) (bool) $form->getInput("est_reading_time"));
122
123 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
124 $ilCtrl->redirect($this, "editSettings");
125 }
126
127 $form->setValuesByPost();
128 $this->editSettings($form);
129 }
130
131 public function cancel(): void
132 {
133 $ilCtrl = $this->ctrl;
134
135 $ilCtrl->redirect($this, "view");
136 }
137
139 {
141
142 $form = new ilPropertyFormGUI();
143 $form->setFormAction($this->ctrl->getFormAction($this));
144 $form->setTitle($this->lng->txt('blog_settings'));
145
146 if ($this->checkPermissionBool("write")) {
147 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
148 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
149 }
150
151 $blga_set = new ilSetting("blga");
152
153 $cb_prop = new ilCheckboxInputGUI(
154 $lng->txt("blog_est_reading_time"),
155 "est_reading_time"
156 );
157 $cb_prop->setInfo($lng->txt("blog_est_reading_time_info"));
158 $cb_prop->setChecked((bool) $blga_set->get("est_reading_time"));
159 $form->addItem($cb_prop);
160
161 return $form;
162 }
163}
This class represents a checkbox property in a property form.
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
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...
editSettings(?ilPropertyFormGUI $a_form=null)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
getAdminTabs()
administration tabs show only permissions and trash folder
Class ilObjectGUI Basic methods of all Output classes.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilSetting $settings
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
This class represents a property form user interface.
ILIAS Setting Class.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26