ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilPCBlogGUI Class Reference

Class ilPCBlogGUI. More...

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

Public Member Functions

 __construct ($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor @access public. More...
 
 executeCommand ()
 execute command More...
 
 insert (ilPropertyFormGUI $a_form=null)
 Insert blog form. More...
 
 edit (ilPropertyFormGUI $a_form=null)
 Edit blog form. More...
 
 create ()
 Create new blog. More...
 
 update ()
 Update blog. More...
 
 insertPosting ($a_blog_id, ilPropertyFormGUI $a_form=null)
 Insert new blog posting form. More...
 
 editPosting ($a_blog_id, ilPropertyFormGUI $a_form=null)
 Edit blog posting form. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor @access public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 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 ()
 display validation errors More...
 
 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 ($a_type)
 Get table templates. More...
 

Protected Member Functions

 initForm ($a_insert=false)
 Init blog form. More...
 
 initPostingForm ($a_blog_id, $a_insert=false)
 Init blog posting form. More...
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 

Protected Attributes

 $user
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static $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 $common_bb_buttons
 

Detailed Description

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
Version
$I$

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

Constructor & Destructor Documentation

◆ __construct()

ilPCBlogGUI::__construct (   $a_pg_obj,
  $a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor @access public.

Reimplemented from ilPageContentGUI.

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

31 {
32 global $DIC;
33
34 $this->tpl = $DIC["tpl"];
35 $this->ctrl = $DIC->ctrl();
36 $this->user = $DIC->user();
37 $this->lng = $DIC->language();
38 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
39 }
user()
Definition: user.php:4
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCBlogGUI::create ( )

Create new blog.

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

145 {
146 if (!$_POST["blog_id"]) {
147 $form = $this->initForm(true);
148 if ($form->checkInput()) {
149 return $this->insertPosting($_POST["blog"]);
150 }
151
152 $form->setValuesByPost();
153 return $this->insert($form);
154 } else {
155 $form = $this->initPostingForm($_POST["blog_id"], true);
156 if ($form->checkInput()) {
157 $this->content_obj = new ilPCBlog($this->getPage());
158 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
159 $this->content_obj->setData($form->getInput("blog_id"), $form->getInput("posting"));
160 $this->updated = $this->pg_obj->update();
161 if ($this->updated === true) {
162 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
163 }
164 }
165
166 $form->setValuesByPost();
167 return $this->insertPosting($_POST["blog_id"], $form);
168 }
169 }
$_POST["username"]
insert(ilPropertyFormGUI $a_form=null)
Insert blog form.
insertPosting($a_blog_id, ilPropertyFormGUI $a_form=null)
Insert new blog posting form.
initForm($a_insert=false)
Init blog form.
initPostingForm($a_blog_id, $a_insert=false)
Init blog posting form.
Class ilPCBlog.

References $_POST, ilPageContentGUI\getPage(), initForm(), initPostingForm(), insert(), and insertPosting().

+ Here is the call graph for this function:

◆ edit()

ilPCBlogGUI::edit ( ilPropertyFormGUI  $a_form = null)

Edit blog form.

Parameters
ilPropertyFormGUI$a_form

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

84 {
86
88
89 if (!$a_form) {
90 $a_form = $this->initForm();
91 }
92 $tpl->setContent($a_form->getHTML());
93 }
displayValidationError()
display validation errors

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

Referenced by update().

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

◆ editPosting()

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

Edit blog posting form.

Parameters
int$a_blog_id
ilPropertyFormGUI$a_form

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

227 {
229
230 $this->displayValidationError();
231
232 if (!$a_form) {
233 $a_form = $this->initPostingForm($a_blog_id);
234 }
235 $tpl->setContent($a_form->getHTML());
236 }

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initPostingForm().

Referenced by update().

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

◆ executeCommand()

ilPCBlogGUI::executeCommand ( )

execute command

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

45 {
46 // get next class that processes or forwards current command
47 $next_class = $this->ctrl->getNextClass($this);
48
49 // get current command
50 $cmd = $this->ctrl->getCmd();
51
52 switch ($next_class) {
53 default:
54 $ret = $this->$cmd();
55 break;
56 }
57
58 return $ret;
59 }
$ret
Definition: parser.php:6

References $ret.

◆ initForm()

ilPCBlogGUI::initForm (   $a_insert = false)
protected

Init blog form.

Parameters
bool$a_insert
Returns
ilPropertyFormGUI

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

102 {
106
107 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
108 $form = new ilPropertyFormGUI();
109 $form->setFormAction($ilCtrl->getFormAction($this));
110 if ($a_insert) {
111 $form->setTitle($this->lng->txt("cont_insert_blog"));
112 } else {
113 $form->setTitle($this->lng->txt("cont_update_blog"));
114 }
115
116 $options = array();
117 $blogs_ids = ilBlogPosting::searchBlogsByAuthor($ilUser->getId());
118 if ($blogs_ids) {
119 foreach ($blogs_ids as $blog_id) {
120 $options[$blog_id] = ilObject::_lookupTitle($blog_id);
121 }
122 asort($options);
123 }
124 $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_blog"), "blog");
125 $obj->setRequired(true);
126 $obj->setOptions($options);
127 $form->addItem($obj);
128
129 if ($a_insert) {
130 $form->addCommandButton("create_blog", $this->lng->txt("select"));
131 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
132 } else {
133 $obj->setValue($this->content_obj->getBlogId());
134 $form->addCommandButton("update", $this->lng->txt("select"));
135 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
136 }
137
138 return $form;
139 }
static searchBlogsByAuthor($a_user_id)
Get all blogs where user has postings.
static _lookupTitle($a_id)
lookup object title
This class represents a property form user interface.
This class represents a selection list property in a property form.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

References ilPageContentGUI\$ctrl, $ilCtrl, $ilUser, ilPageContentGUI\$lng, $user, ilObject\_lookupTitle(), 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 (   $a_blog_id,
  $a_insert = false 
)
protected

Init blog posting form.

Parameters
int$a_blog_id
bool$a_insert
Returns
ilPropertyFormGUI

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

246 {
249
250 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
251 $form = new ilPropertyFormGUI();
252 $form->setFormAction($ilCtrl->getFormAction($this));
253 if ($a_insert) {
254 $form->setTitle($this->lng->txt("cont_insert_blog"));
255 } else {
256 $form->setTitle($this->lng->txt("cont_update_blog"));
257 }
258
259 $options = array();
260 $postings = ilBlogPosting::getAllPostings($a_blog_id);
261 if ($postings) {
262 foreach ($postings as $post) {
263 // could be posting from someone else
264 if ($post["author"] == $ilUser->getId()) {
265 $date = new ilDateTime($post["date"], IL_CAL_DATETIME);
266 $title = $post["title"] . " - " .
268
269 $cbox = new ilCheckboxInputGUI($title, "posting");
270 $cbox->setValue($post["id"]);
271
272 $options[] = $cbox;
273 }
274 }
275 }
276 asort($options);
277 $obj = new ilCheckboxGroupInputGUI($this->lng->txt("cont_pc_blog_posting"), "posting");
278 $obj->setRequired(true);
279 $obj->setOptions($options);
280 $form->addItem($obj);
281
282 $blog_id = new ilHiddenInputGUI("blog_id");
283 $blog_id->setValue($a_blog_id);
284 $form->addItem($blog_id);
285
286 if ($a_insert) {
287 $form->addCommandButton("create_blog", $this->lng->txt("save"));
288 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
289 } else {
290 $obj->setValue($this->content_obj->getPostings());
291 $form->addCommandButton("update", $this->lng->txt("save"));
292 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
293 }
294
295 return $form;
296 }
const IL_CAL_DATETIME
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
This class represents a property in a property form.
This class represents a checkbox property in a property form.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
This class represents a hidden form property in a property form.

References ilPageContentGUI\$ctrl, $ilCtrl, $ilUser, $user, ilDatePresentation\formatDate(), ilBlogPosting\getAllPostings(), and IL_CAL_DATETIME.

Referenced by create(), editPosting(), insertPosting(), and update().

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

◆ insert()

ilPCBlogGUI::insert ( ilPropertyFormGUI  $a_form = null)

Insert blog form.

Parameters
ilPropertyFormGUI$a_form

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

67 {
69
71
72 if (!$a_form) {
73 $a_form = $this->initForm(true);
74 }
75 $tpl->setContent($a_form->getHTML());
76 }

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

Referenced by create().

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

◆ insertPosting()

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

Insert new blog posting form.

Parameters
int$a_blog_id
ilPropertyFormGUI$a_form

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

209 {
211
212 $this->displayValidationError();
213
214 if (!$a_form) {
215 $a_form = $this->initPostingForm($a_blog_id, true);
216 }
217 $tpl->setContent($a_form->getHTML());
218 }

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initPostingForm().

Referenced by create().

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

◆ update()

ilPCBlogGUI::update ( )

Update blog.

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

175 {
176 if (!$_POST["blog_id"]) {
177 $form = $this->initForm();
178 if ($form->checkInput()) {
179 return $this->editPosting($_POST["blog"]);
180 }
181
182 $this->pg_obj->addHierIDs();
183 $form->setValuesByPost();
184 return $this->edit($form);
185 } else {
186 $form = $this->initPostingForm($_POST["blog_id"]);
187 if ($form->checkInput()) {
188 $this->content_obj->setData($form->getInput("blog_id"), $form->getInput("posting"));
189 $this->updated = $this->pg_obj->update();
190 if ($this->updated === true) {
191 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
192 }
193 }
194
195 $this->pg_obj->addHierIDs();
196 $form->setValuesByPost();
197 return $this->editPosting($_POST["blog_id"], $form);
198 }
199 }
edit(ilPropertyFormGUI $a_form=null)
Edit blog form.
editPosting($a_blog_id, ilPropertyFormGUI $a_form=null)
Edit blog posting form.

References $_POST, edit(), editPosting(), initForm(), and initPostingForm().

+ Here is the call graph for this function:

Field Documentation

◆ $user

ilPCBlogGUI::$user
protected

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

Referenced by initForm(), and initPostingForm().


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