ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilSCORMTrackingItemsScoTableGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
27 {
28  private int $obj_id;
29  private int $user_id = 0;
30  private ?ilSCORMItem $sco = null;
31 
32  public function __construct(int $a_obj_id, ?object $a_parent_obj, string $a_parent_cmd)
33  {
34  $this->obj_id = $a_obj_id;
35 
36  $this->setId('sco_tr_sco_' . $this->obj_id);
37  parent::__construct($a_parent_obj, $a_parent_cmd);
38  }
39 
40  public function getObjId(): int
41  {
42  return $this->obj_id;
43  }
44 
45  public function setScoId(int $a_sco_id): void
46  {
47  $this->sco = new ilSCORMItem($a_sco_id);
48  }
49 
50  public function getSco(): ?ilSCORMItem
51  {
52  return $this->sco;
53  }
54 
58  public function parse(): void
59  {
60  $this->initTable();
61 
62  $sco = $this->getSco();
63  if ($sco !== null) {
64  $sco_data = $this->getParentObject()->object->getTrackingDataAggSco($sco->getId());
65  $data = array();
66  foreach ($sco_data as $row) {
67  $tmp = array();
68  $tmp['user_id'] = $row['user_id'];
69  $tmp['score'] = $row['score'];
70  $tmp['time'] = $row['time'];
71  $tmp['status'] = $row['status'];
72  $tmp['name'] = ilObjUser::_lookupFullname($row['user_id']);
73 
74  $data[] = $tmp;
75  }
76  $this->setData($data);
77  }
78  }
79 
80 
84  protected function fillRow(array $a_set): void
85  {
86  global $DIC;
87  $ilCtrl = $DIC->ctrl();
88 
89  $ilCtrl->setParameter($this->getParentObject(), 'user_id', $a_set['user_id']);
90  $sco = $this->getSco();
91  if ($sco !== null) {
92  $ilCtrl->setParameter($this->getParentObject(), 'obj_id', $sco->getId());
93  }
94  $this->tpl->setVariable('LINK_USER', $ilCtrl->getLinkTarget($this->getParentObject(), 'showTrackingItemPerUser'));
95  $this->tpl->setVariable('VAL_USERNAME', $a_set['name']);
96 
97  $this->tpl->setVariable('VAL_STATUS', $a_set['status']);
98  $this->tpl->setVariable('VAL_TIME', $a_set['time']);
99  $this->tpl->setVariable('VAL_SCORE', $a_set['score']);
100  }
101 
102  protected function initTable(): void
103  {
104  global $DIC;
105  $ilCtrl = $DIC->ctrl();
106 
107 
108  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
109  $this->setRowTemplate('tpl.scorm_track_item_sco.html', 'components/ILIAS/ScormAicc');
110  $sco = $this->getSco();
111  if ($sco !== null) {
112  $this->setTitle($sco->getTitle());
113  }
114 
115  $this->addColumn($this->lng->txt('name'), 'name', '35%');
116  $this->addColumn($this->lng->txt('cont_status'), 'status', '25%');
117  $this->addColumn($this->lng->txt('cont_time'), 'time', '20%');
118  $this->addColumn($this->lng->txt('cont_score'), 'score', '20%');
119  }
120 }
setData(array $a_data)
setFormAction(string $a_form_action, bool $a_multipart=false)
static _lookupFullname(int $a_user_id)
__construct(int $a_obj_id, ?object $a_parent_obj, string $a_parent_cmd)
setId(string $a_val)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:22
SCORM Item.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)