3 declare(strict_types=1);
33 protected \ilLanguage
$lng;
44 $this->
lng = $DIC->language();
45 $this->ui_fac = $DIC->ui()->factory();
46 $this->ui_ren = $DIC->ui()->renderer();
47 $this->request = $DIC->http()->request();
48 $this->
access = $DIC->access();
58 $table = $this->ui_fac->table()
59 ->data($this->
lng->txt(
"cont_usage"), $columns, $data_retrieval)
65 ->withRequest($this->request);
73 "object" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"objects")),
74 "sub_object" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"subobjects")),
75 "version" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"cont_versions"))
76 ->withIsSortable(
false),
77 "type" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"type")),
78 "link" => $this->ui_fac->table()->column()->link($this->
lng->txt(
"cont_link"))
79 ->withIsSortable(
false)
87 $data_retrieval =
new class (
101 protected int $term_id
105 public function getRows(
107 array $visible_column_ids,
111 ?array $additional_parameters
113 $records = $this->getRecords($range, $order);
114 foreach ($records as $idx => $record) {
115 $row_id = (string) $record[
"id"];
117 yield $row_builder->buildDataRow($row_id, $record);
121 public function getTotalRowCount(
123 ?array $additional_parameters
125 return count($this->getRecords());
128 protected function getRecords(
Data\
Range $range = null,
Data\
Order $order = null): array
133 foreach ($usages as $usage) {
134 if (empty($agg_usages[$usage[
"type"] .
":" . $usage[
"id"]])) {
135 $usage[
"hist_nr"] = [$usage[
"hist_nr"] ?? 0];
136 $agg_usages[$usage[
"type"] .
":" . $usage[
"id"]] = $usage;
138 $agg_usages[$usage[
"type"] .
":" . $usage[
"id"]][
"hist_nr"][] =
139 $usage[
"hist_nr"] ?? 0;
145 foreach ($agg_usages as $k => $usage) {
146 $records[$i][
"id"] = $k;
149 if (is_int(strpos($usage[
"type"],
":"))) {
150 $us_arr = explode(
":", $usage[
"type"]);
151 $usage[
"type"] = $us_arr[1];
152 $cont_type = $us_arr[0];
155 switch ($usage[
"type"]) {
159 switch ($cont_type) {
161 $page_obj = new \ilLMPage($usage[
"id"]);
162 $lm_obj = new \ilObjLearningModule($page_obj->getParentId(),
false);
163 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_" . $cont_type);
164 $item[
"obj_title"] = $lm_obj->getTitle();
165 $item[
"sub_txt"] = $this->
lng->txt(
"pg");
167 $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
174 $page_obj = new \ilWikiPage($usage[
"id"]);
175 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_wiki");
177 $item[
"sub_txt"] = $this->
lng->txt(
"pg");
179 $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
186 $page_obj = new \ilGlossaryDefPage($usage[
"id"]);
187 $term_id = $page_obj->getId();
189 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_glo");
191 $item[
"sub_txt"] = $this->
lng->txt(
"cont_term");
193 $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
205 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_" . $cont_type);
207 $ref_id = $this->getFirstWritableRefId($usage[
"id"]);
214 $item[
"obj_title"] =
"Page " . $cont_type .
", " . $usage[
"id"];
220 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_mep");
222 $ref_id = $this->getFirstWritableRefId($usage[
"id"]);
229 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_mob");
231 $item[
"sub_txt"] = $this->
lng->txt(
"cont_link_area");
235 $item[
"obj_type_txt"] = $this->
lng->txt(
"cont_sqst");
238 $item[
"sub_txt"] = $this->
lng->txt(
"question");
240 $ref_id = $this->getFirstWritableRefId($obj_id);
247 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_glo");
249 $item[
"sub_txt"] = $this->
lng->txt(
"glo_referenced_term");
250 $ref_id = $this->getFirstWritableRefId($usage[
"id"]);
257 $item[
"obj_title"] =
"Type " . $usage[
"type"] .
", " . $usage[
"id"];
262 if (is_array($usage[
"hist_nr"]) &&
263 (count($usage[
"hist_nr"]) > 1 || $usage[
"hist_nr"][0] > 0)) {
264 asort($usage[
"hist_nr"]);
266 if ($usage[
"hist_nr"][0] == 0) {
267 array_shift($usage[
"hist_nr"]);
268 $usage[
"hist_nr"][] = 0;
270 foreach ($usage[
"hist_nr"] as $nr) {
274 $ver .= $sep . $this->
lng->txt(
"cont_current_version");
279 $records[$i][
"version"] = $ver;
282 if (($item[
"obj_type_txt"] ??
"") !=
"") {
283 $records[$i][
"type"] = $item[
"obj_type_txt"];
286 if (($usage[
"type"] ??
"") !=
"clip") {
287 $records[$i][
"object"] = $item[
"obj_title"];
288 if ($item[
"obj_link"] ??
"") {
289 $link = $this->ui_fac->link()->standard($this->
lng->txt(
"cont_link"), $item[
"obj_link"]);
290 $records[$i][
"link"] = $link;
294 if (($item[
"sub_txt"] ??
"") !=
"") {
295 $sub_text = $item[
"sub_txt"];
296 if (($item[
"sub_title"] ??
"") !=
"") {
298 $sub_text .= $item[
"sub_title"];
300 $records[$i][
"sub_object"] = $sub_text;
303 $records[$i][
"object"] = $this->
lng->txt(
"cont_users_have_mob_in_clip1") .
304 " " . $usage[
"cnt"] .
" " . $this->
lng->txt(
"cont_users_have_mob_in_clip2");
311 $records = $this->orderRecords($records, $order);
315 $records = $this->limitRecords($records, $range);
321 protected function getFirstWritableRefId(
int $obj_id):
int 324 foreach ($ref_ids as
$ref_id) {
325 if ($this->access->checkAccess(
"write",
"", $ref_id)) {
333 return $data_retrieval;
static getUsages(int $a_term_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static lookupTitle(int $a_page_id, string $lang="-")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getTitle(int $question_id)
Returns the question title of a question with a given id.
Both the subject and the direction need to be specified when expressing an order. ...
__construct(int $term_id)
static _lookupTitle(int $a_obj_id)
static _lookupTitle(int $obj_id)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static lookupObjFi(int $a_qid)
static _lookGlossaryTerm(int $term_id)
get glossary term
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...
A simple class to express a naive range of whole positive numbers.
ServerRequestInterface $request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookGlossaryID(int $term_id)
get glossary id form term id