ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilForumDraftsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
11  protected $mayEdit = false;
12 
19  public function __construct($a_parent_obj, $a_parent_cmd, bool $mayEdit)
20  {
21  $this->mayEdit = $mayEdit;
22  $this->setId('frm_drafts_' . substr(md5($this->parent_cmd), 0, 3) . '_' . $a_parent_obj->object->getId());
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25  $this->initTableColumns();
26  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), 'showThreads'));
27  $this->setRowTemplate('tpl.forums_threads_drafts_table.html', 'Modules/Forum');
28  }
29 
30  public function initTableColumns()
31  {
32  $this->addColumn('', 'check', '1px', true);
33  $this->addColumn($this->lng->txt('drafts'), '');
34  $this->addColumn($this->lng->txt('edited_on'), '');
35 
36  $this->addMultiCommand('confirmDeleteThreadDrafts', $this->lng->txt('delete'));
37  $this->setSelectAllCheckbox('draft_ids');
38  }
39 
40  public function fillRow($draft)
41  {
42  $this->tpl->setVariable('VAL_CHECK', ilUtil::formCheckbox(
43  (isset($_POST['draft_ids']) && in_array($draft['draft_id'], $_POST['draft_ids']) ? true : false),
44  'draft_ids[]',
45  $draft['draft_id']
46  ));
47 
48  if ($this->mayEdit) {
49  $this->ctrl->setParameter($this->getParentObject(), 'draft_id', $draft['draft_id']);
50  $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'editThreadDraft');
51  $this->ctrl->setParameter($this->getParentObject(), 'draft_id', null);
52  $this->tpl->setVariable('VAL_EDIT_URL', $url);
53  $this->tpl->setVariable('VAL_LINKED_SUBJECT', $draft['subject']);
54  } else {
55  $this->tpl->setVariable('VAL_UNLINKED_SUBJECT', $draft['subject']);
56  }
57 
58  $date = ilDatePresentation::formatDate(new ilDateTime($draft['post_update'], IL_CAL_DATETIME));
59  $this->tpl->setVariable('VAL_DATE', $date);
60  }
61 }
const IL_CAL_DATETIME
Class ilForumDraftsTableGUI.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getParentObject()
Get parent object.
setId($a_val)
Set id.
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, bool $mayEdit)
ilForumDraftsTableGUI constructor.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
addMultiCommand($a_cmd, $a_text)
Add Command button.
Date and time handling
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
$url
$_POST["username"]
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public