ILIAS  release_7 Revision v7.30-3-g800a261c036
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}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
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
Class ilForumDraftsTableGUI.
fillRow($draft)
Standard Version of Fill Row.
__construct($a_parent_obj, $a_parent_cmd, bool $mayEdit)
ilForumDraftsTableGUI constructor.
Class ilTable2GUI.
getParentObject()
Get parent object.
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.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url