12 [
'name',
'name',
false,
true,
true],
13 [
'login',
'login',
false,
true,
true],
14 [
'prg_orgus',
'prg_orgus',
true,
true,
true],
15 [
'prg_status',
'prg_status',
false,
true,
true],
16 [
'prg_completion_date',
'prg_completion_date',
true,
true,
true],
17 [
'prg_completion_by',
'prg_completion_by',
true,
true,
true],
18 [
'points',
'prg_points_reachable',
false,
true,
false],
19 [
'points',
'prg_points_required',
false,
false,
true],
20 [
'points_current',
'prg_points_current',
false,
false,
true],
21 [
'prg_custom_plan',
'prg_custom_plan',
true,
true,
true],
22 [
'prg_belongs_to',
'prg_belongs_to',
true,
true,
true],
23 [
'prg_assign_date',
'prg_assign_date',
false,
true,
true],
24 [
'prg_assigned_by',
'prg_assigned_by',
true,
true,
true],
25 [
'prg_deadline',
'prg_deadline',
true,
true,
true],
26 [
'prg_expiry_date',
'prg_expiry_date',
true,
true,
true],
27 [
'prg_validity',
'prg_validity',
true,
true,
true],
28 [
null,
'action',
false,
true,
true]
95 string $template_context =
'',
98 \
ILIAS\Data\Factory $data_factory
100 $this->
setId(
"sp_member_list");
105 $this->data_factory = $data_factory;
111 $this->prg_has_lp_children =
$parent_obj->getStudyProgramme()->hasLPChildren();
114 $this->db =
$DIC[
'ilDB'];
115 $this->ui_factory =
$DIC[
'ui.factory'];
116 $this->ui_renderer =
$DIC[
'ui.renderer'];
123 $this->
setRowTemplate(
"tpl.members_table_row.html",
"Modules/StudyProgramme");
132 if ($this->may_edit_anything) {
137 foreach (self::COLUMNS as $column) {
138 list($col, $lng_var, $optional, $lp, $no_lp) = $column;
140 $show_by_lp = ($this->prg_has_lp_children && $lp) || (!$this->prg_has_lp_children && $no_lp);
141 $show_optional = !$optional || ($optional && array_key_exists($col, $selected));
143 if ($show_by_lp && $show_optional) {
144 $this->
addColumn($this->lng->txt($lng_var), $col);
164 $progress_ids = array_map(
166 return (
int) $row[
'prgrs_id'];
171 $parent_obj::F_ALL_PROGRESS_IDS,
172 implode(
',', $progress_ids)
186 'prg_status' =>
'status',
187 'prg_custom_plan' =>
'custom_plan',
188 'prg_belongs_to' =>
'belongs_to',
189 'prg_expiry_date' =>
'vq_date',
190 'prg_orgus' =>
'orgus',
191 'prg_completion_by' =>
'completion_by',
192 'prg_completion_date' =>
'completion_date',
197 list($aspect, $direction) = $order->join(
'',
function (
$i, $k, $v) {
201 if (array_key_exists($aspect, self::ORDER_MAPPING)) {
202 $aspect = self::ORDER_MAPPING[$aspect];
205 usort($list,
function (
$a,
$b) use ($aspect) {
206 if (is_numeric(
$a[$aspect])) {
207 return $a[$aspect] >
$b[$aspect];
209 return strcmp(
$a[$aspect],
$b[$aspect]);
212 if ($direction === $order::DESC) {
213 $list = array_reverse($list);
229 return $this->data_factory->order($field, strtoupper($direction));
239 $usr_id = (int) $a_set[
'usr_id'];
240 if ($this->may_edit_anything) {
241 $this->tpl->setCurrentBlock(
"checkb");
242 $this->tpl->setVariable(
"ID", $a_set[
"prgrs_id"]);
243 $this->tpl->parseCurrentBlock();
246 $this->tpl->setVariable(
"FIRSTNAME", $a_set[
"firstname"]);
247 $this->tpl->setVariable(
"LASTNAME", $a_set[
"lastname"]);
248 $this->tpl->setVariable(
"LOGIN", $a_set[
"login"]);
249 $this->tpl->setVariable(
252 in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of),
253 $this->prg->statusToRepr($a_set[
"status"])
256 $this->tpl->setVariable(
"ASSIGN_DATE", $a_set[
"prg_assign_date"]);
259 $this->tpl->setVariable(
"POINTS_REQUIRED", $a_set[
"points_required"]);
261 if (!$this->prg_has_lp_children) {
262 $this->tpl->setCurrentBlock(
"points_current");
263 $this->tpl->setVariable(
266 in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of),
267 $a_set[
'points_current']
270 $this->tpl->parseCurrentBlock();
277 $this->tpl->setVariable(
"ORGUS", $a_set[
"orgus"]);
279 case "prg_completion_date":
280 $completion_date =
'';
281 if (in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of)) {
282 $completion_date = $a_set[
"completion_date"];
284 $this->tpl->setVariable(
"COMPLETION_DATE", $completion_date);
287 case "prg_completion_by":
288 if (is_null($a_set[
"completion_by"])) {
289 $this->tpl->touchBlock(
"comp_by");
291 $this->tpl->setVariable(
294 in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of),
295 $a_set[
"completion_by"]
301 case "prg_custom_plan":
302 $individual = $this->lng->txt(
"no");
303 if ($a_set[
"individual"]) {
304 $individual = $this->lng->txt(
"yes");
307 $this->tpl->setVariable(
313 case "prg_belongs_to":
314 $this->tpl->setVariable(
"BELONGS_TO", $a_set[
"belongs_to"]);
316 case "prg_expiry_date":
317 $this->tpl->setVariable(
320 in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of),
325 case "prg_assigned_by":
326 $assigned_by = $a_set[
"prg_assigned_by"];
327 if (is_null($assigned_by)) {
329 $assignment_src = (int) $a_set[
'prg_assignment_origin'];
330 $assigned_by = $this->lng->txt(
'prg_autoassignment')
331 .
' ' . $this->lng->txt($srcs[$assignment_src]);
333 $this->tpl->setVariable(
"ASSIGNED_BY", $assigned_by);
336 if (is_null($a_set[
"prg_deadline"])) {
337 $this->tpl->touchBlock(
"deadline");
339 $this->tpl->setVariable(
342 in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of),
343 $a_set[
"prg_deadline"]
349 $this->tpl->setVariable(
352 in_array($usr_id, $this->user_ids_viewer_may_read_learning_progress_of),
353 $a_set[
'prg_validity']
360 $this->tpl->setVariable(
365 $a_set[
"assignment_id"],
396 foreach ($actions as $action) {
400 if (!$edit_individual_plan) {
405 if (!$view_individual_plan) {
411 if (!$addremove_users) {
418 $l->addItem($this->lng->txt(
"prg_$action"), $action, $target);
421 return $l->getHTML();
429 return $this->getParentObject()->getLinkTargetForAction($action, $prgrs_id, $ass_id);
440 $link = $this->ui_renderer->render($this->ui_factory->link()->standard($title,
$url));
444 $link = $del_data[
'title'];
466 .
"prgrs.id AS prgrs_id," . PHP_EOL
467 .
"pcp.firstname," . PHP_EOL
468 .
"pcp.lastname," . PHP_EOL
469 .
"pcp.login," . PHP_EOL
470 .
"pcp.usr_id," . PHP_EOL
471 .
"prgrs.usr_id," . PHP_EOL
472 .
"prgrs.points," . PHP_EOL
473 .
"prgrs.points_cur * ABS(prgrs.status - $accredited) /" . PHP_EOL
474 .
" (GREATEST(ABS(prgrs.status - $accredited),1))" . PHP_EOL
475 .
"+ prgrs.points * (1 - ABS(prgrs.status - $accredited) /" . PHP_EOL
476 .
" (GREATEST(ABS(prgrs.status - $accredited),1))) AS points_current," . PHP_EOL
477 .
"prgrs.last_change_by," . PHP_EOL
478 .
"prgrs.status," . PHP_EOL
479 .
"prgrs.individual," . PHP_EOL
480 .
"blngs.title AS belongs_to," . PHP_EOL
481 .
"cmpl_usr.login AS accredited_by," . PHP_EOL
482 .
"cmpl_obj.title AS completion_by," . PHP_EOL
483 .
"cmpl_obj.type AS completion_by_type," . PHP_EOL
484 .
"prgrs.completion_by AS completion_by_id," . PHP_EOL
485 .
"prgrs.assignment_id AS assignment_id," . PHP_EOL
486 .
"prgrs.completion_date," . PHP_EOL
487 .
"prgrs.vq_date," . PHP_EOL
488 .
"prgrs.deadline AS prg_deadline," . PHP_EOL
489 .
"ass.root_prg_id AS root_prg_id," . PHP_EOL
490 .
"ass.last_change AS prg_assign_date," . PHP_EOL
491 .
"ass.last_change_by AS prg_assingment_origin," . PHP_EOL
492 .
"ass_usr.login AS prg_assigned_by," . PHP_EOL
493 .
"CONCAT(pcp.firstname, pcp.lastname) AS name," . PHP_EOL
494 .
"prgrs.individual AS custom_plan" . PHP_EOL
497 $sql .= $this->getFrom();
498 $sql .= $this->getWhere($prg_id);
499 $sql .= $this->getFilterWhere($filter);
500 $sql .= $this->getOrguValidUsersFilter();
502 if ($limit !==
null) {
503 $this->db->setLimit($limit, $offset !==
null ? $offset : 0);
506 $res = $this->db->query($sql);
507 $now =
new DateTimeImmutable();
508 $members_list = array();
510 while ($rec = $this->db->fetchAssoc(
$res)) {
511 $progress_id = (int) $rec[
'prgrs_id'];
512 $progress = $this->sp_user_progress_db->get($progress_id);
514 $rec[
"actions"] = $this->getPossibleActions(
522 $rec[
'points_required'] = number_format($progress->getAmountOfPoints());
523 $rec[
'points_current'] = number_format($progress->getCurrentAmountOfPoints());
528 if ($rec[
"completion_by_type"] ==
"crsr") {
529 $completion_id = $rec[
"completion_by_id"];
532 $rec[
"completion_by"] = $this->getCompletionLink($obj_id, $ref_id);
538 if (!$rec[
"completion_by"]) {
539 $prgrs = $this->sp_user_progress_db->getByPrgIdAndAssignmentId(
541 $rec[
"assignment_id"]
546 $successful_children = $prg->getIdsOfSuccessfulChildren((
int) $rec[
"assignment_id"]);
547 foreach ($successful_children as $entry) {
548 list($obj_id, $ref_id) = $entry;
549 $links[] = $this->getCompletionLink($obj_id, $ref_id);
551 $rec[
"completion_by"] = implode(
", ", $links);
555 if (!$rec[
"completion_by"]) {
557 if (!is_null($title[
"title"])) {
558 $rec[
"completion_by"] = $title[
"title"];
562 $rec[
"completion_by"] = $rec[
"accredited_by"];
565 if (!$rec[
'completion_date']) {
566 $rec[
'completion_date'] =
'';
569 $rec[
'vq_date'] =
'';
570 if (!is_null($progress->getValidityOfQualification())
572 $rec[
'vq_date'] = $progress->getValidityOfQualification()->format($this->getUserDateFormat());
575 $rec[
'prg_validity'] =
'-';
576 if (!is_null($progress->hasValidQualification($now))) {
577 $rec[
'prg_validity'] = $this->lng->txt(
'prg_not_valid');
578 if ($progress->hasValidQualification($now)) {
579 $rec[
'prg_validity'] = $this->lng->txt(
'prg_still_valid');
583 $rec[
'prg_deadline'] =
null;
584 if ($progress->isSuccessful() ===
false
585 && !is_null($progress->getDeadline())
587 $rec[
'prg_deadline'] = $progress->getDeadline()->format($this->getUserDateFormat());
590 $usr_id = (int) $rec[
'usr_id'];
592 $members_list[] = $rec;
595 return $members_list;
605 $query =
"SELECT count(prgrs.id) as cnt" . PHP_EOL;
606 $query .= $this->getFrom();
607 $query .= $this->getWhere($prg_id);
608 $query .= $this->getFilterWhere($filter);
611 $rec = $this->db->fetchAssoc(
$res);
620 .
"JOIN usr_data pcp ON pcp.usr_id = prgrs.usr_id" . PHP_EOL
622 .
" ON ass.id = prgrs.assignment_id" . PHP_EOL
623 .
"JOIN object_data blngs ON blngs.obj_id = ass.root_prg_id" . PHP_EOL
624 .
"LEFT JOIN usr_data ass_usr ON ass_usr.usr_id = ass.last_change_by" . PHP_EOL
625 .
"LEFT JOIN usr_data cmpl_usr ON cmpl_usr.usr_id = prgrs.completion_by" . PHP_EOL
626 .
"LEFT JOIN object_data cmpl_obj ON cmpl_obj.obj_id = prgrs.completion_by" . PHP_EOL
635 $q =
"WHERE prgrs.prg_id = " . $this->db->quote($prg_id,
"integer") . PHP_EOL;
639 foreach ($this->permissions::ORGU_OPERATIONS as $op) {
640 $visible = array_merge(
642 $this->permissions->getUserIdsSusceptibleTo($op)
646 if (count($visible) > 0) {
647 $q .=
" AND " . $this->db->in(
"prgrs.usr_id", $visible,
false,
"integer") . PHP_EOL;
649 $q .=
" AND FALSE" . PHP_EOL;
660 foreach (self::COLUMNS as $column) {
661 list($col, $lng_var, $optional, $lp, $no_lp) = $column;
663 $cols[$col] = [
"txt" => $this->lng->txt($lng_var)];
675 foreach ($this->getMultiCommands() as $cmd => $caption) {
676 $this->addMultiCommand($cmd, $caption);
687 $permissions_for_edit_individual_plan = [
688 'updateFromCurrentPlanMulti' => $this->lng->txt(
'prg_multi_update_from_current_plan'),
689 'markRelevantMulti' => $this->lng->txt(
'prg_multi_mark_relevant'),
690 'markNotRelevantMulti' => $this->lng->txt(
'prg_multi_unmark_relevant'),
691 'changeDeadlineMulti' => $this->lng->txt(
'prg_multi_change_deadline'),
692 'changeExpireDateMulti' => $this->lng->txt(
'prg_multi_change_expire_date'),
693 'markAccreditedMulti' => $this->lng->txt(
'prg_multi_mark_accredited'),
694 'unmarkAccreditedMulti' => $this->lng->txt(
'prg_multi_unmark_accredited')
697 $permissions_for_manage = [
698 'removeUserMulti' => $this->lng->txt(
'prg_multi_remove_user')
704 $perms = array_merge($perms, $permissions_for_edit_individual_plan);
708 $perms = array_merge($perms, $permissions_for_manage);
726 if ($node_id == $root_prg_id) {
747 self::VALIDITY_OPTION_VALID => $this->lng->txt(
"prg_still_valid"),
748 self::VALIDITY_OPTION_INVALID => $this->lng->txt(
"prg_not_valid")
771 $item = $this->addFilterItemByMetaType(
'prg_validity', self::FILTER_SELECT);
773 [self::OPTION_ALL => $this->lng->txt(
"all")] + $this->getValidityOptions()
776 $item = $this->addFilterItemByMetaType(
'prg_status', self::FILTER_SELECT);
778 [self::OPTION_ALL => $this->lng->txt(
"all")] + $this->getStatusOptions()
781 $this->addFilterItemByMetaType(
'name', self::FILTER_TEXT);
782 $this->addFilterItemByMetaType(
'prg_expiry_date', self::FILTER_DATE_RANGE);
791 foreach ($this->filters as $item) {
792 $f[$item->getFieldId()] = $this->getFilterValue($item);
804 if (strlen($filter[
'name']) > 0) {
805 $name = substr($this->db->quote($filter[
'name'],
"text"), 1, -1);
808 .
'pcp.firstname LIKE \'%' .
$name .
'%\' OR' . PHP_EOL
809 .
'pcp.lastname LIKE \'%' .
$name .
'%\' OR' . PHP_EOL
810 .
'pcp.login LIKE \'%' .
$name .
'%\'' . PHP_EOL
814 $buf[] = $name_filter;
817 if ($filter[
'prg_status'] && (
int) $filter[
'prg_status'] !== self::OPTION_ALL) {
818 $buf[] =
'AND prgrs.status = ' . $this->db->quote($filter[
'prg_status'],
"integer");
821 $filter_success =
'prgrs.status IN ('
827 if ($filter[
'prg_validity'] && (
int) $filter[
'prg_validity'] !== self::OPTION_ALL) {
828 if ((
int) $filter[
'prg_validity'] === self::VALIDITY_OPTION_VALID) {
829 $filter_validity =
'AND (prgrs.vq_date >= NOW() OR prgrs.vq_date IS NULL)';
831 if ((
int) $filter[
'prg_validity'] === self::VALIDITY_OPTION_INVALID) {
832 $filter_validity =
'AND prgrs.vq_date < NOW()';
841 $exp_from = $filter[
'prg_expiry_date'][
'from'];
842 if (!is_null($exp_from)) {
846 .
'AND prgrs.vq_date >= \'' . $dat .
' 00:00:00\''
850 $exp_to = $filter[
'prg_expiry_date'][
'to'];
851 if (!is_null($exp_to)) {
855 .
'AND prgrs.vq_date <= \'' . $dat .
' 23:59:59\''
859 $conditions = implode(PHP_EOL, $buf);
867 return $this->prg->getPositionSettingsIsActiveForPrg();
872 if ($this->permissions->may($this->permissions::ROLEPERM_MANAGE_MEMBERS)) {
877 if (count($valid_user_ids) < 1) {
881 $valid_user_ids[] = $this->getParentObject()->user->getId();
882 return ' AND pcp.usr_id in ('
883 . implode(
',', $valid_user_ids)
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static getUserDateFormat($a_add_time=false, $a_for_parsing=false)
Parse current user setting into date/time format.
static _lookupTargetId($a_obj_id)
lookup target id
static _lookupTargetRefId($a_obj_id)
Lookup target ref_id.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
@ilCtrl_Calls ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI @ilCtrl_Calls ilObjS...
const ACTION_MARK_ACCREDITED
const ACTION_SHOW_INDIVIDUAL_PLAN
const ACTION_UNMARK_ACCREDITED
static getInstanceByRefId($a_ref_id)
static getInstanceByObjId($obj_id)
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
static _lookupTitle($a_id)
lookup object title
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
const OP_EDIT_INDIVIDUAL_PLAN
const OP_VIEW_INDIVIDUAL_PLAN
const OP_READ_LEARNING_PROGRESS
Both role and OrgU-based permissions are relevant in many places of the PRG.
Class ilObjStudyProgrammeMembersTableGUI.
$user_ids_viewer_may_read_learning_progress_of
isPermissionControlledByOrguPosition()
buildActionDropDown(array $actions, int $prgrs_id, int $ass_id, int $usr_id)
Builds the action menu for each row of the table.
const VALIDITY_OPTION_VALID
getLinkTargetForAction(string $action, int $prgrs_id, int $ass_id)
Get ilias link for action.
getSelectableColumns()
Get selectable columns.
getWhere(int $prg_id)
Get the sql part WHERE.
fetchData(int $prg_id, int $limit=null, int $offset=null, array $filter=[])
Get data for table.
fillRow($a_set)
Standard Version of Fill Row.
getFilterValues()
Get filter-values by field id.
getOrguValidUsersFilter()
getFilterWhere(array $filter)
Get the additional sql WHERE-part for filters.
initFilter()
Init filter.Overwrite this to initialize all filter input property objects.
addMultiCommands()
Add multicommands to table.
getCompletionLink(int $target_obj_id, int $target_ref_id)
getValueOrEmptyString(string $condition, string $value)
getValidityOptions()
Get options of filter "validity".
getPossibleActions(int $node_id, int $root_prg_id, int $status)
Get a list with possible actions on a progress record.
const VALIDITY_OPTION_INVALID
getMultiCommands()
Get possible multicommnds.
getStatusOptions()
Get options of filter "status".
__construct(int $prg_obj_id, int $prg_ref_id, ilObjStudyProgrammeMembersGUI $parent_obj, string $parent_cmd='', string $template_context='', ilStudyProgrammeProgressRepository $sp_user_progress_db, ilPRGPermissionsHelper $permissions, \ILIAS\Data\Factory $data_factory)
postOrder(array $list, \ILIAS\Data\Order $order)
countFetchData(int $prg_id, array $filter=[])
Get maximum number of rows the table could have.
Class ilStudyProgrammeProgress.
const STATUS_NOT_RELEVANT
addHiddenInput($a_name, $a_value)
Add Hidden Input field.
getSelectedColumns()
Get selected columns.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
setEnableHeader($a_enableheader)
Set Enable Header.
setExternalSorting($a_val)
Set external sorting.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getParentObject()
Get parent object.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setEnableAllCommand($a_value)
Enable actions for all entries in current result.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
getDefaultOrderDirection()
Get Default order direction.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setExternalSegmentation($a_val)
Set external segmentation.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
determineLimit()
Determine the limit.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
getDefaultOrderField()
Get Default order field.
getOrderDirection()
Get order direction.
setMaxCount($a_max_count)
set max.
Covers the persistence of settings belonging to a study programme (SP).
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
foreach($_POST as $key=> $value) $res