19declare(strict_types=1);
25use Psr\Http\Message\ServerRequestInterface;
32 protected \ilLanguage
$lng;
43 $this->
lng = $DIC->language();
44 $this->ui_fac =
$DIC->ui()->factory();
45 $this->ui_ren =
$DIC->ui()->renderer();
46 $this->request =
$DIC->http()->request();
47 $this->
access = $DIC->access();
57 $table = $this->ui_fac->table()
58 ->data($data_retrieval, $this->
lng->txt(
"cont_usage"), $columns)
64 ->withRequest($this->request);
72 "object" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"objects")),
73 "sub_object" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"subobjects")),
74 "version" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"cont_versions"))
75 ->withIsSortable(
false),
76 "type" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"type")),
77 "link" => $this->ui_fac->table()->column()->link($this->
lng->txt(
"cont_link"))
78 ->withIsSortable(
false)
86 $data_retrieval =
new class (
104 public function getRows(
106 array $visible_column_ids,
109 mixed $additional_viewcontrol_data,
111 mixed $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(
122 mixed $additional_viewcontrol_data,
124 mixed $additional_parameters
126 return count($this->getRecords());
134 foreach ($usages as $usage) {
135 if (empty($agg_usages[$usage[
"type"] .
":" . $usage[
"id"]])) {
136 $usage[
"hist_nr"] = [$usage[
"hist_nr"] ?? 0];
137 $agg_usages[$usage[
"type"] .
":" . $usage[
"id"]] = $usage;
139 $agg_usages[$usage[
"type"] .
":" . $usage[
"id"]][
"hist_nr"][] =
140 $usage[
"hist_nr"] ?? 0;
146 foreach ($agg_usages as $k => $usage) {
147 $records[$i][
"id"] = $k;
150 if (is_int(strpos($usage[
"type"],
":"))) {
151 $us_arr = explode(
":", $usage[
"type"]);
152 $usage[
"type"] = $us_arr[1];
153 $cont_type = $us_arr[0];
156 switch ($usage[
"type"]) {
160 switch ($cont_type) {
162 $page_obj = new \ilLMPage($usage[
"id"]);
163 $lm_obj = new \ilObjLearningModule($page_obj->getParentId(),
false);
164 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_" . $cont_type);
165 $item[
"obj_title"] = $lm_obj->getTitle();
166 $item[
"sub_txt"] = $this->
lng->txt(
"pg");
168 $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
175 $page_obj = new \ilWikiPage($usage[
"id"]);
176 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_wiki");
178 $item[
"sub_txt"] = $this->
lng->txt(
"pg");
180 $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
187 $page_obj = new \ilGlossaryDefPage($usage[
"id"]);
190 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_glo");
192 $item[
"sub_txt"] = $this->
lng->txt(
"cont_term");
194 $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
206 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_" . $cont_type);
208 $ref_id = $this->getFirstWritableRefId($usage[
"id"]);
215 $item[
"obj_title"] =
"Page " . $cont_type .
", " . $usage[
"id"];
221 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_mep");
223 $ref_id = $this->getFirstWritableRefId($usage[
"id"]);
230 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_mob");
232 $item[
"sub_txt"] = $this->
lng->txt(
"cont_link_area");
236 $item[
"obj_type_txt"] = $this->
lng->txt(
"cont_sqst");
239 $item[
"sub_txt"] = $this->
lng->txt(
"question");
241 $ref_id = $this->getFirstWritableRefId($obj_id);
248 $item[
"obj_type_txt"] = $this->
lng->txt(
"obj_glo");
250 $item[
"sub_txt"] = $this->
lng->txt(
"glo_referenced_term");
251 $ref_id = $this->getFirstWritableRefId($usage[
"id"]);
258 $item[
"obj_title"] =
"Type " . $usage[
"type"] .
", " . $usage[
"id"];
263 if (is_array($usage[
"hist_nr"]) &&
264 (count($usage[
"hist_nr"]) > 1 || $usage[
"hist_nr"][0] > 0)) {
265 asort($usage[
"hist_nr"]);
267 if ($usage[
"hist_nr"][0] == 0) {
268 array_shift($usage[
"hist_nr"]);
269 $usage[
"hist_nr"][] = 0;
271 foreach ($usage[
"hist_nr"] as $nr) {
275 $ver .= $sep . $this->
lng->txt(
"cont_current_version");
280 $records[$i][
"version"] = $ver;
283 if (($item[
"obj_type_txt"] ??
"") !=
"") {
284 $records[$i][
"type"] = $item[
"obj_type_txt"];
287 if (($usage[
"type"] ??
"") !=
"clip") {
288 $records[$i][
"object"] = $item[
"obj_title"];
289 if ($item[
"obj_link"] ??
"") {
290 $link = $this->ui_fac->link()->standard($this->
lng->txt(
"cont_link"), $item[
"obj_link"]);
291 $records[$i][
"link"] = $link;
295 if (($item[
"sub_txt"] ??
"") !=
"") {
296 $sub_text = $item[
"sub_txt"];
297 if (($item[
"sub_title"] ??
"") !=
"") {
299 $sub_text .= $item[
"sub_title"];
301 $records[$i][
"sub_object"] = $sub_text;
304 $records[$i][
"object"] = $this->
lng->txt(
"cont_users_have_mob_in_clip1") .
305 " " . $usage[
"cnt"] .
" " . $this->
lng->txt(
"cont_users_have_mob_in_clip2");
312 $records = $this->orderRecords($records, $order);
316 $records = $this->limitRecords($records,
$range);
322 protected function getFirstWritableRefId(
int $obj_id):
int
325 foreach ($ref_ids as
$ref_id) {
326 if ($this->access->checkAccess(
"write",
"",
$ref_id)) {
334 return $data_retrieval;
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
__construct(int $term_id)
ServerRequestInterface $request
static _getTitle(int $question_id)
Returns the question title of a question with a given id.
static lookupObjFi(int $a_qid)
Class ilAccessHandler Checks access for ILIAS objects.
static getUsages(int $a_term_id)
static _lookGlossaryTerm(int $term_id)
get glossary term
static _lookGlossaryID(int $term_id)
get glossary id form term id
static _lookupTitle(int $a_obj_id)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
static lookupTitle(int $a_page_id, string $lang="-")
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...