5 define(
"IL_FORM_EDIT", 0);
 
    6 define(
"IL_FORM_CREATE", 1);
 
    7 define(
"IL_FORM_RE_EDIT", 2);
 
    8 define(
"IL_FORM_RE_CREATE", 3);
 
   37                 include_once(
"Services/News/classes/class.ilNewsItem.php");
 
   38                 if (
$_GET[
"news_item_id"] > 0)
 
   43                 $this->ctrl->saveParameter($this, array(
"news_item_id"));
 
   66                 $next_class = $this->ctrl->getNextClass($this);
 
   67                 $cmd = $this->ctrl->getCmd();
 
   72                                 $html = $this->
$cmd();
 
   87                 $this->enable_edit = $a_enable_edit;
 
  107                 $this->context_obj_id = $a_context_obj_id;
 
  127                 $this->context_obj_type = $a_context_obj_type;
 
  147                 $this->context_sub_obj_id = $a_context_sub_obj_id;
 
  167                 $this->context_sub_obj_type = $a_context_sub_obj_type;
 
  187                 $this->form_edit_mode = $a_form_edit_mode;
 
  207                 return $this->form_gui->getHtml();
 
  219                 return $this->form_gui->getHtml();
 
  230                 if ($this->form_gui->checkInput())
 
  233                         $this->news_item->setTitle($this->form_gui->getInput(
"news_title"));
 
  234                         $this->news_item->setContent($this->form_gui->getInput(
"news_content"));
 
  235                         $this->news_item->setVisibility($this->form_gui->getInput(
"news_visibility"));
 
  236                         $this->news_item->setContentLong($this->form_gui->getInput(
"news_content_long"));
 
  238                         $this->news_item->create();
 
  243                         $this->form_gui->setValuesByPost();
 
  244                         return $this->form_gui->getHtml();
 
  256                 if ($this->form_gui->checkInput())
 
  259                         $this->news_item->setTitle($this->form_gui->getInput(
"news_title"));
 
  260                         $this->news_item->setContent($this->form_gui->getInput(
"news_content"));
 
  261                         $this->news_item->setVisibility($this->form_gui->getInput(
"news_visibility"));
 
  262                         $this->news_item->setContentLong($this->form_gui->getInput(
"news_content_long"));
 
  263                         $this->news_item->update();
 
  268                         $this->form_gui->setValuesByPost();
 
  269                         return $this->form_gui->getHtml();
 
  283                 $lng->loadLanguageModule(
"news");
 
  285                 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
 
  291                 $text_input = 
new ilTextInputGUI($lng->txt(
"news_news_item_title"), 
"news_title");
 
  293                 $text_input->setRequired(
true);
 
  294                 $text_input->setMaxLength(200);
 
  295                 $this->form_gui->addItem($text_input);
 
  298                 $text_area = 
new ilTextAreaInputGUI($lng->txt(
"news_news_item_content"), 
"news_content");
 
  300                 $text_area->setRequired(
false);
 
  301                 $this->form_gui->addItem($text_area);
 
  304                 $radio_group = 
new ilRadioGroupInputGUI($lng->txt(
"news_news_item_visibility"), 
"news_visibility");
 
  305                 $radio_option = 
new ilRadioOption($lng->txt(
"news_visibility_users"), 
"users");
 
  306                 $radio_group->addOption($radio_option);
 
  307                 $radio_option = 
new ilRadioOption($lng->txt(
"news_visibility_public"), 
"public");
 
  308                 $radio_group->addOption($radio_option);
 
  309                 $radio_group->
setInfo($lng->txt(
"news_news_item_visibility_info"));
 
  310                 $radio_group->setRequired(
false);
 
  311                 $radio_group->setValue(
"users");
 
  312                 $this->form_gui->addItem($radio_group);
 
  315                 $text_area = 
new ilTextAreaInputGUI($lng->txt(
"news_news_item_content_long"), 
"news_content_long");
 
  316                 $text_area->
setInfo($lng->txt(
"news_news_item_content_long_info"));
 
  317                 $text_area->setRequired(
false);
 
  318                 $text_area->setCols(
"40");
 
  319                 $text_area->setRows(
"8");
 
  320                 $text_area->setUseRte(
true);
 
  321                 $this->form_gui->addItem($text_area);
 
  327                         $this->form_gui->addCommandButton(
"saveNewsItem", $lng->txt(
"save"));
 
  328                         $this->form_gui->addCommandButton(
"cancelSaveNewsItem", $lng->txt(
"cancel"));
 
  332                         $this->form_gui->addCommandButton(
"updateNewsItem", $lng->txt(
"save"));
 
  333                         $this->form_gui->addCommandButton(
"cancelUpdateNewsItem", $lng->txt(
"cancel"));
 
  336                 $this->form_gui->setTitle($lng->txt(
"news_news_item_head"));
 
  337                 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
 
  351                 $values[
"news_title"] = $this->news_item->getTitle();
 
  352                 $values[
"news_content"] = $this->news_item->getContent();
 
  353                 $values[
"news_visibility"] = $this->news_item->getVisibility();
 
  354                 $values[
"news_content_long"] = $this->news_item->getContentLong();
 
  356                 $this->form_gui->setValuesByArray($values);
 
  368                 $ilCtrl->returnToParent($this);
 
  379                 $ilCtrl->returnToParent($this);
 
  390                 $ilCtrl->returnToParent($this);
 
  401                 $ilCtrl->returnToParent($this);
 
  432                 include_once(
"Services/News/classes/class.ilNewsForContextBlockGUI.php");
 
  438                 $data = $news_item->queryNewsForContext();
 
  440                 $block_gui->setTitle($lng->txt(
"news_block_news_for_context"));
 
  441                 $block_gui->setRowTemplate(
"tpl.block_row_news_for_context.html", 
"Services/News");
 
  442                 $block_gui->setData($data);
 
  444                 return $block_gui->getHTML();
 
  481                 include_once(
"Services/News/classes/class.ilNewsForContextTableGUI.php");
 
  486                 $data = $news_item->queryNewsForContext();
 
  488                 $table_gui->setTitle($lng->txt(
"news_table_news_for_context"));
 
  489                 $table_gui->setRowTemplate(
"tpl.table_row_news_for_context.html", 
"Services/News");
 
  490                 $table_gui->setData($data);
 
  493                 return $table_gui->getHTML();