ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC;
88  $ilCtrl = $DIC['ilCtrl'];
89 
90  $ilCtrl->setParameter($this->getParentObject(), 'user_id', $a_set['user_id']);
91  $ilCtrl->setParameter($this->getParentObject(), 'obj_id', $this->getSco()->getId());
92  $this->tpl->setVariable('LINK_USER', $ilCtrl->getLinkTarget($this->getParentObject(), 'showTrackingItemPerUser'));
93  $this->tpl->setVariable('VAL_USERNAME', $a_set['name']);
94 
95  $this->tpl->setVariable('VAL_STATUS', $a_set['status']);
96  $this->tpl->setVariable('VAL_TIME', $a_set['time']);
97  $this->tpl->setVariable('VAL_SCORE', $a_set['score']);
98  }
99 
103  protected function initTable()
104  {
105  global $DIC;
106  $ilCtrl = $DIC['ilCtrl'];
107 
108 
109  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
110  $this->setRowTemplate('tpl.scorm_track_item_sco.html', 'Modules/ScormAicc');
111  $this->setTitle($this->getSco()->getTitle());
112 
113  $this->addColumn($this->lng->txt('name'), 'name', '35%');
114  $this->addColumn($this->lng->txt('cont_status'), 'status', '25%');
115  $this->addColumn($this->lng->txt('cont_time'), 'time', '20%');
116  $this->addColumn($this->lng->txt('cont_score'), 'score', '20%');
117  }
118 }
global $DIC
Definition: saml.php:7
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.
$row
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.