ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 require_once 'Services/Table/classes/class.ilTable2GUI.php';
4 require_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  {
35  global $DIC;
36 
37  $this->lng = $DIC->language();
38  $this->ctrl = $DIC->ctrl();
39  $this->parent_cmd = $a_parent_cmd;
40 
41  $this->setId('frm_drafts_' . substr(md5($this->parent_cmd), 0, 3) . '_' . $a_parent_obj->object->getId());
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
44  $this->initTableColumns();
45  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), 'showThreads'));
46  $this->setRowTemplate('tpl.forums_threads_drafts_table.html', 'Modules/Forum');
47  }
48 
49  public function initTableColumns()
50  {
51  $this->addColumn('', 'check', '1px', true);
52  $this->addColumn($this->lng->txt('drafts'), '');
53  $this->addColumn($this->lng->txt('edited_on'), '');
54 
55  $this->addMultiCommand('confirmDeleteThreadDrafts', $this->lng->txt('delete'));
56  $this->setSelectAllCheckbox('draft_ids');
57  }
58 
59  public function fillRow($draft)
60  {
61  $this->tpl->setVariable('VAL_CHECK', ilUtil::formCheckbox(
62  (isset($_POST['draft_ids']) && in_array($draft['draft_id'], $_POST['draft_ids']) ? true : false),
63  'draft_ids[]',
64  $draft['draft_id']
65  ));
66 
67  $subject = '<div><a href="' . $this->ctrl->getLinkTarget($this->getParentObject(), 'editThreadDraft&draft_id=' . $draft['draft_id']) . '">' . $draft['subject'] . '</a></div>';
68  $date = ilDatePresentation::formatDate(new ilDateTime($draft['post_update'], IL_CAL_DATETIME));
69  $this->tpl->setVariable('VAL_SUBJECT', $subject);
70  $this->tpl->setVariable('VAL_DATE', $date);
71  }
72 }
const IL_CAL_DATETIME
global $DIC
Definition: saml.php:7
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
Class ilForumDraftsTableGUI.
getParentObject()
Get parent object.
setId($a_val)
Set id.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
Date and time handling
setRowTemplate($a_template, $a_template_dir="")
Set row template.
__construct($a_parent_obj, $a_parent_cmd, $a_template_context)
ilForumDraftsTableGUI constructor.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
$_POST["username"]
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public