ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 */
3require_once 'Services/Table/classes/class.ilTable2GUI.php';
4require_once 'Services/Calendar/classes/class.ilDatePresentation.php';
5
11{
15 protected $ctrl;
16
20 protected $lng;
21
25 protected $parent_cmd;
26
33 public function __construct($a_parent_obj, $a_parent_cmd, $a_template_context)
34 {
38 global $ilCtrl, $lng;
39
40 $this->lng = $lng;
41 $this->ctrl = $ilCtrl;
42 $this->parent_cmd = $a_parent_cmd;
43
44 $this->setId('frm_drafts_' . substr(md5($this->parent_cmd), 0, 3).'_'.$a_parent_obj->object->getId() );
45
46 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
47 $this->initTableColumns();
48 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), 'showThreads'));
49 $this->setRowTemplate('tpl.forums_threads_drafts_table.html', 'Modules/Forum');
50 }
51
52 public function initTableColumns()
53 {
54 $this->addColumn('', 'check', '1px', true);
55 $this->addColumn($this->lng->txt('drafts'), '');
56 $this->addColumn($this->lng->txt('edited_on'), '');
57
58 $this->addMultiCommand('confirmDeleteThreadDrafts', $this->lng->txt('delete'));
59 $this->setSelectAllCheckbox('draft_ids');
60 }
61
62 public function fillRow($draft)
63 {
64 $this->tpl->setVariable('VAL_CHECK', ilUtil::formCheckbox(
65 (isset($_POST['draft_ids']) && in_array($draft['draft_id'], $_POST['draft_ids']) ? true : false), 'draft_ids[]', $draft['draft_id']
66 ));
67
68 $subject = '<div><a href="' . $this->ctrl->getLinkTarget($this->getParentObject(), 'editThreadDraft&draft_id='.$draft['draft_id']) . '">' . $draft['subject'] . '</a></div>';
69 $date = ilDatePresentation::formatDate(new ilDateTime($draft['post_update'], IL_CAL_DATETIME));
70 $this->tpl->setVariable('VAL_SUBJECT', $subject);
71 $this->tpl->setVariable('VAL_DATE', $date);
72 }
73}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Class ilForumDraftsTableGUI.
fillRow($draft)
Standard Version of Fill Row.
Class ilTable2GUI.
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.
getParentObject()
Get parent object.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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
global $ilCtrl
Definition: ilias.php:18