ILIAS  release_8 Revision v8.24
ilPCBlogGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPCBlogGUI:
+ Collaboration diagram for ilPCBlogGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 execute command More...
 
 insert (ilPropertyFormGUI $a_form=null)
 
 edit (ilPropertyFormGUI $a_form=null)
 
 create ()
 Create new blog. More...
 
 update ()
 Update blog. More...
 
 insertPosting (int $a_blog_id, ilPropertyFormGUI $a_form=null)
 Insert new blog posting form. More...
 
 editPosting (int $a_blog_id, ilPropertyFormGUI $a_form=null)
 Edit blog posting form. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions (string $a_type="")
 Get table templates. More...
 

Protected Member Functions

 initForm (bool $a_insert=false)
 
 initPostingForm (int $a_blog_id, bool $a_insert=false)
 Init blog posting form. More...
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 

Protected Attributes

int $requested_blog
 
int $requested_blog_id
 
ilObjUser $user
 
- Protected Attributes inherited from ilPageContentGUI
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
php4DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilPCBlogGUI Handles user commands on blog data

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 25 of file class.ilPCBlogGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCBlogGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Reimplemented from ilPageContentGUI.

Definition at line 31 of file class.ilPCBlogGUI.php.

36 {
37 global $DIC;
38
39 $this->tpl = $DIC["tpl"];
40 $this->ctrl = $DIC->ctrl();
41 $this->user = $DIC->user();
42 $this->lng = $DIC->language();
43 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
44
45 // ... not sure why different ids are used for this...
46 $this->requested_blog_id = $this->request->getInt("blog_id");
47 $this->requested_blog = $this->request->getInt("blog");
48 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCBlogGUI::create ( )

Create new blog.

Definition at line 135 of file class.ilPCBlogGUI.php.

135 : void
136 {
137 if ($this->requested_blog_id == 0) {
138 $form = $this->initForm(true);
139 if ($form->checkInput()) {
140 $this->insertPosting($this->requested_blog);
141 return;
142 }
143
144 $form->setValuesByPost();
145 $this->insert($form);
146 } else {
147 $form = $this->initPostingForm($this->requested_blog_id, true);
148 if ($form->checkInput()) {
149 $this->content_obj = new ilPCBlog($this->getPage());
150 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
151 $this->content_obj->setData($form->getInput("blog_id"), $form->getInput("posting"));
152 $this->updated = $this->pg_obj->update();
153 if ($this->updated === true) {
154 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
155 }
156 }
157
158 $form->setValuesByPost();
159 $this->insertPosting($this->requested_blog_id, $form);
160 }
161 }
insert(ilPropertyFormGUI $a_form=null)
insertPosting(int $a_blog_id, ilPropertyFormGUI $a_form=null)
Insert new blog posting form.
initPostingForm(int $a_blog_id, bool $a_insert=false)
Init blog posting form.
initForm(bool $a_insert=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ilPageContentGUI\getPage(), initForm(), initPostingForm(), insert(), and insertPosting().

+ Here is the call graph for this function:

◆ edit()

ilPCBlogGUI::edit ( ilPropertyFormGUI  $a_form = null)

Definition at line 82 of file class.ilPCBlogGUI.php.

82 : void
83 {
85
87
88 if (!$a_form) {
89 $a_form = $this->initForm();
90 }
91 $tpl->setContent($a_form->getHTML());
92 }
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), initForm(), and ilGlobalTemplateInterface\setContent().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editPosting()

ilPCBlogGUI::editPosting ( int  $a_blog_id,
ilPropertyFormGUI  $a_form = null 
)

Edit blog posting form.

Definition at line 215 of file class.ilPCBlogGUI.php.

218 : void {
220
221 $this->displayValidationError();
222
223 if (!$a_form) {
224 $a_form = $this->initPostingForm($a_blog_id);
225 }
226 $tpl->setContent($a_form->getHTML());
227 }

Referenced by update().

+ Here is the caller graph for this function:

◆ executeCommand()

ilPCBlogGUI::executeCommand ( )

execute command

Definition at line 53 of file class.ilPCBlogGUI.php.

53 : string
54 {
55 // get next class that processes or forwards current command
56 $next_class = $this->ctrl->getNextClass($this);
57
58 // get current command
59 $cmd = $this->ctrl->getCmd();
60
61 switch ($next_class) {
62 default:
63 $ret = $this->$cmd();
64 break;
65 }
66
67 return (string) $ret;
68 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ initForm()

ilPCBlogGUI::initForm ( bool  $a_insert = false)
protected

Definition at line 94 of file class.ilPCBlogGUI.php.

95 {
96 $ilCtrl = $this->ctrl;
98
99 $form = new ilPropertyFormGUI();
100 $form->setFormAction($ilCtrl->getFormAction($this));
101 if ($a_insert) {
102 $form->setTitle($this->lng->txt("cont_insert_blog"));
103 } else {
104 $form->setTitle($this->lng->txt("cont_update_blog"));
105 }
106
107 $options = array();
108 $blogs_ids = ilBlogPosting::searchBlogsByAuthor($ilUser->getId());
109 if ($blogs_ids) {
110 foreach ($blogs_ids as $blog_id) {
111 $options[$blog_id] = ilObject::_lookupTitle($blog_id);
112 }
113 asort($options);
114 }
115 $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_blog"), "blog");
116 $obj->setRequired(true);
117 $obj->setOptions($options);
118 $form->addItem($obj);
119
120 if ($a_insert) {
121 $form->addCommandButton("create_blog", $this->lng->txt("select"));
122 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
123 } else {
124 $obj->setValue($this->content_obj->getBlogId());
125 $form->addCommandButton("update", $this->lng->txt("select"));
126 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
127 }
128
129 return $form;
130 }
static searchBlogsByAuthor(int $a_user_id)
Get all blogs where user has postings.
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
This class represents a selection list property in a property form.
$ilUser
Definition: imgupload.php:34

References ilPageContentGUI\$ctrl, $ilUser, $user, ilObject\_lookupTitle(), ILIAS\Repository\lng(), and ilBlogPosting\searchBlogsByAuthor().

Referenced by create(), edit(), insert(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPostingForm()

ilPCBlogGUI::initPostingForm ( int  $a_blog_id,
bool  $a_insert = false 
)
protected

Init blog posting form.

Definition at line 232 of file class.ilPCBlogGUI.php.

236 $ilCtrl = $this->ctrl;
238
239 $form = new ilPropertyFormGUI();
240 $form->setFormAction($ilCtrl->getFormAction($this));
241 if ($a_insert) {
242 $form->setTitle($this->lng->txt("cont_insert_blog"));
243 } else {
244 $form->setTitle($this->lng->txt("cont_update_blog"));
245 }
246
247 $options = array();
248 $postings = ilBlogPosting::getAllPostings($a_blog_id);
249 if ($postings) {
250 foreach ($postings as $post) {
251 // could be posting from someone else
252 if ($post["author"] == $ilUser->getId()) {
253 $date = new ilDateTime($post["date"], IL_CAL_DATETIME);
254 $title = $post["title"] . " - " .
256
257 $cbox = new ilCheckboxInputGUI($title, "posting");
258 $cbox->setValue($post["id"]);
259
260 $options[] = $cbox;
261 }
262 }
263 }
264 asort($options);
265 $obj = new ilCheckboxGroupInputGUI($this->lng->txt("cont_pc_blog_posting"), "posting");
266 $obj->setRequired(true);
267 $obj->setOptions($options);
268 $form->addItem($obj);
269
270 $blog_id = new ilHiddenInputGUI("blog_id");
271 $blog_id->setValue($a_blog_id);
272 $form->addItem($blog_id);
273
274 if ($a_insert) {
275 $form->addCommandButton("create_blog", $this->lng->txt("save"));
276 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
277 } else {
278 $obj->setValue($this->content_obj->getPostings());
279 $form->addCommandButton("update", $this->lng->txt("save"));
280 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
281 }
282
283 return $form;
284 }
const IL_CAL_DATETIME
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$post
Definition: ltitoken.php:49

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ insert()

ilPCBlogGUI::insert ( ilPropertyFormGUI  $a_form = null)

Definition at line 70 of file class.ilPCBlogGUI.php.

70 : void
71 {
73
75
76 if (!$a_form) {
77 $a_form = $this->initForm(true);
78 }
79 $tpl->setContent($a_form->getHTML());
80 }

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), initForm(), and ilGlobalTemplateInterface\setContent().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPosting()

ilPCBlogGUI::insertPosting ( int  $a_blog_id,
ilPropertyFormGUI  $a_form = null 
)

Insert new blog posting form.

Definition at line 198 of file class.ilPCBlogGUI.php.

201 : void {
203
204 $this->displayValidationError();
205
206 if (!$a_form) {
207 $a_form = $this->initPostingForm($a_blog_id, true);
208 }
209 $tpl->setContent($a_form->getHTML());
210 }

Referenced by create().

+ Here is the caller graph for this function:

◆ update()

ilPCBlogGUI::update ( )

Update blog.

Definition at line 166 of file class.ilPCBlogGUI.php.

166 : void
167 {
168 if ($this->requested_blog_id == 0) {
169 $form = $this->initForm();
170 if ($form->checkInput()) {
171 $this->editPosting($this->requested_blog);
172 return;
173 }
174
175 $this->pg_obj->addHierIDs();
176 $form->setValuesByPost();
177 $this->edit($form);
178 } else {
179 $form = $this->initPostingForm($this->requested_blog_id);
180 if ($form->checkInput()) {
181 $this->content_obj->setData($form->getInput("blog_id"), $form->getInput("posting"));
182 $this->updated = $this->pg_obj->update();
183 if ($this->updated === true) {
184 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
185 }
186 }
187
188 $this->pg_obj->addHierIDs();
189 $form->setValuesByPost();
190 $this->editPosting($this->requested_blog_id, $form);
191 }
192 }
edit(ilPropertyFormGUI $a_form=null)
editPosting(int $a_blog_id, ilPropertyFormGUI $a_form=null)
Edit blog posting form.

References ILIAS\Repository\ctrl(), edit(), editPosting(), initForm(), and initPostingForm().

+ Here is the call graph for this function:

Field Documentation

◆ $requested_blog

int ilPCBlogGUI::$requested_blog
protected

Definition at line 27 of file class.ilPCBlogGUI.php.

◆ $requested_blog_id

int ilPCBlogGUI::$requested_blog_id
protected

Definition at line 28 of file class.ilPCBlogGUI.php.

◆ $user

ilObjUser ilPCBlogGUI::$user
protected

Definition at line 29 of file class.ilPCBlogGUI.php.

Referenced by initForm().


The documentation for this class was generated from the following file: