76 $this->ctrl = $DIC->ctrl();
77 $this->lng = $DIC->language();
78 $this->lng->loadLanguageModule(
"news");
79 $this->tpl = $DIC[
"tpl"];
80 $this->setting = $DIC[
"ilSetting"];
81 $this->parent_gui = $a_parent_gui;
82 $this->
object = $this->parent_gui->object;
92 $next_class = $this->ctrl->getNextClass($this);
93 $cmd = $this->ctrl->getCmd(
"show");
95 switch ($next_class) {
97 if (in_array($cmd, array(
"show",
"save"))) {
112 $this->tpl->setContent(
$form->getHTML());
123 if ($this->setting->get(
'block_activated_news')) {
126 if ($this->has_block_forced) {
127 $news->setChecked(
true);
128 $news->setDisabled(
true);
130 $news->setChecked($this->object->getNewsBlockActivated());
132 $news->setInfo($this->lng->txt(
'obj_tool_setting_news_info'));
134 $form->addItem($news);
138 if ($this->has_timeline) {
141 $cb->
setInfo($this->lng->txt(
"cont_news_timeline_info"));
142 $cb->setChecked($this->object->getNewsTimeline());
146 $cb2 =
new ilCheckboxInputGUI($this->lng->txt(
"cont_news_timeline_auto_entries"),
"news_timeline_auto_entries");
147 $cb2->
setInfo($this->lng->txt(
"cont_news_timeline_auto_entries_info"));
148 $cb2->setChecked($this->object->getNewsTimelineAutoEntries());
149 $cb->addSubItem($cb2);
152 $cb2 =
new ilCheckboxInputGUI($this->lng->txt(
"cont_news_timeline_landing_page"),
"news_timeline_landing_page");
153 $cb2->
setInfo($this->lng->txt(
"cont_news_timeline_landing_page_info"));
154 $cb2->setChecked($this->object->getNewsTimelineLandingPage());
155 $cb->addSubItem($cb2);
159 if ($this->has_cron_notifications) {
162 include_once
'Services/Membership/classes/class.ilMembershipNotifications.php';
167 $block_id = $this->ctrl->getContextObjId();
172 "hide_news_per_date",
183 if ($hide_news_date !=
"") {
184 $hide_news_date = explode(
" ", $hide_news_date);
188 if ($this->has_hide_by_date) {
191 $this->lng->txt(
"news_hide_news_per_date"),
194 $hnpd->
setInfo($this->lng->txt(
"news_hide_news_per_date_info"));
195 $hnpd->setChecked($hide_news_per_date);
197 $dt_prop =
new ilDateTimeInputGUI($this->lng->txt(
"news_hide_news_date"),
"hide_news_date");
200 if ($hide_news_date !=
"") {
204 $dt_prop->setShowTime(
true);
206 $hnpd->addSubItem($dt_prop);
208 $form->addItem($hnpd);
212 if ($this->has_public_notification) {
216 $this->lng->txt(
"news_notifications_public"),
217 "public_notifications" 219 $ch->
setInfo($this->lng->txt(
"news_notifications_public_info"));
220 $ch->setChecked($public);
224 $form->setTitle($this->lng->txt(
"cont_news_settings"));
225 $form->setFormAction($this->ctrl->getFormAction($this));
226 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
237 if (
$form->checkInput()) {
238 include_once(
"./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
240 if (!$this->has_block_forced) {
243 if ($this->has_timeline) {
244 $this->
object->setNewsTimeline(
$form->getInput(
"news_timeline"));
245 $this->
object->setNewsTimelineAutoEntries(
$form->getInput(
"news_timeline_auto_entries"));
246 $this->
object->setNewsTimelineLandingPage(
$form->getInput(
"news_timeline_landing_page"));
248 if ($this->setting->get(
'block_activated_news')) {
250 $context_block_settings = array(
251 "public_feed" =>
$_POST[
"notifications_public_feed"],
252 "default_visibility" =>
$_POST[
"default_visibility"],
253 "hide_news_per_date" =>
$_POST[
"hide_news_per_date"],
254 "hide_news_date" =>
$_POST[
"hide_news_date"]
256 if ($this->has_public_notification) {
257 $context_block_settings[
"public_notifications"] =
$_POST[
'public_notifications'];
265 include_once
"Services/Membership/classes/class.ilMembershipNotifications.php";
270 $this->
object->update();
271 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
272 $this->ctrl->redirect($this,
"");
274 $form->setValuesByPost();
275 $this->tpl->setContent(
$form->getHtml());
284 $this->has_timeline =
false;
285 $this->has_cron_notifications =
false;
286 $this->has_hide_by_date =
false;
287 $this->has_block_forced =
false;
296 $this->has_timeline = $a_value;
314 $this->has_cron_notifications = $a_value;
332 $this->has_hide_by_date = $a_value;
350 $this->has_public_notification = $a_value;
368 $this->has_block_forced = $a_value;
executeCommand()
Execute command.
getPublicNotification()
Get if this repository object has public notifications available.
getCronNotifications()
Get if the container has a configurable cron job to send notifications.
setHideByDate(bool $a_value)
Set if the container can hide news created before a date.
getHideByDate()
Get if the container can hide news created before a date.
setCronNotifications(bool $a_value)
Set if the container has a configurable cron job to send notifications.
setPublicNotification(bool $a_value)
Set if this repository object has public notifications.
static _getAllReferences($a_id)
get all reference ids of object
save()
Save settings form.
__construct(ilObjectGUI $a_parent_gui)
Constructor.
static addToSettingsForm($a_ref_id, ilPropertyFormGUI $a_form=null, ilFormPropertyGUI $a_input=null)
Add notification settings to form.
if(isset($_POST['submit'])) $form
News settings for containers.
Class ilObjectGUI Basic methods of all Output classes.
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
setTimeline(bool $a_value)
Set if the container has timeline or not.
initDefaultOptions()
Set all possible news options as false;.
getTimeline()
Get if the container has timeline or not.
static writeSettings($a_values)
static _lookupType($a_id, $a_reference=false)
lookup object type
initForm()
Init settings form.
getNewsBlockForced()
Get if the repository object has the news block forced.
static addToSettingsForm(ilFormPropertyGUI $a_input)
Add inputs to the container news settings form to configure also the contextBlock options...
static importFromForm($a_ref_id, ilPropertyFormGUI $a_form=null)
Import notification settings from form.
setNewsBlockForced(bool $a_value)
Set if the News block is forced.