19declare(strict_types=1);
25use Psr\Http\Message\ServerRequestInterface as HttpRequest;
57 private readonly
bool $has_general_lp_access,
58 private readonly
bool $has_rbac_or_position_access,
60 private readonly UIFactory $ui_factory,
61 private readonly HttpRequest $request,
67 if ($lp->isActive()) {
68 $this->has_active_lp =
true;
71 if ($this->has_active_lp && $this->has_general_lp_access) {
72 $this->
lng->loadLanguageModule(
'trac');
81 return $this->ui_factory
85 $this->
lng->txt(
'frm_moderators'),
88 ->withId(str_replace(
'\\',
'', self::class) .
'_' . $this->forum->getId())
89 ->withRange(
new Range(0, 50))
90 ->withRequest($this->request);
99 'ranking' => $this->ui_factory->table()->column()->number(
100 $this->
lng->txt(
'frm_statistics_ranking')
101 )->withIsSortable(
true),
102 'login' => $this->ui_factory->table()->column()->text(
103 $this->
lng->txt(
'login')
104 )->withIsSortable(
true),
105 'lastname' => $this->ui_factory->table()->column()->text(
106 $this->
lng->txt(
'lastname')
107 )->withIsSortable(
true),
108 'firstname' => $this->ui_factory->table()->column()->text(
109 $this->
lng->txt(
'firstname')
110 )->withIsSortable(
true),
112 if ($this->has_active_lp && $this->has_general_lp_access) {
113 $columns[
'progress'] = $this->ui_factory->table()->column()->status(
114 $this->
lng->txt(
'learning_progress')
115 )->withIsSortable(
false);
123 if ($this->records ===
null) {
125 $data = $this->forum->Forum->getUserStatistics($this->obj_properties->isPostActivationEnabled());
127 foreach (
$data as $row) {
128 $this->records[
$counter][
'usr_id'] = $row[
'usr_id'];
129 $this->records[
$counter][
'ranking'] = $row[
'num_postings'];
130 $this->records[
$counter][
'login'] = $row[
'login'];
131 $this->records[
$counter][
'lastname'] = $row[
'lastname'];
132 $this->records[
$counter][
'firstname'] = $row[
'firstname'];
133 if ($this->has_active_lp && $this->has_general_lp_access) {
147 [$order_field, $order_direction] = $order->
join([], fn($ret, $key, $value) => [$key, $value]);
149 usort(
$records,
static function ($left, $right) use ($order_field):
int {
150 if ($order_field ===
'ranking') {
151 return $left[$order_field] <=> $right[$order_field];
154 return ilStr::strCmp($left[$order_field], $right[$order_field]);
157 if ($order_direction ===
'DESC') {
186 array $visible_column_ids,
189 mixed $additional_viewcontrol_data,
191 mixed $additional_parameters,
195 $row_id = (string) $record[
'usr_id'];
196 yield $row_builder->buildDataRow($row_id, $record);
201 mixed $additional_viewcontrol_data,
203 mixed $additional_parameters
205 $this->initRecords();
207 return \count($this->records);
213 if ($this->has_active_lp &&
214 $this->has_general_lp_access &&
215 ($this->has_rbac_or_position_access || $this->actor->getId() ===
$user_id)) {
216 $icon = match (
true) {
217 \in_array(
$user_id, $this->completed,
false) => $this->icons->renderIconForStatus(
220 \in_array(
$user_id, $this->in_progress,
false) => $this->icons->renderIconForStatus(
223 \in_array(
$user_id, $this->failed,
false) => $this->icons->renderIconForStatus(
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
join($init, callable $fn)
A simple class to express a naive range of whole positive numbers.
getProgressStatus(int $user_id)
sortedRecords(array $records, Order $order)
limitRecords(array $records, Range $range)
__construct(private readonly ilObjForum $forum, private readonly ilForumProperties $obj_properties, private readonly bool $has_general_lp_access, private readonly bool $has_rbac_or_position_access, private readonly ilObjUser $actor, private readonly UIFactory $ui_factory, private readonly HttpRequest $request, private readonly ilLanguage $lng,)
getRecords(Range $range, Order $order)
getRows(\ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters,)
readonly ilLPStatusIcons $icons
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
Caches and supplies the paths to the learning progress status images.
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
Class ilLPStatusWrapper This class is wrapper for all ilLPStatus classes.
static _lookupCompletedForObject(int $a_obj_id, ?array $a_user_ids=null)
static _lookupFailedForObject(int $a_obj_id, ?array $a_user_ids=null)
static _lookupInProgressForObject(int $a_obj_id, ?array $a_user_ids=null)
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
Base class for object lp connectors.
static getInstance(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static strCmp(string $a, string $b)
This describes a Data Table.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.