ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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 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 public.

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

References $DIC, and user().

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  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCBlogGUI::create ( )

Create new blog.

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

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

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

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

Referenced by update().

84  {
85  $tpl = $this->tpl;
86 
87  $this->displayValidationError();
88 
89  if (!$a_form) {
90  $a_form = $this->initForm();
91  }
92  $tpl->setContent($a_form->getHTML());
93  }
initForm($a_insert=false)
Init blog form.
displayValidationError()
display validation errors
+ 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 227 of file class.ilPCBlogGUI.php.

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

Referenced by update().

228  {
229  $tpl = $this->tpl;
230 
231  $this->displayValidationError();
232 
233  if (!$a_form) {
234  $a_form = $this->initPostingForm($a_blog_id);
235  }
236  $tpl->setContent($a_form->getHTML());
237  }
initPostingForm($a_blog_id, $a_insert=false)
Init blog posting form.
displayValidationError()
display validation errors
+ 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.

References $ret.

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

◆ 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.

References ilPageContentGUI\$ctrl, $form, $ilCtrl, $ilUser, ilPageContentGUI\$lng, $options, $user, ilObject\_lookupTitle(), array, ilBlogPosting\searchBlogsByAuthor(), and ilFormPropertyGUI\setRequired().

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

102  {
105  $lng = $this->lng;
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  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
118  $blogs_ids = ilBlogPosting::searchBlogsByAuthor($ilUser->getId());
119  if ($blogs_ids) {
120  foreach ($blogs_ids as $blog_id) {
121  $options[$blog_id] = ilObject::_lookupTitle($blog_id);
122  }
123  asort($options);
124  }
125  $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_blog"), "blog");
126  $obj->setRequired(true);
127  $obj->setOptions($options);
128  $form->addItem($obj);
129 
130  if ($a_insert) {
131  $form->addCommandButton("create_blog", $this->lng->txt("select"));
132  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
133  } else {
134  $obj->setValue($this->content_obj->getBlogId());
135  $form->addCommandButton("update", $this->lng->txt("select"));
136  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
137  }
138 
139  return $form;
140  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
static searchBlogsByAuthor($a_user_id)
Get all blogs where user has postings.
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
setRequired($a_required)
Set Required.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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 246 of file class.ilPCBlogGUI.php.

References ilPageContentGUI\$ctrl, $form, $ilCtrl, $ilUser, $options, $post, $title, $user, array, ilDatePresentation\formatDate(), ilBlogPosting\getAllPostings(), IL_CAL_DATETIME, and ilFormPropertyGUI\setRequired().

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

247  {
250 
251  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
252  $form = new ilPropertyFormGUI();
253  $form->setFormAction($ilCtrl->getFormAction($this));
254  if ($a_insert) {
255  $form->setTitle($this->lng->txt("cont_insert_blog"));
256  } else {
257  $form->setTitle($this->lng->txt("cont_update_blog"));
258  }
259 
260  $options = array();
261  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
262  $postings = ilBlogPosting::getAllPostings($a_blog_id);
263  if ($postings) {
264  foreach ($postings as $post) {
265  // could be posting from someone else
266  if ($post["author"] == $ilUser->getId()) {
267  $date = new ilDateTime($post["date"], IL_CAL_DATETIME);
268  $title = $post["title"] . " - " .
270 
271  $cbox = new ilCheckboxInputGUI($title, "posting");
272  $cbox->setValue($post["id"]);
273 
274  $options[] = $cbox;
275  }
276  }
277  }
278  asort($options);
279  $obj = new ilCheckboxGroupInputGUI($this->lng->txt("cont_pc_blog_posting"), "posting");
280  $obj->setRequired(true);
281  $obj->setOptions($options);
282  $form->addItem($obj);
283 
284  $blog_id = new ilHiddenInputGUI("blog_id");
285  $blog_id->setValue($a_blog_id);
286  $form->addItem($blog_id);
287 
288  if ($a_insert) {
289  $form->addCommandButton("create_blog", $this->lng->txt("save"));
290  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
291  } else {
292  $obj->setValue($this->content_obj->getPostings());
293  $form->addCommandButton("update", $this->lng->txt("save"));
294  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
295  }
296 
297  return $form;
298  }
const IL_CAL_DATETIME
This class represents a property form user interface.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
This class represents a checkbox property in a property form.
global $ilCtrl
Definition: ilias.php:18
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
This class represents a hidden form property in a property form.
if(isset($_POST['submit'])) $form
$post
Definition: post.php:34
Date and time handling
$ilUser
Definition: imgupload.php:18
This class represents a property in a property form.
Create styles array
The data for the language used.
setRequired($a_required)
Set Required.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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.

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

Referenced by create().

67  {
68  $tpl = $this->tpl;
69 
70  $this->displayValidationError();
71 
72  if (!$a_form) {
73  $a_form = $this->initForm(true);
74  }
75  $tpl->setContent($a_form->getHTML());
76  }
initForm($a_insert=false)
Init blog form.
displayValidationError()
display validation errors
+ 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 209 of file class.ilPCBlogGUI.php.

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

Referenced by create().

210  {
211  $tpl = $this->tpl;
212 
213  $this->displayValidationError();
214 
215  if (!$a_form) {
216  $a_form = $this->initPostingForm($a_blog_id, true);
217  }
218  $tpl->setContent($a_form->getHTML());
219  }
initPostingForm($a_blog_id, $a_insert=false)
Init blog posting form.
displayValidationError()
display validation errors
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCBlogGUI::update ( )

Update blog.

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

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

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