ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
87  $row['usr_id'] = $user_id;
88  $name_arr = ilObjUser::_lookupName($user_id);
89 
90  $row['name'] = ($name_arr['lastname'].', '. $name_arr['firstname']);
91  $row['login'] = ilObjUser::_lookupLogin($user_id);
92 
93  $content[] = $row;
94  }
95  $this->setMaxCount(count($this->clipboard->getValidatedContent()));
96  $this->setData($content);
97  }
98 }
99 ?>
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.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
parse()
Parse clipboard content.
__construct($a_parent_obj, $a_parent_cmd, $a_id)
Constructor.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setMaxCount($a_max_count)
set max.
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.
setOrderColumn($a_order_column=0, $a_default_column=0)
set order column public