ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Bibliographic\Field\Table\AssignMaterialsTable Class Reference
+ Collaboration diagram for ILIAS\Bibliographic\Field\Table\AssignMaterialsTable:

Public Member Functions

 __construct (int $top_skill_id, int $tref_id, int $basic_skill_id)
 
 getComponent ()
 

Protected Member Functions

 getColumns ()
 
 getActions ()
 
 getDataRetrieval ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilObjUser $user
 
ilWorkspaceTree $ws_tree
 
ilWorkspaceAccessHandler $ws_access
 
UI Factory $ui_fac
 
ServerRequestInterface $request
 
Data Factory $df
 
ilSkillTreeRepository $tree_repo
 
Node SkillTreeNodeManager $node_manager
 
Personal AssignedMaterialManager $assigned_material_manager
 
int $top_skill_id = 0
 
int $tref_id = 0
 
int $basic_skill_id = 0
 

Detailed Description

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

Definition at line 32 of file class.AssignMaterialsTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::__construct ( int  $top_skill_id,
int  $tref_id,
int  $basic_skill_id 
)

Definition at line 49 of file class.AssignMaterialsTable.php.

References ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$basic_skill_id, $DIC, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$top_skill_id, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$tref_id, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\getDataRetrieval().

50  {
51  global $DIC;
52 
53  $this->ctrl = $DIC->ctrl();
54  $this->lng = $DIC->language();
55  $this->user = $DIC->user();
56  $this->ui_fac = $DIC->ui()->factory();
57  $this->request = $DIC->http()->request();
58  $this->df = new Data\Factory();
59  $this->ws_tree = new \ilWorkspaceTree($this->user->getId());
60  if (!$this->ws_tree->readRootId()) {
61  $this->ws_tree->createTreeForUser($this->user->getId());
62  }
63  $this->ws_access = new \ilWorkspaceAccessHandler();
64 
65  $this->top_skill_id = $top_skill_id;
66  $this->tref_id = $tref_id;
67  $this->basic_skill_id = $basic_skill_id;
68 
69  $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
70  $tree_id = $this->tree_repo->getTreeIdForNodeId($this->basic_skill_id);
71  $this->node_manager = $DIC->skills()->internal()->manager()->getTreeNodeManager($tree_id);
72  $this->assigned_material_manager = $DIC->skills()->internal()->manager()->getAssignedMaterialManager();
73  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ getActions()

ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::getActions ( )
protected

Definition at line 110 of file class.AssignMaterialsTable.php.

References ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$basic_skill_id, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$tref_id, ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\getComponent().

110  : array
111  {
112  $query_params_namespace = ["skl_assign_materials_table"];
113 
114  $uri_assign = $this->df->uri(
115  ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
116  "ilpersonalskillsgui",
117  "assignMaterial"
118  )
119  );
120  $url_builder_assign = new UI\URLBuilder($uri_assign);
121  list($url_builder_assign, $action_parameter_token_assign, $row_id_token_assign) =
122  $url_builder_assign->acquireParameters(
123  $query_params_namespace,
124  "action",
125  "level_ids"
126  );
127 
128  $actions = [
129  "assign" => $this->ui_fac->table()->action()->single(
130  $this->lng->txt("skmg_assign_materials"),
131  $url_builder_assign->withParameter($action_parameter_token_assign, "assignMaterials"),
132  $row_id_token_assign
133  )
134  ];
135 
136  foreach ($this->assigned_material_manager->getAllAssignedMaterialsForSkill(
137  $this->user->getId(),
140  ) as $material) {
141  $obj_id = $this->ws_tree->lookupObjectId($material->getWorkspaceId());
142 
143  $uri_remove = $this->df->uri(
144  ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
145  "ilpersonalskillsgui",
146  "removeMaterial"
147  )
148  );
149  $url_builder_remove = new UI\URLBuilder($uri_remove);
150  list($url_builder_remove, $action_parameter_token_remove, $row_id_token_remove, $wsp_token_remove) =
151  $url_builder_remove->acquireParameters(
152  $query_params_namespace,
153  "action",
154  "level_ids",
155  "wsp_id"
156  );
157  $url_builder_remove = $url_builder_remove->withParameter($wsp_token_remove, (string) $material->getWorkspaceId());
158 
159  $actions["remove_" . $material->getLevelId() . "_" . $material->getWorkspaceId()] =
160  $this->ui_fac->table()->action()->single(
161  $this->lng->txt("skmg_remove") . " '" . \ilObject::_lookupTitle($obj_id) . "'",
162  $url_builder_remove->withParameter($action_parameter_token_remove, "removeMaterial"),
163  $row_id_token_remove
164  );
165  }
166 
167  return $actions;
168  }
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColumns()

ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::getColumns ( )
protected

Definition at line 96 of file class.AssignMaterialsTable.php.

References ILIAS\Repository\lng().

Referenced by ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\getComponent().

