ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Skill\Table\AssignedObjectsTable Class Reference
+ Collaboration diagram for ILIAS\Skill\Table\AssignedObjectsTable:

Public Member Functions

 __construct (object $parent_obj, array $objects, int $skill_id=0, int $tref_id=0, int $profile_id=0)
 
 getComponent ()
 

Protected Member Functions

 getColumns ()
 
 getDataRetrieval ()
 

Protected Attributes

ilLanguage $lng
 
ilTree $tree
 
UI Factory $ui_fac
 
UI Renderer $ui_ren
 
ServerRequestInterface $request
 
object $parent_obj
 
array $objects = []
 
int $skill_id = 0
 
int $tref_id = 0
 
int $profile_id = 0
 

Detailed Description

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

Definition at line 31 of file class.AssignedObjectsTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Table\AssignedObjectsTable::__construct ( object  $parent_obj,
array  $objects,
int  $skill_id = 0,
int  $tref_id = 0,
int  $profile_id = 0 
)

Definition at line 44 of file class.AssignedObjectsTable.php.

References $DIC, ILIAS\Skill\Table\AssignedObjectsTable\$objects, ILIAS\Skill\Table\AssignedObjectsTable\$parent_obj, ILIAS\Skill\Table\AssignedObjectsTable\$profile_id, ILIAS\Skill\Table\AssignedObjectsTable\$skill_id, ILIAS\Skill\Table\AssignedObjectsTable\$tref_id, and ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\AssignedObjectsTable\getDataRetrieval().

