44 $this->
ctrl = $DIC->ctrl();
45 $this->
lng = $DIC->language();
46 $this->
lng->loadLanguageModule(
"news");
47 $this->tpl =
$DIC[
"tpl"];
48 $this->setting =
$DIC[
"ilSetting"];
49 $this->
access = $DIC->access();
50 $this->tree =
$DIC->repositoryTree();
51 $this->parent_gui = $a_parent_gui;
52 $this->
object = $this->parent_gui->
getObject();
59 $next_class = $this->
ctrl->getNextClass($this);
60 $cmd = $this->
ctrl->getCmd(
"show");
62 switch ($next_class) {
64 if (in_array($cmd, [
"show",
"save"])) {
73 if ($this->
access->checkAccess($perm,
'', $this->object->getRefId())) {
77 $this->tpl->setOnScreenMessage(
79 $this->
lng->txt(
'msg_no_perm_read'),
82 $parent_ref_id = $this->tree->getParentId($this->
object->getRefId());
83 $this->
ctrl->redirectToURL($parent_ref_id > 0 ? ilLink::_getLink($parent_ref_id) :
'login.php?cmd=force_login');
86 public function show(): void
89 $this->tpl->setContent($form->getHTML());
97 if ($this->setting->get(
'block_activated_news')) {
100 if ($this->has_block_forced) {
101 $news->setChecked(
true);
102 $news->setDisabled(
true);
104 $news->setChecked($this->
object->getNewsBlockActivated());
106 $news->setInfo($this->
lng->txt(
'obj_tool_setting_news_info'));
108 $form->addItem($news);
112 if ($this->has_timeline) {
115 $cb->setInfo($this->
lng->txt(
"cont_news_timeline_info"));
116 $cb->setChecked($this->
object->getNewsTimeline());
120 $cb2 =
new ilCheckboxInputGUI($this->
lng->txt(
"cont_news_timeline_auto_entries"),
"news_timeline_auto_entries");
121 $cb2->setInfo($this->
lng->txt(
"cont_news_timeline_auto_entries_info"));
122 $cb2->setChecked($this->
object->getNewsTimelineAutoEntries());
123 $cb->addSubItem($cb2);
126 $cb2 =
new ilCheckboxInputGUI($this->
lng->txt(
"cont_news_timeline_landing_page"),
"news_timeline_landing_page");
127 $cb2->setInfo($this->
lng->txt(
"cont_news_timeline_landing_page_info"));
128 $cb2->setChecked($this->
object->getNewsTimelineLandingPage());
129 $cb->addSubItem($cb2);
139 $block_id = $this->
ctrl->getContextObjId();
144 "hide_news_per_date",
155 if ($hide_news_date !=
"") {
156 $hide_news_date = explode(
" ", $hide_news_date);
160 if ($this->has_hide_by_date) {
163 $this->
lng->txt(
"news_hide_news_per_date"),
166 $hnpd->setInfo($this->
lng->txt(
"news_hide_news_per_date_info"));
167 $hnpd->setChecked((
bool) $hide_news_per_date);
170 $dt_prop->setRequired(
true);
171 if (is_array($hide_news_date)) {
175 $dt_prop->setShowTime(
true);
177 $hnpd->addSubItem($dt_prop);
179 $form->addItem($hnpd);
183 if ($this->has_public_notification) {
187 $this->
lng->txt(
"news_notifications_public"),
188 "public_notifications"
190 $ch->setInfo($this->
lng->txt(
"news_notifications_public_info"));
191 $ch->setChecked((
bool) $public);
195 $form->setTitle($this->
lng->txt(
"cont_news_settings"));
196 $form->setFormAction($this->
ctrl->getFormAction($this));
197 $form->addCommandButton(
"save", $this->
lng->txt(
"save"));
205 if ($form->checkInput()) {
207 if (!$this->has_block_forced) {
210 if ($this->has_timeline) {
211 $this->
object->setNewsTimeline($form->getInput(
"news_timeline"));
212 $this->
object->setNewsTimelineAutoEntries($form->getInput(
"news_timeline_auto_entries"));
213 $this->
object->setNewsTimelineLandingPage($form->getInput(
"news_timeline_landing_page"));
215 if ($this->setting->get(
'block_activated_news')) {
217 $context_block_settings = [
218 "public_feed" => $form->getInput(
"notifications_public_feed") ??
"",
219 "default_visibility" => $form->getInput(
"default_visibility"),
220 "hide_news_per_date" => $form->getInput(
"hide_news_per_date"),
221 "hide_news_date" => $form->getInput(
"hide_news_date")
223 if ($this->has_public_notification) {
224 $context_block_settings[
"public_notifications"] =
225 $form->getInput(
'public_notifications');
238 $this->
object->update();
239 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
240 $this->
ctrl->redirect($this,
"");
242 $form->setValuesByPost();
243 $this->tpl->setContent($form->getHTML());
250 $this->has_timeline =
false;
251 $this->has_cron_notifications =
false;
252 $this->has_hide_by_date =
false;
253 $this->has_block_forced =
false;
258 $this->has_timeline = $a_value;
268 $this->has_cron_notifications = $a_value;
278 $this->has_hide_by_date = $a_value;
288 $this->has_public_notification = $a_value;
299 $this->has_block_forced = $a_value;
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $has_public_notification
setHideByDate(bool $a_value)
setNewsBlockForced(bool $a_value)
bool $has_cron_notifications
setPublicNotification(bool $a_value)
checkPermission(string $perm)
setCronNotifications(bool $a_value)
ilGlobalTemplateInterface $tpl
__construct(ilObjectGUI $a_parent_gui)
setTimeline(bool $a_value)
Class ilCtrl provides processing control methods.
@classDescription Date and time handling
static importFromForm(int $a_ref_id, ?ilPropertyFormGUI $a_form=null)
static addToSettingsForm(int $a_ref_id, ?ilPropertyFormGUI $a_form=null, ?ilFormPropertyGUI $a_input=null)
Add notification settings to form.
static string $block_type
static writeSettings(array $a_values)
static addToSettingsForm(ilFormPropertyGUI $a_input)
Add inputs to the container news settings form to configure also the contextBlock options.
Class ilObjectGUI Basic methods of all Output classes.
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
const MESSAGE_TYPE_FAILURE
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...