108 {
110
111
112 if ($this->setting->get('block_activated_news')) {
114 $this->
lng->txt($this->news_block_label),
116 );
117 $news->setValue('1');
118 if ($this->has_block_forced) {
119 $news->setChecked(true);
120 $news->setDisabled(true);
121 } else {
122 $news->setChecked($this->
object->getNewsBlockActivated());
123 }
124 if ($this->news_block_info !== null) {
125 $news->setInfo($this->
lng->txt($this->news_block_info));
126 }
128 $form->addItem($news);
129 }
130
131
132 if ($this->has_timeline) {
133
135 $cb->setInfo($this->
lng->txt(
"cont_news_timeline_info"));
136 $cb->setChecked($this->
object->getNewsTimeline());
137 $form->addItem($cb);
138
139
140 $cb2 =
new ilCheckboxInputGUI($this->
lng->txt(
"cont_news_timeline_auto_entries"),
"news_timeline_auto_entries");
141 $cb2->setInfo($this->
lng->txt(
"cont_news_timeline_auto_entries_info"));
142 $cb2->setChecked($this->
object->getNewsTimelineAutoEntries());
143 $cb->addSubItem($cb2);
144
145
146 $cb2 =
new ilCheckboxInputGUI($this->
lng->txt(
"cont_news_timeline_landing_page"),
"news_timeline_landing_page");
147 $cb2->setInfo($this->
lng->txt(
"cont_news_timeline_landing_page_info"));
148 $cb2->setChecked($this->
object->getNewsTimelineLandingPage());
149 $cb->addSubItem($cb2);
150 }
151
152
155 $ref_id = array_pop($ref_ids);
157 }
158
159 $block_id = $this->
ctrl->getContextObjId();
160
163 "hide_news_per_date",
164 0,
165 $block_id
166 );
169 "hide_news_date",
170 0,
171 $block_id
172 );
175 "hide_news_mode",
176 0,
177 $block_id
178 ) ?? ((is_string($hide_news_date) && $hide_news_date !== "") ? "per_date" : "global");
181 "news_co_period",
182 0,
183 $block_id
184 ) ?? "";
185
186 if (is_string($hide_news_date) && $hide_news_date !== "") {
187 $hide_news_date = explode(" ", $hide_news_date);
188 }
189
190
191 if ($this->has_hide_by_date) {
193 $radio->setInfo(
194 $this->ui_renderer->render(
195 $this->ui_factory->messageBox()->info(
196 $this->period_info->getPeriodInfo()
197 )
198 )
199 );
200 $radio->setValue($hide_news_mode);
201
202 $opt_global =
new ilRadioOption($this->
lng->txt(
"news_hide_news_global"),
"global");
203 $radio->addOption($opt_global);
204
205 $opt_none =
new ilRadioOption($this->
lng->txt(
"news_hide_news_none"),
"none");
206 $radio->addOption($opt_none);
207
208 $opt_per_date =
new ilRadioOption($this->
lng->txt(
"news_hide_news_per_date"),
"per_date");
210 $dt_prop->setRequired(true);
211 if (isset($hide_news_date[0], $hide_news_date[1])) {
213 }
214 $dt_prop->setShowTime(true);
215 $opt_per_date->addSubItem($dt_prop);
216 $radio->addOption($opt_per_date);
217
218 $opt_by_period =
new ilRadioOption($this->
lng->txt(
"news_hide_news_by_period"),
"by_period");
220 $per_sel->setRequired(true);
221 $per_sel->setInfo($this->
lng->txt(
"news_co_period_info"));
222 $per_sel->setOptions([
223 7 => "1 {$this->lng->txt("week")}",
224 30 => "1 {$this->lng->txt("month")}",
225 366 => "1 {$this->lng->txt("year")}"
226 ]);
227 $per_sel->setValue($news_co_period);
228 $opt_by_period->addSubItem($per_sel);
229 $radio->addOption($opt_by_period);
230
231 $form->addItem($radio);
232 }
233
234
235 if ($this->has_public_notification) {
237
239 $this->
lng->txt(
"news_notifications_public"),
240 "public_notifications"
241 );
242 $ch->setInfo($this->
lng->txt(
"news_notifications_public_info"));
243 $ch->setChecked((bool) $public);
244 $form->addItem($ch);
245 }
246
247 $form->setTitle($this->
lng->txt(
"cont_news_settings"));
248 $form->setFormAction($this->
ctrl->getFormAction($this));
249 $form->addCommandButton(
"save", $this->
lng->txt(
"save"));
250
251 return $form;
252 }
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
@classDescription Date and time handling
static addToSettingsForm(int $a_ref_id, ?ilPropertyFormGUI $a_form=null, ?ilFormPropertyGUI $a_input=null)
Add notification settings to form.
static string $block_type
static addToSettingsForm(ilFormPropertyGUI $a_input, string $public_feed_info)
Add inputs to the container news settings form to configure also the contextBlock options.
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
This class represents an option in a radio group.