/** * Init blog form * * @param bool $a_insert * @return ilPropertyFormGUI */ protected function initForm($a_insert = false) { global $ilCtrl, $ilUser, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_blog")); } else { $form->setTitle($this->lng->txt("cont_update_blog")); } $options = array(); include_once "Modules/Blog/classes/class.ilBlogPosting.php"; $blogs_ids = ilBlogPosting::searchBlogsByAuthor($ilUser->getId()); if ($blogs_ids) { foreach ($blogs_ids as $blog_id) { $options[$blog_id] = ilObject::_lookupTitle($blog_id); } asort($options); } $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_blog"), "blog"); $obj->setRequired(true); $obj->setOptions($options); $form->addItem($obj); if ($a_insert) { $form->addCommandButton("create_blog", $this->lng->txt("select")); $form->addCommandButton("cancelCreate", $this->lng->txt("cancel")); } else { $obj->setValue($this->content_obj->getBlogId()); $form->addCommandButton("update", $this->lng->txt("select")); $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel")); } return $form; }