50  {
51  global $DIC;
52 
53  $this->lng = $DIC->language();
54  $this->tree = $DIC->repositoryTree();
55  $this->ui_fac = $DIC->ui()->factory();
56  $this->ui_ren = $DIC->ui()->renderer();
57  $this->request = $DIC->http()->request();
58 
59  $this->parent_obj = $parent_obj;
60  $this->objects = $objects;
61  $this->skill_id = $skill_id;
62  $this->tref_id = $tref_id;
63  $this->profile_id = $profile_id;
64  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ getColumns()

ILIAS\Skill\Table\AssignedObjectsTable::getColumns ( )
protected

Definition at line 85 of file class.AssignedObjectsTable.php.

References ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\AssignedObjectsTable\getComponent().

85  : array
86  {
87  $columns = [
88  "type" => $this->ui_fac->table()->column()->statusIcon($this->lng->txt("type"))
89  ->withIsSortable(false),
90  "title" => $this->ui_fac->table()->column()->text($this->lng->txt("title")),
91  "path" => $this->ui_fac->table()->column()->text($this->lng->txt("path"))
92  ->withIsSortable(false)
93  ];
94 
95  return $columns;
96  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

ILIAS\Skill\Table\AssignedObjectsTable::getComponent ( )

Definition at line 66 of file class.AssignedObjectsTable.php.

References ILIAS\Skill\Table\AssignedObjectsTable\getColumns(), ILIAS\Skill\Table\AssignedObjectsTable\getDataRetrieval(), and ILIAS\Repository\lng().

66  : UI\Component\Table\Data
67  {
68  $columns = $this->getColumns();
69  $data_retrieval = $this->getDataRetrieval();
70 
71  $table = $this->ui_fac->table()
72  ->data($this->lng->txt("skmg_assigned_objects"), $columns, $data_retrieval)
73  ->withId(
74  self::class . "_" .
75  $this->parent_obj::class . "_" .
76  $this->skill_id . "_" .
77  $this->tref_id . "_" .
78  $this->profile_id
79  )
80  ->withRequest($this->request);
81 
82  return $table;
83  }
+ Here is the call graph for this function:

◆ getDataRetrieval()

ILIAS\Skill\Table\AssignedObjectsTable::getDataRetrieval ( )
protected

Definition at line 98 of file class.AssignedObjectsTable.php.

References ILIAS\Skill\Table\AssignedObjectsTable\$lng, ILIAS\Skill\Table\AssignedObjectsTable\$objects, $path, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Skill\Table\AssignedObjectsTable\$tree, ILIAS\Skill\Table\AssignedObjectsTable\$ui_fac, ILIAS\Skill\Table\AssignedObjectsTable\$ui_ren, ILIAS\Skill\Table\AssignedObjectsTable\__construct(), ilObject\_getAllReferences(), ilObject\_lookupTitle(), ilObject\_lookupType(), and ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\AssignedObjectsTable\getComponent().

98  : UI\Component\Table\DataRetrieval
99  {
100  $data_retrieval = new class (
101  $this->lng,
104  $this->tree,
106  ) implements UI\Component\Table\DataRetrieval {
107  use TableRecords;
108 
109  public function __construct(
110  protected \ilLanguage $lng,
111  protected UI\Factory $ui_fac,
112  protected UI\Renderer $ui_ren,
113  protected \ilTree $tree,
114  protected array $objects
115  ) {
116  }
117 
118  public function getRows(
119  UI\Component\Table\DataRowBuilder $row_builder,
120  array $visible_column_ids,
121  Data\Range $range,
122  Data\Order $order,
123  ?array $filter_data,
124  ?array $additional_parameters
125  ): \Generator {
126  $records = $this->getRecords($range, $order);
127  foreach ($records as $idx => $record) {
128  $row_id = (string) $record["obj_id"];
129 
130  yield $row_builder->buildDataRow($row_id, $record);
131  }
132  }
133 
134  public function getTotalRowCount(
135  ?array $filter_data,
136  ?array $additional_parameters
137  ): ?int {
138  return count($this->getRecords());
139  }
140 
141  protected function getRecords(Data\Range $range = null, Data\Order $order = null): array
142  {
143  $records = [];
144  $i = 0;
145  foreach ($this->objects as $obj_id) {
146  $obj_ref_id = \ilObject::_getAllReferences($obj_id);
147  $obj_ref_id = end($obj_ref_id);
148 
149  if (!$obj_ref_id) {
150  continue;
151  }
152 
153  $records[$i]["obj_id"] = $obj_id;
154  $records[$i]["title"] = \ilObject::_lookupTitle($obj_id);
155 
156  $obj_type = \ilObject::_lookupType($obj_id);
157  $icon = $this->ui_fac->symbol()->icon()->standard(
158  $obj_type,
159  $this->lng->txt("icon") . " " . $this->lng->txt($obj_type),
160  "medium"
161  );
162  $records[$i]["type"] = $icon;
163 
164  $obj_ref_id_parent = $this->tree->getParentId($obj_ref_id);
165  $path = new \ilPathGUI();
166  $records[$i]["path"] = $path->getPath($this->tree->getParentId($obj_ref_id_parent), $obj_ref_id);
167 
168  $i++;
169  }
170 
171  if ($order) {
172  $records = $this->orderRecords($records, $order);
173  }
174 
175  if ($range) {
176  $records = $this->limitRecords($records, $range);
177  }
178 
179  return $records;
180  }
181  };
182 
183  return $data_retrieval;
184  }
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:32
static _lookupTitle(int $obj_id)
__construct(object $parent_obj, array $objects, int $skill_id=0, int $tref_id=0, int $profile_id=0)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilLanguage ILIAS\Skill\Table\AssignedObjectsTable::$lng
protected

◆ $objects

array ILIAS\Skill\Table\AssignedObjectsTable::$objects = []
protected

◆ $parent_obj

object ILIAS\Skill\Table\AssignedObjectsTable::$parent_obj
protected

◆ $profile_id

int ILIAS\Skill\Table\AssignedObjectsTable::$profile_id = 0
protected

◆ $request

ServerRequestInterface ILIAS\Skill\Table\AssignedObjectsTable::$request
protected

Definition at line 37 of file class.AssignedObjectsTable.php.

◆ $skill_id

int ILIAS\Skill\Table\AssignedObjectsTable::$skill_id = 0
protected

◆ $tree

ilTree ILIAS\Skill\Table\AssignedObjectsTable::$tree
protected

◆ $tref_id

int ILIAS\Skill\Table\AssignedObjectsTable::$tref_id = 0
protected

◆ $ui_fac

UI Factory ILIAS\Skill\Table\AssignedObjectsTable::$ui_fac
protected

◆ $ui_ren

UI Renderer ILIAS\Skill\Table\AssignedObjectsTable::$ui_ren
protected

The documentation for this class was generated from the following file: