19 declare(strict_types=1);
35 [
'name',
'name',
false,
true,
true],
36 [
'login',
'login',
false,
true,
true],
37 [
'prg_status',
'prg_status',
false,
true,
true],
38 [
'prg_completion_date',
'prg_completion_date',
true,
true,
true],
39 [
'prg_completion_by',
'prg_completion_by',
true,
true,
true],
40 [
'points',
'prg_points_reachable',
false,
true,
false],
41 [
'points_required',
'prg_points_required',
false,
false,
true],
42 [
'points_current',
'prg_points_current',
false,
false,
true],
43 [
'prg_custom_plan',
'prg_custom_plan',
true,
true,
true],
44 [
'prg_belongs_to',
'prg_belongs_to',
true,
true,
true],
45 [
'prg_assign_date',
'prg_assign_date',
false,
true,
true],
46 [
'prg_assigned_by',
'prg_assigned_by',
true,
true,
true],
47 [
'prg_deadline',
'prg_deadline',
true,
true,
true],
48 [
'prg_expiry_date',
'prg_expiry_date',
true,
true,
true],
49 [
'prg_validity',
'prg_validity',
true,
true,
true]
53 'prg_status' =>
'status',
54 'prg_custom_plan' =>
'custom_plan',
55 'prg_belongs_to' =>
'belongs_to',
56 'prg_validity' =>
'validity',
57 'prg_orgus' =>
'orgus',
58 'prg_completion_by' =>
'completion_by',
59 'prg_completion_date' =>
'completion_date',
60 'prg_assign_date' =>
'assign_date',
61 'prg_assigned_by' =>
'assigned_by',
62 'prg_deadline' =>
'deadline',
63 'prg_expiry_date' =>
'expiry_date',
64 'pgs_id' =>
'prgrs_id' 77 $this->
lng->loadLanguageModule(
"prg");
78 $this->user_ids_viewer_may_read_learning_progress_of = $this->permissions->getUserIdsSusceptibleTo(
86 $user_data_cols = $this->export_fields_info->getSelectableFieldsInfo($prg_id);
87 foreach ($user_data_cols as $k => $column_definition) {
88 $cols[$k] = [$k, $column_definition[
'txt'],
true,
true,
true];
96 foreach (self::PRG_COLS as $k) {
97 $k[1] = $this->
lng->txt($k[1]);
106 bool $add_active_column =
false,
107 bool $add_cert_column =
false 110 $prg_cols_pre = array_slice($prg_cols, 0, 2);
111 $prg_cols_post = array_slice($prg_cols, 2);
113 $columns = array_merge(
119 if ($add_active_column) {
120 $columns[
"active"] = [
"active", $this->
lng->txt(
"active"),
true,
true,
true];
122 if ($add_cert_column) {
123 $columns[
"cert_relevance"] = [
"cert_relevance", $this->
lng->txt(
"cert_relevance"),
true,
true,
true];
131 return $this->assignment_repo->countAllForNodeIsContained($prg_id, $valid_user_ids, $custom_filters);
140 ?array $valid_user_ids,
146 $data = $this->assignment_repo->getAllForNodeIsContained(
152 $root_assignemnts = array_filter(
154 fn($ass) => $ass->getRootId() === $prg_id
156 $root_usr_ids =
array_map(fn(
$r) =>
$r->getUserid(), $root_assignemnts);
157 $cert_ass_ids = $this->assignment_repo->getCertificateRelevantAssignmentIds(
165 $offset = $offset ?? 0;
166 $rows = array_slice($rows, $offset, $limit);
173 $data = $this->assignment_repo->getForUser($usr_id);
182 $this->skip_perm_check_on_user = $flag;
187 return $this->skip_perm_check_on_user
188 || in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of);
205 $points_reachable = (string) $pgs->getPossiblePointsOfRelevantChildren();
207 $points_reachable = (string) $pgs->getAmountOfPoints();
210 $prg_lifecycle_status = $prg_node->getStatus();
220 ->withStatusRaw($pgs->getStatus())
221 ->withCompletionDate(
227 ->withCompletionByObjIds(
230 ->withPointsReachable($points_reachable)
231 ->withPointsRequired((
string) $pgs->getAmountOfPoints())
232 ->withPointsCurrent($show_lp ? (
string) $pgs->getCurrentAmountOfPoints() :
'')
233 ->withCustomPlan($this->
boolToRepresent($pgs->hasIndividualModifications()))
234 ->withBelongsTo($this::lookupTitle($ass->
getRootId()))
235 ->withAssignmentDate($pgs->getAssignmentDate()->format($this->
getUserDateFormat()))
246 $show_lp && $pgs->getValidityOfQualification() ? $pgs->getValidityOfQualification()->format($this->
getUserDateFormat()) :
'' 250 ->withNodeLifecycleStatus($prg_lifecycle_status)
251 ->withCertificateRelevance(
252 in_array($ass->
getId(), $cert_ass_ids)
253 && $this->cert_validator->isCertificateDownloadable($ass->
getUserId(), $ass->
getRootId())
270 return $this->
lng->txt(
"prg_status_in_progress");
273 return $this->
lng->txt(
"prg_status_completed");
276 return $this->
lng->txt(
"prg_status_accredited");
279 return $this->
lng->txt(
"prg_status_not_relevant");
282 return $this->
lng->txt(
"prg_status_failed");
284 throw new ilException(
"Unknown status: '$a_status'");
289 return ($value) ? $this->
lng->txt(
"yes") : $this->
lng->txt(
"no");
297 return $pgs->
isInvalidated() ? $this->
lng->txt(
"prg_not_valid") : $this->
lng->txt(
"prg_still_valid");
302 return $value ? $this->
lng->txt(
'active') : $this->
lng->txt(
'inactive');
309 if ($manually || ! array_key_exists($assignment_src, $srcs)) {
310 return $this::lookupTitle($assignment_src);
312 return implode(
' ', [
313 $this->
lng->txt(
'prg_autoassignment'),
314 $this->
lng->txt($srcs[$assignment_src])
322 return $this::lookupTitle($completion_by);
326 fn(
int $node_obj_id):
string => self::lookupTitle($node_obj_id),
330 return implode(
', ',
$out);
337 return [$completion_by];
339 $successful_subnodes = array_filter(
358 return sprintf(
'(%s)', $title);
364 $target_ref_id = array_shift($refs) ??
null;
366 return sprintf(
'(%s)', $title);
372 return sprintf(
'(%s)', $del[
'title']);
374 return 'object id ' . $obj_id;
379 [$aspect, $direction] = $order->join(
'',
function ($i, $k, $v) {
383 if (array_key_exists($aspect, self::ORDER_MAPPING)) {
384 $aspect = self::ORDER_MAPPING[$aspect];
392 if (is_numeric($a[$aspect])) {
393 return $a[$aspect] <=> $b[$aspect];
395 if (is_bool($a[$aspect])) {
396 return (
int) $a[$aspect] <=> (
int) $b[$aspect];
399 if (in_array($aspect, [
405 return \DateTimeImmutable::createFromFormat($user_date_format, $a[$aspect])
406 <=> \DateTimeImmutable::createFromFormat($user_date_format, $b[$aspect]);
408 return strcmp($a[$aspect], $b[$aspect]);
411 if ($direction === $order::DESC) {
412 $list = array_reverse($list);
ilStudyProgrammeUserTable provides a flattened list of progresses at a programme-node.
const array $user_ids_viewer_may_read_learning_progress_of
includeLearningProgress(int $usr_id)
fetchData(int $prg_id, ?array $valid_user_ids, Order $order, ?ilPRGAssignmentFilter $custom_filters=null, ?int $limit=null, ?int $offset=null)
getColumns(int $prg_id, bool $add_active_column=false, bool $add_cert_column=false)
Interface Observer Contains several chained tasks and infos about them.
static _getAllReferences(int $id)
get all reference ids for object ID
boolToRepresent(bool $value)
completionByToRepresent(ilPRGProgress $progress)
static getUserDateFormat(int $a_add_time=0, bool $a_for_parsing=false)
Parse current user setting into date/time format.
static lookupTitle(int $obj_id)
assignmentSourceToRepresent(bool $manually, int $assignment_src)
const VALIDITY_OPTION_INVALID
Both the subject and the direction need to be specified when expressing an order. ...
statusToRepresent($a_status)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
disablePermissionCheck($flag=false)
toRow(ilPRGAssignment $ass, int $node_id, array $cert_ass_ids)
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
const OP_READ_LEARNING_PROGRESS
validToRepresent(ilPRGProgress $pgs)
static _lookupTitle(int $obj_id)
const AUTO_ASSIGNED_BY_RESTART
const VALIDITY_OPTION_VALID
Validates if an active certificate is stored in the database and can be downloaded by the user...
static _isInTrash(int $ref_id)
completionByToCollection(ilPRGProgress $progress)
const STATUS_NOT_RELEVANT
countFetchData(int $prg_id, ?array $valid_user_ids, ilPRGAssignmentFilter $custom_filters)
Both role and OrgU-based permissions are relevant in many places of the PRG.
static getInstanceByObjId(int $obj_id)
const OPTION_USR_INACTIVE
ilStudyProgrammeUserTable provides a flattened list of progresses at a programme-node.
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
static getRefIdFor(int $obj_id)
__construct(protected ilDBInterface $db, protected ilExportFieldsInfo $export_fields_info, protected ilPRGAssignmentDBRepository $assignment_repo, protected ilLanguage $lng, protected ilPRGPermissionsHelper $permissions, protected ilCertificateDownloadValidator $cert_validator)
static get(int $a_object_id)
getProgressForNode(int $node_id)
const COMPLETED_BY_SUBNODES
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
static _lookupType(int $id, bool $reference=false)
fetchSingleUserRootAssignments(int $usr_id)
postOrder(array $list, \ILIAS\Data\Order $order)
activeToRepresent(bool $value)
getUserDataColumns(int $prg_id)