ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSCORMTrackingItemPerUserTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 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_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', 'Modules/ScormAicc');
113  $sco = $this->getSco();
114  if ($sco !== null) {
115  $this->setTitle(
116  $sco->getTitle() . ' - ' .
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 }
setData(array $a_data)
setFormAction(string $a_form_action, bool $a_multipart=false)
static _lookupFullname(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setId(string $a_val)
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $a_obj_id, ?object $a_parent_obj, string $a_parent_cmd)
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)