96  : array
97  {
98  $columns = [
99  "title" => $this->ui_fac->table()->column()->text($this->lng->txt("skmg_skill_level"))
100  ->withIsSortable(false),
101  "description" => $this->ui_fac->table()->column()->text($this->lng->txt("description"))
102  ->withIsSortable(false),
103  "resources" => $this->ui_fac->table()->column()->linkListing($this->lng->txt("skmg_materials"))
104  ->withIsSortable(false)
105  ];
106 
107  return $columns;
108  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::getComponent ( )

Definition at line 75 of file class.AssignMaterialsTable.php.

References ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\getActions(), ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\getColumns(), and ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\getDataRetrieval().

75  : UI\Component\Table\Data
76  {
77  $columns = $this->getColumns();
78  $actions = $this->getActions();
79  $data_retrieval = $this->getDataRetrieval();
80 
81  $title = $this->node_manager->getWrittenPath($this->basic_skill_id);
82  $table = $this->ui_fac->table()
83  ->data($data_retrieval, $title, $columns)
84  ->withId(
85  self::class . "_" .
86  $this->top_skill_id . "_" .
87  $this->tref_id . "_" .
88  $this->basic_skill_id
89  )
90  ->withActions($actions)
91  ->withRequest($this->request);
92 
93  return $table;
94  }
+ Here is the call graph for this function:

◆ getDataRetrieval()

ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::getDataRetrieval ( )
protected

Definition at line 170 of file class.AssignMaterialsTable.php.

References ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$assigned_material_manager, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$basic_skill_id, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$tref_id, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$ui_fac, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$user, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$ws_access, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\$ws_tree, ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\__construct(), ilObject\_lookupTitle(), ilSkillTreeNodeFactory\getInstance(), ILIAS\Repository\int(), and null.

Referenced by ILIAS\Bibliographic\Field\Table\AssignMaterialsTable\getComponent().

170  : UI\Component\Table\DataRetrieval
171  {
172  $data_retrieval = new class (
175  $this->user,
180  ) implements UI\Component\Table\DataRetrieval {
181  use TableRecords;
182 
183  public function __construct(
184  protected int $basic_skill_id,
185  protected int $tref_id,
186  protected \ilObjUser $user,
187  protected \ilWorkspaceTree $ws_tree,
188  protected Personal\AssignedMaterialManager $assigned_material_manager,
189  protected UI\Factory $ui_fac,
191  ) {
192  }
193 
194  public function getRows(
195  UI\Component\Table\DataRowBuilder $row_builder,
196  array $visible_column_ids,
197  Data\Range $range,
198  Data\Order $order,
199  ?array $filter_data,
200  ?array $additional_parameters
201  ): \Generator {
202  $records = $this->getRecords($range);
203  foreach ($records as $idx => $record) {
204  $row_id = $record["id"];
205  $res_ids = $record["res_ids"];
206 
207  $data_row = $row_builder->buildDataRow((string) $row_id, $record);
208  foreach ($this->assigned_material_manager->getAllAssignedMaterialsForSkill(
209  $this->user->getId(),
212  ) as $material) {
213  if (!in_array($material->getWorkspaceId(), $res_ids) || $row_id != $material->getLevelId()) {
214  $data_row = $data_row->withDisabledAction(
215  "remove_" . $material->getLevelId() . "_" . $material->getWorkspaceId()
216  );
217  }
218  }
219 
220  yield $data_row;
221  }
222  }
223 
224  public function getTotalRowCount(
225  ?array $filter_data,
226  ?array $additional_parameters
227  ): ?int {
228  return count($this->getRecords());
229  }
230 
231  protected function getRecords(?Data\Range $range = null): array
232  {
233  $skill = \ilSkillTreeNodeFactory::getInstance($this->basic_skill_id);
234  $records = [];
235  $i = 0;
236  foreach ($skill->getLevelData() as $level) {
237  $records[$i]["id"] = $level["id"];
238  $records[$i]["title"] = $level["title"];
239  $records[$i]["description"] = $level["description"];
240 
241  $materials = $this->assigned_material_manager->getAssignedMaterials(
242  $this->user->getId(),
244  (int) $level["id"]
245  );
246  $wsp_ids = [];
247  $obj_links = [];
248  foreach ($materials as $m) {
249  $wsp_ids[] = $m->getWorkspaceId();
250  $obj_id = $this->ws_tree->lookupObjectId($m->getWorkspaceId());
251  $obj_links[] = $this->ui_fac->link()->standard(
252  \ilObject::_lookupTitle($obj_id),
253  $this->ws_access->getGotoLink($m->getWorkspaceId(), $obj_id)
254  );
255  }
256  $records[$i]["res_ids"] = $wsp_ids;
257  $records[$i]["resources"] = $this->ui_fac->listing()->unordered($obj_links);
258 
259  $i++;
260  }
261 
262  if ($range) {
263  $records = $this->limitRecords($records, $range);
264  }
265 
266  return $records;
267  }
268  };
269 
270  return $data_retrieval;
271  }
__construct(int $top_skill_id, int $tref_id, int $basic_skill_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_material_manager

Personal AssignedMaterialManager ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$assigned_material_manager
protected

◆ $basic_skill_id

◆ $ctrl

ilCtrl ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$ctrl
protected

Definition at line 34 of file class.AssignMaterialsTable.php.

◆ $df

Data Factory ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$df
protected

Definition at line 41 of file class.AssignMaterialsTable.php.

◆ $lng

ilLanguage ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$lng
protected

Definition at line 35 of file class.AssignMaterialsTable.php.

◆ $node_manager

Node SkillTreeNodeManager ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$node_manager
protected

Definition at line 43 of file class.AssignMaterialsTable.php.

◆ $request

ServerRequestInterface ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$request
protected

Definition at line 40 of file class.AssignMaterialsTable.php.

◆ $top_skill_id

int ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$top_skill_id = 0
protected

◆ $tree_repo

ilSkillTreeRepository ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$tree_repo
protected

Definition at line 42 of file class.AssignMaterialsTable.php.

◆ $tref_id

◆ $ui_fac

UI Factory ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$ui_fac
protected

◆ $user

ilObjUser ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$user
protected

◆ $ws_access

ilWorkspaceAccessHandler ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$ws_access
protected

◆ $ws_tree

ilWorkspaceTree ILIAS\Bibliographic\Field\Table\AssignMaterialsTable::$ws_tree
protected

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