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]
80 string $template_context =
'',
84 $this->
setId(
"sp_member_list");
89 $this->position_based_access = $position_based_access;
95 $this->db = $DIC[
'ilDB'];
96 $this->ui_factory = $DIC[
'ui.factory'];
97 $this->ui_renderer = $DIC[
'ui.renderer'];
105 $this->
setRowTemplate(
"tpl.members_table_row.html",
"Modules/StudyProgramme");
107 $this->
setFormAction($this->ctrl->getFormAction($parent_obj,
"view"));
114 foreach (self::COLUMNS as $column) {
115 list($col, $lng_var, $optional, $lp, $no_lp) = $column;
117 $show_by_lp = ($this->prg_has_lp_children && $lp) || (!$this->prg_has_lp_children && $no_lp);
118 $show_optional = !$optional || ($optional && array_key_exists($col, $selected));
120 if ($show_by_lp && $show_optional) {
121 $this->
addColumn($this->lng->txt($lng_var), $col);
149 $usr_id = (int) $a_set[
'usr_id'];
151 $may_read_learning_progress =
152 !$this->prg->getAccessControlByOrguPositionsGlobal() ||
156 $this->tpl->setCurrentBlock(
"checkb");
157 $this->tpl->setVariable(
"ID", $a_set[
"prgrs_id"]);
158 $this->tpl->parseCurrentBlock();
159 $this->tpl->setVariable(
"FIRSTNAME", $a_set[
"firstname"]);
160 $this->tpl->setVariable(
"LASTNAME", $a_set[
"lastname"]);
161 $this->tpl->setVariable(
"LOGIN", $a_set[
"login"]);
162 $this->tpl->setVariable(
165 $may_read_learning_progress,
166 $this->sp_user_progress_db->statusToRepr($a_set[
"status"])
169 $this->tpl->setVariable(
"POINTS_REQUIRED", $a_set[
"points"]);
170 $this->tpl->setVariable(
"ASSIGN_DATE", $a_set[
"prg_assign_date"]);
172 if (!$this->prg_has_lp_children) {
173 $this->tpl->setCurrentBlock(
"points_current");
174 $this->tpl->setVariable(
178 $this->tpl->parseCurrentBlock();
184 $this->tpl->setVariable(
"ORGUS", $a_set[
"orgus"]);
186 case "prg_completion_date":
187 $completion_date =
'';
188 if ($may_read_learning_progress) {
189 $completion_date = $a_set[
"completion_date"];
191 $this->tpl->setVariable(
"COMPLETION_DATE", $completion_date);
193 case "prg_completion_by":
194 if (is_null($a_set[
"completion_by"])) {
195 $this->tpl->touchBlock(
"comp_by");
197 $this->tpl->setVariable(
200 $may_read_learning_progress,
201 $a_set[
"completion_by"]
207 case "prg_custom_plan":
208 $has_changers = $this->lng->txt(
"no");
209 if ($a_set[
"last_change_by"]) {
210 $has_changers = $this->lng->txt(
"yes");
213 $this->tpl->setVariable(
218 case "prg_belongs_to":
219 $this->tpl->setVariable(
"BELONGS_TO", $a_set[
"belongs_to"]);
221 case "prg_expiry_date":
222 $this->tpl->setVariable(
227 case "prg_assigned_by":
228 $assigned_by = $a_set[
"prg_assigned_by"];
229 if (is_null($assigned_by)) {
231 $assignment_src = (int) $a_set[
'prg_assignment_origin'];
232 $assigned_by = $this->lng->txt(
'prg_autoassignment')
233 .
' ' . $this->lng->txt($srcs[$assignment_src]);
235 $this->tpl->setVariable(
"ASSIGNED_BY", $assigned_by);
238 if (is_null($a_set[
"prg_deadline"])) {
239 $this->tpl->touchBlock(
"deadline");
241 $this->tpl->setVariable(
244 $may_read_learning_progress,
245 $a_set[
"prg_deadline"]
251 $this->tpl->setVariable(
254 $may_read_learning_progress,
255 $a_set[
'prg_validity']
262 $this->tpl->setVariable(
267 $a_set[
"assignment_id"],
296 $view_individual_plan = $parent->isOperationAllowedForUser(
301 $edit_individual_plan = $parent->isOperationAllowedForUser(
307 foreach ($actions as $action) {
311 if (!$edit_individual_plan) {
316 if (!$view_individual_plan) {
325 if (!$manage_members) {
331 $l->addItem($this->lng->txt(
"prg_$action"), $action, $target);
334 return $l->getHTML();
342 return $this->
getParentObject()->getLinkTargetForAction($action, $prgrs_id, $ass_id);
363 .
"prgrs.id AS prgrs_id," . PHP_EOL
364 .
"pcp.firstname," . PHP_EOL
365 .
"pcp.lastname," . PHP_EOL
366 .
"pcp.login," . PHP_EOL
367 .
"pcp.usr_id," . PHP_EOL
368 .
"prgrs.usr_id," . PHP_EOL
369 .
"prgrs.points," . PHP_EOL
370 .
"prgrs.points_cur * ABS(prgrs.status - $accredited) /" . PHP_EOL
371 .
" (GREATEST(ABS(prgrs.status - $accredited),1))" . PHP_EOL
372 .
"+ prgrs.points * (1 - ABS(prgrs.status - $accredited) /" . PHP_EOL
373 .
" (GREATEST(ABS(prgrs.status - $accredited),1))) AS points_current," . PHP_EOL
374 .
"prgrs.last_change_by," . PHP_EOL
375 .
"prgrs.status," . PHP_EOL
376 .
"blngs.title AS belongs_to," . PHP_EOL
377 .
"cmpl_usr.login AS accredited_by," . PHP_EOL
378 .
"cmpl_obj.title AS completion_by," . PHP_EOL
379 .
"cmpl_obj.type AS completion_by_type," . PHP_EOL
380 .
"prgrs.completion_by AS completion_by_id," . PHP_EOL
381 .
"prgrs.assignment_id AS assignment_id," . PHP_EOL
382 .
"prgrs.completion_date," . PHP_EOL
383 .
"prgrs.vq_date," . PHP_EOL
384 .
"prgrs.deadline AS prg_deadline," . PHP_EOL
385 .
"ass.root_prg_id AS root_prg_id," . PHP_EOL
386 .
"ass.last_change AS prg_assign_date," . PHP_EOL
387 .
"ass.last_change_by AS prg_assingment_origin," . PHP_EOL
388 .
"ass_usr.login AS prg_assigned_by," . PHP_EOL
389 .
"CONCAT(pcp.firstname, pcp.lastname) AS name," . PHP_EOL
390 .
"(prgrs.last_change_by IS NOT NULL) AS custom_plan" . PHP_EOL
402 $res = $this->db->query($sql);
403 $now = (
new DateTime())->format(
'Y-m-d H:i:s');
404 $members_list = array();
407 while ($rec = $this->db->fetchAssoc(
$res)) {
414 $rec[
'points_current'] = number_format($rec[
'points_current']);
418 if ($rec[
"completion_by_type"] ==
"crsr") {
419 $completion_id = $rec[
"completion_by_id"];
427 $link = $this->ui_factory->link()->standard(
$title,
$url);
428 $rec[
"completion_by"] = $this->ui_renderer->render($link);
430 $rec[
"completion_by"] =
$title;
437 if (!$rec[
"completion_by"]) {
438 $prgrs = $this->sp_user_progress_db->getInstanceForAssignment(
440 $rec[
"assignment_id"]
443 $rec[
"completion_by"] = implode(
445 $prgrs->getNamesOfCompletedOrAccreditedChildren()
450 if (!$rec[
"completion_by"]) {
452 if (!is_null(
$title[
"title"])) {
453 $rec[
"completion_by"] =
$title[
"title"];
457 $rec[
"completion_by"] = $rec[
"accredited_by"];
460 if (!$rec[
'completion_date']) {
461 $rec[
'completion_date'] =
'';
464 if ($rec[
'vq_date']) {
465 $rec[
'prg_validity'] = $this->lng->txt(
'prg_not_valid');
466 if ($rec[
"vq_date"] > $now) {
467 $rec[
'prg_validity'] = $this->lng->txt(
'prg_still_valid');
470 $rec[
'prg_validity'] =
'';
471 $rec[
'vq_date'] =
'';
474 $usr_id = (int) $rec[
'usr_id'];
476 $members_list[] = $rec;
479 return $members_list;
489 $query =
"SELECT count(prgrs.id) as cnt" . PHP_EOL;
495 $rec = $this->db->fetchAssoc(
$res);
504 .
"JOIN usr_data pcp ON pcp.usr_id = prgrs.usr_id" . PHP_EOL
506 .
" ON ass.id = prgrs.assignment_id" . PHP_EOL
507 .
"JOIN object_data blngs ON blngs.obj_id = ass.root_prg_id" . PHP_EOL
508 .
"LEFT JOIN usr_data ass_usr ON ass_usr.usr_id = ass.last_change_by" . PHP_EOL
509 .
"LEFT JOIN usr_data cmpl_usr ON cmpl_usr.usr_id = prgrs.completion_by" . PHP_EOL
510 .
"LEFT JOIN object_data cmpl_obj ON cmpl_obj.obj_id = prgrs.completion_by" . PHP_EOL
519 $q =
"WHERE prgrs.prg_id = " . $this->db->quote($prg_id,
"integer") . PHP_EOL;
521 if ($this->prg->getAccessControlByOrguPositionsGlobal() && !$this->parent_obj->mayManageMembers()) {
523 if (count($visible) > 0) {
524 $q .=
" AND " . $this->db->in(
"prgrs.usr_id", $visible,
false,
"integer") . PHP_EOL;
526 $q .=
" AND FALSE" . PHP_EOL;
539 foreach (self::COLUMNS as $column) {
540 list($col, $lng_var, $optional, $lp, $no_lp) = $column;
542 $cols[$col] = [
"txt" => $this->lng->txt($lng_var)];
567 if ($access_by_position) {
568 $edit_individual_plan = count($this->
getParentObject()->editIndividualPlan()) > 0;
569 $manage_members = count($this->
getParentObject()->manageMembers()) > 0;
571 $edit_individual_plan =
true;
572 $manage_members =
true;
576 if ($edit_individual_plan) {
577 $perms[
'markAccreditedMulti'] = $this->lng->txt(
'prg_multi_mark_accredited');
578 $perms[
'unmarkAccreditedMulti'] = $this->lng->txt(
'prg_multi_unmark_accredited');
581 if ($manage_members) {
582 $perms[
'removeUserMulti'] = $this->lng->txt(
'prg_multi_remove_user');
584 $perms = array_merge(
587 'markRelevantMulti' => $this->lng->txt(
'prg_multi_mark_relevant'),
588 'markNotRelevantMulti' => $this->lng->txt(
'prg_multi_unmark_relevant'),
589 'updateFromCurrentPlanMulti' => $this->lng->txt(
'prg_multi_update_from_current_plan'),
590 'changeDeadlineMulti' => $this->lng->txt(
'prg_multi_change_deadline'),
591 'changeExpireDateMulti' => $this->lng->txt(
'prg_multi_change_expire_date')
604 self::VALIDITY_OPTION_VALID => $this->lng->txt(
"prg_still_valid"),
605 self::VALIDITY_OPTION_RENEWAL_REQUIRED => $this->lng->txt(
"prg_not_valid")
648 foreach ($this->filters as $item) {
661 if (strlen($filter[
'name']) > 0) {
662 $name = substr($this->db->quote($filter[
'name'],
"text"), 1, -1);
665 .
'pcp.firstname LIKE \'%' .
$name .
'%\' OR' . PHP_EOL
666 .
'pcp.lastname LIKE \'%' .
$name .
'%\' OR' . PHP_EOL
667 .
'pcp.login LIKE \'%' .
$name .
'%\'' . PHP_EOL
671 $buf[] = $name_filter;
674 if ($filter[
'prg_status'] && (
int) $filter[
'prg_status'] !== self::OPTION_ALL) {
675 $buf[] =
'AND prgrs.status = ' . $this->db->quote($filter[
'prg_status'],
"integer");
678 if ($filter[
'prg_validity'] && (
int) $filter[
'prg_validity'] !== self::OPTION_ALL) {
680 if ((
int) $filter[
'prg_validity'] === self::VALIDITY_OPTION_VALID) {
683 $buf[] =
'AND prgrs.vq_date ' . $operator .
' NOW()';
686 $exp_from = $filter[
'prg_expiry_date'][
'from'];
687 if (!is_null($exp_from)) {
689 $buf[] =
'AND prgrs.vq_date >= \'' . $dat .
' 00:00:00\'';
692 $exp_to = $filter[
'prg_expiry_date'][
'to'];
693 if (!is_null($exp_to)) {
695 $buf[] =
'AND prgrs.vq_date <= \'' . $dat .
' 23:59:59\'';
698 $conditions = implode(PHP_EOL, $buf);
707 $this->prg->getAccessControlByOrguPositionsGlobal()
709 $this->prg->getPositionSettingsIsActiveForPrg()
719 $valid_user_ids = $this->position_based_access->getUsersInPrgAccessibleForOperation(
723 if (count($valid_user_ids) < 1) {
726 return ' AND pcp.usr_id in (' 727 . implode(
',', $valid_user_ids)
const OP_VIEW_INDIVIDUAL_PLAN
getStudyProgramme(int $ref_id=null)
Get studyprogramm object for ref_id Use this ref_id if argument is null.
static _lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
setExternalSorting($a_val)
Set external sorting.
getOrguValidUsersFilter()
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getSelectableColumns()
Get selectable columns.
getValueOrEmptyString(string $condition, string $value)
getFilterValue(ilFormPropertyGUI $a_item)
Get current filter value.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
__construct(int $prg_obj_id, int $prg_ref_id, ilObjStudyProgrammeMembersGUI $parent_obj, string $parent_cmd='', string $template_context='', ilStudyProgrammeUserProgressDB $sp_user_progress_db, ilStudyProgrammePositionBasedAccess $position_based_access)
setExternalSegmentation($a_val)
Set external segmentation.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
Storage implementation for ilStudyProgrammeUserProgress.
determineLimit()
Determine the limit.
getOrderDirection()
Get order direction.
getWhere(int $prg_id)
Get the sql part WHERE.
getStatusOptions()
Get options of filter "status".
const VALIDITY_OPTION_RENEWAL_REQUIRED
getParentObject()
Get parent object.
Class ilObjStudyProgrammeMembersTableGUI.
isPermissionControlledByOrguPosition()
static getInstanceByRefId($a_ref_id)
const ACTION_SHOW_INDIVIDUAL_PLAN
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
foreach($_POST as $key=> $value) $res
static _lookupTitle($a_obj_id)
Overwitten from base class.
getFilterValues()
Get filter-values by field id.
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.
const ACTION_UNMARK_ACCREDITED
addMultiCommand($a_cmd, $a_text)
Add Command button.
addMultiCommands()
Add multicommands to table.
getFilterWhere(array $filter)
Get the additional sql WHERE-part for filters.
getSelectedColumns()
Get selected columns.
ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI ilObjStudyProgrammeMembersGUI: il...
const STATUS_NOT_RELEVANT
setEnableAllCommand($a_value)
Enable actions for all entries in current result.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
buildActionDropDown(array $actions, int $prgrs_id, int $ass_id, int $usr_id)
Builds the action menu for each row of the table.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
getLinkTargetForAction(string $action, int $prgrs_id, int $ass_id)
Get ilias link for action.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
getValidityOptions()
Get options of filter "validity".
countFetchData(int $prg_id, array $filter=[])
Get maximum number of rows the table could have.
static getPossibleActions(int $node_id, int $root_prg_id, int $status)
Get a list with possible actions on a progress record.
__construct(Container $dic, ilPlugin $plugin)
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
setMaxCount($a_max_count)
set max.
static _lookupTargetRefId($a_obj_id)
Lookup target ref_id.
setEnableTitle($a_enabletitle)
Set Enable Title.
const VALIDITY_OPTION_VALID
const ACTION_MARK_ACCREDITED
fetchData(int $prg_id, int $limit=null, int $offset=null, string $order_column=null, string $order_direction=null, array $filter=[])
Get data for table.
getMultiCommands()
Get possible multicommnds.