ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  {
69  $tmp = array();
70  $tmp['user_id'] = $row['user_id'];
71  $tmp['score'] = $row['score'];
72  $tmp['time'] = $row['time'];
73  $tmp['status'] = $row['status'];
74  $tmp['name'] = ilObjUser::_lookupFullname($row['user_id']);
75 
76  $data[] = $tmp;
77  }
78  $this->setData($data);
79  }
80 
81 
86  protected function fillRow($a_set)
87  {
88  global $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 $ilCtrl;
106 
107 
108  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
109  $this->setRowTemplate('tpl.scorm_track_item_sco.html', 'Modules/ScormAicc');
110  $this->setTitle($this->getSco()->getTitle());
111 
112  $this->addColumn($this->lng->txt('name'), 'name','35%');
113  $this->addColumn($this->lng->txt('cont_status'), 'status', '25%');
114  $this->addColumn($this->lng->txt('cont_time'), 'time', '20%');
115  $this->addColumn($this->lng->txt('cont_score'), 'score', '20%');
116  }
117 }
118 ?>