24 define(
"IL_FORM_EDIT", 0);
25 define(
"IL_FORM_CREATE", 1);
26 define(
"IL_FORM_RE_EDIT", 2);
27 define(
"IL_FORM_RE_CREATE", 3);
56 include_once(
"Services/News/classes/class.ilNewsItemGen.php");
57 if (
$_GET[
"news_item_id"] > 0)
62 $this->ctrl->saveParameter($this, array(
"news_item_id"));
85 $next_class = $this->ctrl->getNextClass($this);
86 $cmd = $this->ctrl->getCmd();
91 $html = $this->
$cmd();
106 $this->enable_edit = $a_enable_edit;
126 $this->context_obj_id = $a_context_obj_id;
146 $this->context_obj_type = $a_context_obj_type;
166 $this->context_sub_obj_id = $a_context_sub_obj_id;
186 $this->context_sub_obj_type = $a_context_sub_obj_type;
206 $this->form_edit_mode = $a_form_edit_mode;
226 return $this->form_gui->getHtml();
238 return $this->form_gui->getHtml();
249 if ($this->form_gui->checkInput())
252 $this->news_item->setTitle($this->form_gui->getInput(
"news_title"));
253 $this->news_item->setContent($this->form_gui->getInput(
"news_content"));
254 $this->news_item->setVisibility($this->form_gui->getInput(
"news_visibility"));
255 $this->news_item->setContentLong($this->form_gui->getInput(
"news_content_long"));
257 $this->news_item->create();
262 $this->form_gui->setValuesByPost();
263 return $this->form_gui->getHtml();
275 if ($this->form_gui->checkInput())
278 $this->news_item->setTitle($this->form_gui->getInput(
"news_title"));
279 $this->news_item->setContent($this->form_gui->getInput(
"news_content"));
280 $this->news_item->setVisibility($this->form_gui->getInput(
"news_visibility"));
281 $this->news_item->setContentLong($this->form_gui->getInput(
"news_content_long"));
282 $this->news_item->update();
287 $this->form_gui->setValuesByPost();
288 return $this->form_gui->getHtml();
302 $lng->loadLanguageModule(
"news");
304 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
310 $text_input =
new ilTextInputGUI($lng->txt(
"news_news_item_title"),
"news_title");
312 $text_input->setRequired(
true);
313 $text_input->setMaxLength(200);
314 $this->form_gui->addItem($text_input);
317 $text_area =
new ilTextAreaInputGUI($lng->txt(
"news_news_item_content"),
"news_content");
319 $text_area->setRequired(
false);
320 $this->form_gui->addItem($text_area);
323 $radio_group =
new ilRadioGroupInputGUI($lng->txt(
"news_news_item_visibility"),
"news_visibility");
324 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_users"),
"users");
325 $radio_group->addOption($radio_option);
326 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_public"),
"public");
327 $radio_group->addOption($radio_option);
328 $radio_group->
setInfo($lng->txt(
"news_news_item_visibility_info"));
329 $radio_group->setRequired(
false);
330 $radio_group->setValue(
"users");
331 $this->form_gui->addItem($radio_group);
334 $text_area =
new ilTextAreaInputGUI($lng->txt(
"news_news_item_content_long"),
"news_content_long");
335 $text_area->
setInfo($lng->txt(
"news_news_item_content_long_info"));
336 $text_area->setRequired(
false);
337 $text_area->setCols(
"40");
338 $text_area->setRows(
"8");
339 $text_area->setUseRte(
true);
340 $this->form_gui->addItem($text_area);
346 $this->form_gui->addCommandButton(
"saveNewsItem", $lng->txt(
"save"));
347 $this->form_gui->addCommandButton(
"cancelSaveNewsItem", $lng->txt(
"cancel"));
351 $this->form_gui->addCommandButton(
"updateNewsItem", $lng->txt(
"save"));
352 $this->form_gui->addCommandButton(
"cancelUpdateNewsItem", $lng->txt(
"cancel"));
355 $this->form_gui->setTitle($lng->txt(
"news_news_item_head"));
356 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
370 $values[
"news_title"] = $this->news_item->getTitle();
371 $values[
"news_content"] = $this->news_item->getContent();
372 $values[
"news_visibility"] = $this->news_item->getVisibility();
373 $values[
"news_content_long"] = $this->news_item->getContentLong();
375 $this->form_gui->setValuesByArray($values);
387 $ilCtrl->returnToParent($this);
398 $ilCtrl->returnToParent($this);
409 $ilCtrl->returnToParent($this);
420 $ilCtrl->returnToParent($this);
451 include_once(
"Services/News/classes/class.ilNewsForContextBlockGUI.php");
457 $data = $news_item->queryNewsForContext();
459 $block_gui->setTitle($lng->txt(
"news_block_news_for_context"));
460 $block_gui->setRowTemplate(
"tpl.block_row_news_for_context.html",
"Services/News");
461 $block_gui->setData(
$data);
463 return $block_gui->getHTML();
500 include_once(
"Services/News/classes/class.ilNewsForContextTableGUI.php");
505 $data = $news_item->queryNewsForContext();
507 $table_gui->setTitle($lng->txt(
"news_table_news_for_context"));
508 $table_gui->setRowTemplate(
"tpl.table_row_news_for_context.html",
"Services/News");
509 $table_gui->setData(
$data);
512 return $table_gui->getHTML();