ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPCBlogGUI Class Reference

Class ilPCBlogGUI. More...

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

Public Member Functions

 ilPCBlogGUI ($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
 ilPageContentGUI ($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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $ilias
 
 $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;"
 
- Protected Attributes inherited from ilPageContentGUI
 $log
 
- 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.

Member Function Documentation

◆ create()

ilPCBlogGUI::create ( )

Create new blog.

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

144 {
145 if(!$_POST["blog_id"])
146 {
147 $form = $this->initForm(true);
148 if($form->checkInput())
149 {
150 return $this->insertPosting($_POST["blog"]);
151 }
152
153 $form->setValuesByPost();
154 return $this->insert($form);
155 }
156 else
157 {
158 $form = $this->initPostingForm($_POST["blog_id"], true);
159 if($form->checkInput())
160 {
161 $this->content_obj = new ilPCBlog($this->getPage());
162 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
163 $this->content_obj->setData($form->getInput("blog_id"), $form->getInput("posting"));
164 $this->updated = $this->pg_obj->update();
165 if ($this->updated === true)
166 {
167 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
168 }
169 }
170
171 $form->setValuesByPost();
172 return $this->insertPosting($_POST["blog_id"], $form);
173 }
174 }
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.
$_POST['username']
Definition: cron.php:12

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 74 of file class.ilPCBlogGUI.php.

75 {
76 global $tpl;
77
79
80 if(!$a_form)
81 {
82 $a_form = $this->initForm();
83 }
84 $tpl->setContent($a_form->getHTML());
85 }
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 238 of file class.ilPCBlogGUI.php.

239 {
240 global $tpl;
241
242 $this->displayValidationError();
243
244 if(!$a_form)
245 {
246 $a_form = $this->initPostingForm($a_blog_id);
247 }
248 $tpl->setContent($a_form->getHTML());
249 }

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 33 of file class.ilPCBlogGUI.php.

34 {
35 // get next class that processes or forwards current command
36 $next_class = $this->ctrl->getNextClass($this);
37
38 // get current command
39 $cmd = $this->ctrl->getCmd();
40
41 switch($next_class)
42 {
43 default:
44 $ret =& $this->$cmd();
45 break;
46 }
47
48 return $ret;
49 }
$cmd
Definition: sahs_server.php:35

References $cmd, and $ret.

◆ ilPCBlogGUI()

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

Constructor @access public.

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

26 {
27 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
28 }

◆ initForm()

ilPCBlogGUI::initForm (   $a_insert = false)
protected

Init blog form.

Parameters
bool$a_insert
Returns
ilPropertyFormGUI

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

94 {
95 global $ilCtrl, $ilUser, $lng;
96
97 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
98 $form = new ilPropertyFormGUI();
99 $form->setFormAction($ilCtrl->getFormAction($this));
100 if ($a_insert)
101 {
102 $form->setTitle($this->lng->txt("cont_insert_blog"));
103 }
104 else
105 {
106 $form->setTitle($this->lng->txt("cont_update_blog"));
107 }
108
109 $options = array();
110 include_once "Modules/Blog/classes/class.ilBlogPosting.php";
111 $blogs_ids = ilBlogPosting::searchBlogsByAuthor($ilUser->getId());
112 if($blogs_ids)
113 {
114 foreach ($blogs_ids as $blog_id)
115 {
116 $options[$blog_id] = ilObject::_lookupTitle($blog_id);
117 }
118 asort($options);
119 }
120 $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_blog"), "blog");
121 $obj->setRequired(true);
122 $obj->setOptions($options);
123 $form->addItem($obj);
124
125 if ($a_insert)
126 {
127 $form->addCommandButton("create_blog", $this->lng->txt("select"));
128 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
129 }
130 else
131 {
132 $obj->setValue($this->content_obj->getBlogId());
133 $form->addCommandButton("update", $this->lng->txt("select"));
134 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
135 }
136
137 return $form;
138 }
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
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15

References $ilCtrl, $ilUser, ilPageContentGUI\$lng, $options, 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 258 of file class.ilPCBlogGUI.php.

259 {
260 global $ilCtrl, $ilUser;
261
262 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
263 $form = new ilPropertyFormGUI();
264 $form->setFormAction($ilCtrl->getFormAction($this));
265 if ($a_insert)
266 {
267 $form->setTitle($this->lng->txt("cont_insert_blog"));
268 }
269 else
270 {
271 $form->setTitle($this->lng->txt("cont_update_blog"));
272 }
273
274 $options = array();
275 include_once "Modules/Blog/classes/class.ilBlogPosting.php";
276 $postings = ilBlogPosting::getAllPostings($a_blog_id);
277 if($postings)
278 {
279 foreach($postings as $post)
280 {
281 // could be posting from someone else
282 if($post["author"] == $ilUser->getId())
283 {
284 $date = new ilDateTime($post["date"], IL_CAL_DATETIME);
285 $title = $post["title"]." - ".
287
288 $cbox = new ilCheckboxInputGUI($title, "posting");
289 $cbox->setValue($post["id"]);
290
291 $options[] = $cbox;
292 }
293 }
294 }
295 asort($options);
296 $obj = new ilCheckboxGroupInputGUI($this->lng->txt("cont_pc_blog_posting"), "posting");
297 $obj->setRequired(true);
298 $obj->setOptions($options);
299 $form->addItem($obj);
300
301 $blog_id = new ilHiddenInputGUI("blog_id");
302 $blog_id->setValue($a_blog_id);
303 $form->addItem($blog_id);
304
305 if ($a_insert)
306 {
307 $form->addCommandButton("create_blog", $this->lng->txt("save"));
308 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
309 }
310 else
311 {
312 $obj->setValue($this->content_obj->getPostings());
313 $form->addCommandButton("update", $this->lng->txt("save"));
314 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
315 }
316
317 return $form;
318 }
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)
Format a date @access public.
@classDescription Date and time handling
This class represents a hidden form property in a property form.

References $ilCtrl, $ilUser, $options, 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 56 of file class.ilPCBlogGUI.php.

57 {
58 global $tpl;
59
61
62 if(!$a_form)
63 {
64 $a_form = $this->initForm(true);
65 }
66 $tpl->setContent($a_form->getHTML());
67 }

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 219 of file class.ilPCBlogGUI.php.

220 {
221 global $tpl;
222
223 $this->displayValidationError();
224
225 if(!$a_form)
226 {
227 $a_form = $this->initPostingForm($a_blog_id, true);
228 }
229 $tpl->setContent($a_form->getHTML());
230 }

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 179 of file class.ilPCBlogGUI.php.

180 {
181 if(!$_POST["blog_id"])
182 {
183 $form = $this->initForm();
184 if($form->checkInput())
185 {
186 return $this->editPosting($_POST["blog"]);
187 }
188
189 $this->pg_obj->addHierIDs();
190 $form->setValuesByPost();
191 return $this->edit($form);
192 }
193 else
194 {
195 $form = $this->initPostingForm($_POST["blog_id"]);
196 if($form->checkInput())
197 {
198 $this->content_obj->setData($form->getInput("blog_id"), $form->getInput("posting"));
199 $this->updated = $this->pg_obj->update();
200 if ($this->updated === true)
201 {
202 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
203 }
204 }
205
206 $this->pg_obj->addHierIDs();
207 $form->setValuesByPost();
208 return $this->editPosting($_POST["blog_id"], $form);
209 }
210 }
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:

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