ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSCORMTrackingItemsScoTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
14  private $obj_id = 0;
15  private $user_id = 0;
16  private $sco = null;
17 
21  public function __construct($a_obj_id, $a_parent_obj, $a_parent_cmd)
22  {
23  $this->obj_id = $a_obj_id;
24 
25  $this->setId('sco_tr_sco_' . $this->obj_id);
26  parent::__construct($a_parent_obj, $a_parent_cmd);
27  }
28 
33  public function getObjId()
34  {
35  return $this->obj_id;
36  }
37 
42  public function setScoId($a_sco_id)
43  {
44  include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
45  $this->sco = new ilSCORMItem($a_sco_id);
46  }
47 
52  public function getSco()
53  {
54  return $this->sco;
55  }
56 
60  public function parse()
61  {
62  $this->initTable();
63 
64  $sco_data = $this->getParentObject()->object->getTrackingDataAggSco($this->getSco()->getId());
65 
66  $data = array();
67  foreach ($sco_data as $row) {
68  $tmp = array();
69  $tmp['user_id'] = $row['user_id'];
70  $tmp['score'] = $row['score'];
71  $tmp['time'] = $row['time'];
72  $tmp['status'] = $row['status'];
73  $tmp['name'] = ilObjUser::_lookupFullname($row['user_id']);
74 
75  $data[] = $tmp;
76  }
77  $this->setData($data);
78  }
79 
80 
85  protected function fillRow($a_set)
86  {
87  global $ilCtrl;
88 
89  $ilCtrl->setParameter($this->getParentObject(), 'user_id', $a_set['user_id']);
90  $ilCtrl->setParameter($this->getParentObject(), 'obj_id', $this->getSco()->getId());
91  $this->tpl->setVariable('LINK_USER', $ilCtrl->getLinkTarget($this->getParentObject(), 'showTrackingItemPerUser'));
92  $this->tpl->setVariable('VAL_USERNAME', $a_set['name']);
93 
94  $this->tpl->setVariable('VAL_STATUS', $a_set['status']);
95  $this->tpl->setVariable('VAL_TIME', $a_set['time']);
96  $this->tpl->setVariable('VAL_SCORE', $a_set['score']);
97  }
98 
102  protected function initTable()
103  {
104  global $ilCtrl;
105 
106 
107  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
108  $this->setRowTemplate('tpl.scorm_track_item_sco.html', 'Modules/ScormAicc');
109  $this->setTitle($this->getSco()->getTitle());
110 
111  $this->addColumn($this->lng->txt('name'), 'name', '35%');
112  $this->addColumn($this->lng->txt('cont_status'), 'status', '25%');
113  $this->addColumn($this->lng->txt('cont_time'), 'time', '20%');
114  $this->addColumn($this->lng->txt('cont_score'), 'score', '20%');
115  }
116 }
static _lookupFullname($a_user_id)
Lookup Full Name.
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
__construct($a_obj_id, $a_parent_obj, $a_parent_cmd)
Constructor.
Class ilTable2GUI.
SCORM Item.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
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.
getId()
Get element id.