49 : string
50 {
52 'tpl.usr_public_profile_badges.html',
53 true,
54 true,
55 'components/ILIAS/Badge'
56 );
57
58 $this->main_tpl->addJavaScript('assets/js/PublicProfileBadges.js');
59 $this->main_tpl->addOnLoadCode('new BadgeToggle("ilbdgprcont", "ilbdgprfhdm", "ilbdgprfhdl", "ilNoDisplay");');
61 if ($user_badges) {
62 $has_public_badge = false;
63 $cnt = 0;
64
65 $cut = 20;
66
67 $badge_by_id = [];
68 $image_rids = [];
69 foreach ($user_badges as $ass) {
70 $badge =
new ilBadge($ass->getBadgeId());
71 $image_rids[] = $badge->getImageRid();
72 $badge_by_id[$badge->getId()] = $badge;
73 }
74
75 $this->irss->preload(array_filter($image_rids));
76
77 foreach ($user_badges as $ass) {
78
79 if ($ass->getPosition()) {
80 $cnt++;
81
83
84
85 if ($cnt > $cut) {
86 $tpl->setCurrentBlock('hidden_badge');
87 $tpl->touchBlock('hidden_badge');
88 $tpl->parseCurrentBlock();
89 }
90
91 $tpl->setCurrentBlock('badge_bl');
92 $tpl->setVariable(
'BADGE',
$renderer->getHTML());
93 $tpl->parseCurrentBlock();
94
95 $has_public_badge = true;
96 }
97 }
98
99 if ($cnt > $cut) {
100 $tpl->setVariable(
'BADGE_HIDDEN_TXT_MORE', $this->
lng->txt(
'badge_profile_more'));
101 $tpl->setVariable(
'BADGE_HIDDEN_TXT_LESS', $this->
lng->txt(
'badge_profile_less'));
102 }
103
104 if ($has_public_badge) {
105 $tpl->setVariable(
'TXT_BADGES', $this->
lng->txt(
'obj_bdga'));
106 }
107 }
108
109 return $tpl->get();
110 }
static getInstancesByUserId(int $a_user_id)
special template class to simplify handling of ITX/PEAR