42 $this->tpl = $DIC[
"tpl"];
43 $this->
ctrl = $DIC->ctrl();
44 $this->
user = $DIC->user();
45 $this->
lng = $DIC->language();
49 $this->requested_blog_id = $this->request->getInt(
"blog_id");
50 $this->requested_blog = $this->request->getInt(
"blog");
51 $this->posting_manger = $DIC->blog()->internal()->domain()->posting();
60 $next_class = $this->
ctrl->getNextClass($this);
63 $cmd = $this->
ctrl->getCmd();
65 switch ($next_class) {
104 $form->setFormAction($ilCtrl->getFormAction($this));
106 $form->setTitle($this->
lng->txt(
"cont_insert_blog"));
108 $form->setTitle($this->
lng->txt(
"cont_update_blog"));
112 $blogs_ids = $this->posting_manger->searchBlogsByAuthor($ilUser->getId());
115 foreach ($blogs_ids as $blog_id) {
122 $obj->setOptions($options);
123 $form->addItem($obj);
126 $form->addCommandButton(
"create", $this->
lng->txt(
"select"));
127 $form->addCommandButton(
"cancelCreate", $this->
lng->txt(
"cancel"));
129 $obj->setValue($this->content_obj->getBlogId());
130 $form->addCommandButton(
"update", $this->
lng->txt(
"select"));
131 $form->addCommandButton(
"cancelUpdate", $this->
lng->txt(
"cancel"));
142 if ($this->requested_blog_id == 0) {
144 if ($form->checkInput()) {
149 $form->setValuesByPost();
153 if ($form->checkInput()) {
155 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
156 $this->content_obj->setData($form->getInput(
"blog_id"), $form->getInput(
"posting"));
157 $this->updated = $this->pg_obj->update();
158 if ($this->updated ===
true) {
159 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
163 $form->setValuesByPost();
173 if ($this->requested_blog_id == 0) {
175 if ($form->checkInput()) {
180 $this->pg_obj->addHierIDs();
181 $form->setValuesByPost();
185 if ($form->checkInput()) {
186 $this->content_obj->setData($form->getInput(
"blog_id"), $form->getInput(
"posting"));
187 $this->updated = $this->pg_obj->update();
188 if ($this->updated ===
true) {
189 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
193 $this->pg_obj->addHierIDs();
194 $form->setValuesByPost();
195 $this->
editPosting($this->requested_blog_id, $form);
239 bool $a_insert =
false 245 $form->setFormAction($ilCtrl->getFormAction($this));
247 $form->setTitle($this->
lng->txt(
"cont_insert_blog"));
249 $form->setTitle($this->
lng->txt(
"cont_update_blog"));
255 foreach ($postings as
$post) {
257 if ($post[
"author"] == $ilUser->getId()) {
259 $title = $post[
"title"] .
" - " .
263 $cbox->setValue($post[
"id"]);
272 $obj->setOptions($options);
273 $form->addItem($obj);
276 $blog_id->setValue($a_blog_id);
277 $form->addItem($blog_id);
280 $form->addCommandButton(
"create", $this->
lng->txt(
"save"));
281 $form->addCommandButton(
"cancelCreate", $this->
lng->txt(
"cancel"));
283 $obj->setValue($this->content_obj->getPostings());
284 $form->addCommandButton(
"update", $this->
lng->txt(
"save"));
285 $form->addCommandButton(
"cancelUpdate", $this->
lng->txt(
"cancel"));
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
setContent(string $a_html)
Sets content for standard template.
edit(?ilPropertyFormGUI $a_form=null)
insert(?ilPropertyFormGUI $a_form=null)
Content object of ilPageObject (see ILIAS DTD).
Class ilPCBlog Blog content object (see ILIAS DTD)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
initPostingForm(int $a_blog_id, bool $a_insert=false)
Init blog posting form.
executeCommand()
execute command
static _lookupTitle(int $obj_id)
Class ilPCBlogGUI Handles user commands on blog data.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
ilGlobalTemplateInterface $tpl
editPosting(int $a_blog_id, ?ilPropertyFormGUI $a_form=null)
Edit blog posting form.
insertPosting(int $a_blog_id, ?ilPropertyFormGUI $a_form=null)
Insert new blog posting form.
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
__construct(Container $dic, ilPlugin $plugin)
initForm(bool $a_insert=false)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
PostingManager $posting_manger