19 declare(strict_types=1);
    76         $this->
lng = $DIC->language();
    77         $this->tpl = $DIC->ui()->mainTemplate();
    78         $this->factory = $DIC->ui()->factory();
    79         $this->renderer = $DIC->ui()->renderer();
    80         $this->request = $DIC->http()->request();
    81         $this->
user = $DIC->user();
    82         $this->
access = $DIC->access();
    83         $this->tile = 
new Tile($DIC);
    84         $this->irss = $DIC[
'resource_storage'];
    85         $this->object_data_cache = $DIC[
'ilObjDataCache'];
    90         array $visible_column_ids,
    94         ?array $additional_parameters
    99             [$order_field, $order_direction] = $order->
join(
   101                 fn($ret, $key, $value) => [$key, $value]
   104             usort($records, 
static function (array $left, array $right) use ($order_field): 
int {
   105                 if (in_array($order_field, [
'title', 
'awarded_by'], 
true)) {
   106                     if (in_array($order_field, [
'title', 
'awarded_by'], 
true)) {
   107                         $order_field .= 
'_sortable';
   116                 if ($order_field === 
'active') {
   117                     return $right[$order_field] <=> $left[$order_field];
   120                 return $left[$order_field] <=> $right[$order_field];
   123             if ($order_direction === Order::DESC) {
   124                 $records = array_reverse($records);
   134         $parent_obj_ids = [];
   135         $identifications = [];
   137         foreach ($records as $record) {
   138             $badge = $record[
'badge'];
   139             $parent_obj_ids[] = $badge->getParentId();
   140             $identifications[] = $badge->getImageRid();
   142         $this->irss->preload(array_filter($identifications));
   143         $this->object_data_cache->preloadObjectCache(array_unique($parent_obj_ids));
   145         foreach ($records as $record) {
   170         array &$access_cache,
   173         $badge = $record[
'badge'];
   174         $ass = $record[
'assignment'];
   177         if ($badge->getParentId()) {
   178             if (isset($this->parent_metadata_cache[$badge->getParentId()])) {
   179                 $parent = $this->parent_metadata_cache[$badge->getParentId()];
   181                 $parent = $badge->getParentMeta();
   182                 $this->parent_metadata_cache[$badge->getParentId()] = $parent;
   184             if ($parent[
'type'] === 
'bdga') {
   190         if ($parent !== null) {
   191             if (isset($ref_id_cache[$parent[
'id']])) {
   192                 $ref_id = $ref_id_cache[$parent[
'id']];
   195                 $ref_id_cache[$parent[
'id']] = 
$ref_id;
   198             $awarded_by = $parent[
'title'];
   201                 if (!isset($access_cache[
$ref_id])) {
   206                 $awarded_by = $this->renderer->render(
   209                         (
string) 
new URI(ilLink::_getLink(
$ref_id, $parent[
'type']))
   214             $awarded_by = implode(
' ', [
   215                 $this->renderer->render(
   216                     $this->factory->symbol()->icon()->standard(
   226             'image' => $this->renderer->render(
   227                 $this->tile->asImage(
   228                     $this->tile->modalContentWithAssignment($badge, $ass),
   229                     ilBadgeImage::IMAGE_SIZE_XS
   232             'title' => $this->renderer->render(
   233                 $this->tile->asTitle(
   234                     $this->tile->modalContentWithAssignment($badge, $ass)
   237             'awarded_by' => $awarded_by,
   245         ?array $additional_parameters
   263         if ($this->cached_records !== null) {
   268         $a_user_id = $this->
user->getId();
   271             $badge = 
new ilBadge($ass->getBadgeId());
   274             if ($badge->getParentId()) {
   275                 if (isset($this->parent_metadata_cache[$badge->getParentId()])) {
   276                     $parent = $this->parent_metadata_cache[$badge->getParentId()];
   279                     $this->parent_metadata_cache[$badge->getParentId()] = $parent;
   281                 if ($parent[
'type'] === 
'bdga') {
   286             $awarded_by_sortable = 
'';
   287             if ($parent !== null) {
   288                 $awarded_by_sortable = $parent[
'title'];
   292                 'id' => $badge->getId(),
   293                 'title_sortable' => $badge->getTitle(),
   294                 'awarded_by_sortable' => $awarded_by_sortable,
   296                     ->setTimestamp($ass->getTimestamp())
   298                 'active' => (bool) $ass->getPosition(),
   299                 'assignment' => $ass,
   304         $this->cached_records = $rows;
   315             'image' => $this->factory->table()->column()->text($this->
lng->txt(
'image'))->withIsSortable(
false),
   316             'title' => $this->factory->table()->column()->text($this->
lng->txt(
'title')),
   317             'awarded_by' => $this->factory->table()->column()->text($this->
lng->txt(
'awarded_by')),
   318             'badge_issued_on' => $this->factory->table()->column()->date(
   319                 $this->
lng->txt(
'badge_issued_on'),
   322             'active' => $this->factory->table()->column()->boolean(
   323                 $this->
lng->txt(
'badge_in_profile'),
   324                 $this->
lng->txt(
'yes'),
   325                 $this->
lng->txt(
'no')
   326             )->withOrderingLabels(
   327                 $this->
lng->txt(
'badge_sort_added_to_profile_first'),
   328                 $this->
lng->txt(
'badge_sort_excluded_from_profile_first')
   342             'obj_badge_activate' => $this->factory->table()->action()->multi(
   343                 $this->
lng->txt(
'badge_add_to_profile'),
   344                 $url_builder->
withParameter($action_parameter_token, 
'obj_badge_activate'),
   347             'obj_badge_deactivate' =>
   348                 $this->factory->table()->action()->multi(
   349                     $this->
lng->txt(
'badge_remove_from_profile'),
   350                     $url_builder->
withParameter($action_parameter_token, 
'obj_badge_deactivate'),
   358         $df = new \ILIAS\Data\Factory();
   360         $table_uri = $df->uri($url);
   362         $query_params_namespace = [
'badge'];
   364         [$url_builder, $action_parameter_token, $row_id_token] = $url_builder->acquireParameters(
   365             $query_params_namespace,
   370         $table = $this->factory
   373                 $this->
lng->txt(
'badge_personal_badges'),
   377             ->withId(self::class)
   378             ->withOrder(
new Order(
'title', Order::ASC))
   379             ->withActions($this->
getActions($url_builder, $action_parameter_token, $row_id_token))
   380             ->withRequest($this->request);
   383         $pres->show($this->
lng->txt(
'table_view'));
   385         $this->tpl->setContent($this->renderer->render($table));
 
join($init, callable $fn)
 
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
 
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e...
 
static getInstancesByUserId(int $a_user_id)
 
Interface Observer  Contains several chained tasks and infos about them. 
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
readonly Factory $factory
 
getColumns(\ILIAS\Data\DateFormat\DateFormat $date_format)
 
Both the subject and the direction need to be specified when expressing an order. ...
 
buildDataRow(string $id, array $record)
 
enrichRecord(array $record, array &$access_cache, array &$ref_id_cache)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
readonly ServerRequestInterface RequestInterface $request
 
This is how the factory for UI elements looks. 
 
getActions(URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)
 
readonly Renderer $renderer
 
The scope of this class is split ilias-conform URI's into components. 
 
ilObjectDataCache $object_data_cache
 
static strCmp(string $a, string $b)
 
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid. 
 
readonly ILIAS DI Container $dic
 
A simple class to express a naive range of whole positive numbers. 
 
readonly ilAccessHandler $access
 
readonly ilGlobalTemplateInterface $tpl