ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSCORMTrackingItemPerUserTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(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_usr_' . $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
48 public function setUserId(int $a_usr_id): void
49 {
50 $this->user_id = $a_usr_id;
51 }
52
53 public function getUserId(): int
54 {
55 return $this->user_id;
56 }
57
58 public function setScoId(int $a_sco_id): void
59 {
60 $this->sco = new ilSCORMItem($a_sco_id);
61 }
62
66 public function getSco(): ?ilSCORMItem
67 {
68 return $this->sco;
69 }
70
74 public function parse(): void
75 {
76 $this->initTable();
77
78 $sco_item = $this->getSco();
79 if ($sco_item !== null) {
80 $sco_data = $this->getParentObject()->object->getTrackingDataPerUser(
81 $sco_item->getId(),
82 $this->getUserId()
83 );
84 }
85
86 $data = array();
87 foreach ($sco_data as $row) {
88 $data[] = $row;
89 }
90 $this->setData($data);
91 }
92
96 protected function fillRow(array $a_set): void
97 {
98 global $DIC;
99 $ilCtrl = $DIC->ctrl();
100
101 $this->tpl->setVariable('VAR', $a_set['lvalue']);
102 $this->tpl->setVariable('VAL', $a_set['rvalue']);
103 }
104
105 protected function initTable(): void
106 {
107 global $DIC;
108 $ilCtrl = $DIC->ctrl();
109
110
111 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
112 $this->setRowTemplate('tpl.scorm_track_item_per_user.html', 'components/ILIAS/ScormAicc');
113 $sco = $this->getSco();
114 if ($sco !== null) {
115 $this->setTitle(
116 $sco->getTitle() . ' - ' .
117 ilObjUser::_lookupFullname($this->getUserId())
118 );
119 }
120
121 $this->addColumn($this->lng->txt('cont_lvalue'), 'lvalue', '50%');
122 $this->addColumn($this->lng->txt('cont_rvalue'), 'rvalue', '50%');
123 }
124}
static _lookupFullname(int $a_user_id)
__construct(int $a_obj_id, ?object $a_parent_obj, string $a_parent_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26