ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilUserClipboardTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once './Services/User/classes/class.ilObjUser.php';
6 include_once './Services/User/classes/class.ilUserClipboard.php';
7 include_once './Services/Table/classes/class.ilTable2GUI.php';
8 
16 {
20  private $clipboard;
21 
28  public function __construct($a_parent_obj, $a_parent_cmd, $a_id)
29  {
30  $this->setId('obj_table_' . $a_id);
31  parent::__construct($a_parent_obj, $a_parent_cmd, '');
32 
33  $this->clipboard = ilUserClipboard::getInstance($a_id);
34  $this->lng->loadLanguageModule('user');
35  }
36 
40  public function init()
41  {
42  $this->setTitle($this->lng->txt('clipboard_table_title'));
43 
44  $this->addColumn('', 'id', '5px');
45  $this->addColumn($this->lng->txt('name'), 'name', '70%');
46  $this->addColumn($this->lng->txt('login'), 'login', '30%');
47 
48  $this->setOrderColumn('name');
49  $this->setRowTemplate('tpl.usr_clipboard_table_row.html', 'Services/User');
50 
51  $this->setSelectAllCheckbox('uids');
52 
53  $this->addMultiCommand(
54  'addFromClipboard',
55  $this->lng->txt('add')
56  );
57 
58  $this->addMultiCommand(
59  'removeFromClipboard',
60  $this->lng->txt('clipboard_remove_btn')
61  );
62 
63  $this->addCommandButton('emptyClipboard', $this->lng->txt('clipboard_empty_btn'));
64  $this->addCommandButton('cancel', $this->lng->txt('cancel'));
65  }
66 
71  public function fillRow($a_set)
72  {
73  $this->tpl->setVariable('VAL_POSTNAME', 'uids');
74  $this->tpl->setVariable('VAL_ID', $a_set['usr_id']);
75  $this->tpl->setVariable('VAL_NAME', $a_set['name']);
76  $this->tpl->setVariable('VAL_LOGIN', $a_set['login']);
77  }
78 
82  public function parse()
83  {
84  $content = array();
85  foreach ($this->clipboard->getValidatedContent() as $user_id) {
86  $row['usr_id'] = $user_id;
87  $name_arr = ilObjUser::_lookupName($user_id);
88 
89  $row['name'] = ($name_arr['lastname'] . ', ' . $name_arr['firstname']);
90  $row['login'] = ilObjUser::_lookupLogin($user_id);
91 
92  $content[] = $row;
93  }
94  $this->setMaxCount(count($this->clipboard->getValidatedContent()));
95  $this->setData($content);
96  }
97 }
static _lookupLogin($a_user_id)
lookup login
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static _lookupName($a_user_id)
lookup user name
static getInstance($a_usr_id)
Get singelton instance.
setId($a_val)
Set id.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Show administrate clipboard content.
Class ilTable2GUI.
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.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
parse()
Parse clipboard content.
$row
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.
__construct($a_parent_obj, $a_parent_cmd, $a_id)
Constructor.
setMaxCount($a_max_count)
set max.
setOrderColumn($a_order_column=0, $a_default_column=0)
set order column public