ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSCORMTrackingUsersTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Table/classes/class.ilTable2GUI.php';
5
13{
14 private $obj_id = 0;
15
19 public function __construct($a_obj_id,$a_parent_obj,$a_parent_cmd)
20 {
21 $this->obj_id = $a_obj_id;
22
23 $this->setId('sco_tr_usrs_'.$this->obj_id);
24 parent::__construct($a_parent_obj, $a_parent_cmd);
25 $this->initFilter();
26 }
27
32 public function getObjId()
33 {
34 return $this->obj_id;
35 }
36
40 public function parse()
41 {
42 $this->initTable();
43
44 // @TODO add filter
45 $users = $this->getParentObject()->object->getTrackedUsers($this->filter['lastname']);
46 $attempts = $this->getParentObject()->object->getAttemptsForUsers();
47 $versions = $this->getParentObject()->object->getModuleVersionForUsers();
48
49 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
51 $allowExportPrivacy = $privacy->enabledExportSCORM();
52
53 $data = array();
54 foreach($users as $user)
55 {
56 $tmp = array();
57 $tmp['user'] = $user['user_id'];
58 if ($allowExportPrivacy == true) {
59 $tmp['name'] = $user['lastname'].', '.$user['firstname'];
60 } else {
61 $tmp['name'] = $user['user_id'];
62 }
63 $dt = new ilDateTime($user['last_access'],IL_CAL_DATETIME);
64 $tmp['last_access'] = $dt->get(IL_CAL_UNIX);
65 $tmp['attempts'] = (int) $attempts[$user['user_id']];
66 $tmp['version'] = (int) $versions[$user['user_id']];
67
68 $data[] = $tmp;
69 }
70 $this->setData($data);
71 }
72
73 public function initFilter()
74 {
75 $item = $this->addFilterItemByMetaType("lastname", ilTable2GUI::FILTER_TEXT);
76 $this->filter["lastname"] = $item->getValue();
77 }
78
83 protected function fillRow($a_set)
84 {
85 global $ilCtrl;
86
87 $this->tpl->setVariable('CHECKBOX_ID', $a_set['user']);
88 $this->tpl->setVariable('VAL_USERNAME', $a_set['name']);
89
90 // $ilCtrl->setParameter($this->getParentObject(),'user_id',$a_set['user']);
91 // $this->tpl->setVariable('LINK_ITEM', $ilCtrl->getLinkTarget($this->getParentObject(),'showTrackingItem'));
92
93 $this->tpl->setVariable('VAL_LAST', ilDatePresentation::formatDate(new ilDateTime($a_set['last_access'],IL_CAL_UNIX)));
94 $this->tpl->setVariable('VAL_ATTEMPT', (int) $a_set['attempts']);
95 $this->tpl->setVariable('VAL_VERSION', (string) $a_set['version']);
96
97 }
98
102 protected function initTable()
103 {
104 global $ilCtrl;
105
106 $this->setFilterCommand('applyUserTableFilter');
107 $this->setResetCommand('resetUserTableFilter');
108
109 $this->setDisableFilterHiding(false);
110
111 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
112 $this->setRowTemplate('tpl.scorm_track_items.html', 'Modules/ScormAicc');
113 $this->setTitle($this->lng->txt('cont_tracking_items'));
114
115 $this->addColumn('','','1px');
116 $this->addColumn($this->lng->txt('user'), 'lastname','35%');
117 $this->addColumn($this->lng->txt('last_access'), 'last_access', '25%');
118 $this->addColumn($this->lng->txt('attempts'), 'attempts', '20%');
119 $this->addColumn($this->lng->txt('version'), 'version','20%');
120
121 $this->enable('select_all');
122 $this->setSelectAllCheckbox('user');
123
124 $this->addMultiCommand('deleteTrackingForUser', $this->lng->txt('delete'));
125 $this->addMultiCommand('decreaseAttempts', $this->lng->txt('decrease_attempts'));
126 $this->addMultiCommand('exportSelectionUsers', $this->lng->txt('export'));
127 }
128}
129?>
const IL_CAL_UNIX
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static _getInstance()
Get instance of ilPrivacySettings.
__construct($a_obj_id, $a_parent_obj, $a_parent_cmd)
Constructor.
Class ilTable2GUI.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
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.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard type.
setFilterCommand($a_val, $a_caption=null)
Set filter command.
enable($a_module_name)
enables particular modules of table
global $ilCtrl
Definition: ilias.php:18