ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWikiContributorsTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected int $wiki_id;
27 protected \ILIAS\DI\UIServices $ui;
28
29 public function __construct(
30 object $a_parent_obj,
31 string $a_parent_cmd,
32 int $a_wiki_id
33 ) {
34 global $DIC;
35
36 $this->ctrl = $DIC->ctrl();
37 $this->lng = $DIC->language();
38 $ilCtrl = $DIC->ctrl();
39 $lng = $DIC->language();
40
41 parent::__construct($a_parent_obj, $a_parent_cmd);
42 $this->wiki_id = $a_wiki_id;
43
44 $this->addColumn("", "", "1");
45 //$this->addColumn("", "", "1");
46 $this->addColumn($lng->txt("wiki_contributors"), "", "33%");
47 $this->addColumn($lng->txt("wiki_page_changes"), "", "33%");
48 $this->addColumn($lng->txt("wiki_grading"), "", "33%");
49 $this->setEnableHeader(true);
50 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
51 $this->setRowTemplate(
52 "tpl.table_row_contributors.html",
53 "components/ILIAS/Wiki"
54 );
55 $this->getContributors();
56 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), "saveGrading"));
57 $this->addCommandButton("saveGrading", $lng->txt("save"));
58 //$this->addMultiCommand("saveGrading", $lng->txt("save"));
59
60 $this->setShowRowsSelector(true);
61
62 $this->setTitle($lng->txt("wiki_contributors"));
63 $this->ui = $DIC->ui();
64 }
65
66 public function getContributors(): void
67 {
68 $contributors = ilWikiPage::getWikiContributors($this->wiki_id);
69 $this->setDefaultOrderField("lastname");
70 $this->setDefaultOrderDirection("asc");
71 $this->setData($contributors);
72 }
73
74 protected function fillRow(array $a_set): void
75 {
77
78 if (ilObject::_exists($a_set["user_id"])) {
79 arsort($a_set["pages"]);
80
81 // pages
82 foreach ($a_set["pages"] as $page_id => $cnt) {
83 if ($page_id > 0) {
85 $this->tpl->setCurrentBlock("page");
86 $this->tpl->setVariable("PAGE", $title);
87 $this->tpl->setVariable("CNT", $cnt);
88 $this->tpl->parseCurrentBlock();
89 }
90 }
91
92 /*
93 $this->tpl->setVariable(
94 "TXT_LINKED_USER",
95 $user["lastname"] . ", " . $user["firstname"] . " [" . $login . "]"
96 );*/
97
98 // profile link
99 //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
100 //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
101 // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
102 //$this->tpl->setVariable("USER_LINK",
103 // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
104 $avatar = ilObjUser::_getAvatar((int) $a_set["user_id"]);
105 $this->tpl->setVariable("AVATAR", $this->ui->renderer()->render($avatar));
106 $this->tpl->setVariable(
107 "TXT_NAME",
108 htmlspecialchars($a_set["lastname"] . ", " . $a_set["firstname"])
109 );
110 $this->tpl->setVariable("USER_ID", $a_set["user_id"]);
111
112 // comment for learner
113 $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("wiki_comment_for_learner"));
114 $this->tpl->setVariable(
115 "NAME_LCOMMENT",
116 "lcomment[" . $a_set["user_id"] . "]"
117 );
118 $lpcomment = ilLPMarks::_lookupComment(
119 $a_set["user_id"],
120 $this->parent_obj->getObject()->getId()
121 );
122 $this->tpl->setVariable(
123 "VAL_LCOMMENT",
125 );
126
127 // status
128 //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $member_id);
129 $status = ilWikiContributor::_lookupStatus($this->parent_obj->getObject()->getId(), $a_set["user_id"]);
130 $this->tpl->setVariable("SEL_" . $status, ' selected="selected" ');
131 $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("wiki_notgraded"));
132 $this->tpl->setVariable("TXT_PASSED", $lng->txt("wiki_passed"));
133 $this->tpl->setVariable("TXT_FAILED", $lng->txt("wiki_failed"));
134 $this->tpl->setVariable("VAL_NOTGRADED", ilWikiContributor::STATUS_NOT_GRADED);
135 $this->tpl->setVariable("VAL_PASSED", ilWikiContributor::STATUS_PASSED);
136 $this->tpl->setVariable("VAL_FAILED", ilWikiContributor::STATUS_FAILED);
137 if (($sd = ilWikiContributor::_lookupStatusTime($this->parent_obj->getObject()->getId(), $a_set["user_id"])) > 0) {
138 $this->tpl->setCurrentBlock("status_date");
139 $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
140 $this->tpl->setVariable(
141 "VAL_STATUS_DATE",
143 );
144 $this->tpl->parseCurrentBlock();
145 }
146
148
149 switch ($status) {
151 $icon_rendered = $icons->renderIcon(
152 $icons->getImagePathCompleted(),
153 $lng->txt("wiki_passed")
154 );
155 break;
157 $icon_rendered = $icons->renderIcon(
158 $icons->getImagePathFailed(),
159 $lng->txt("wiki_failed")
160 );
161 break;
162 default:
163 $icon_rendered = $icons->renderIcon(
164 $icons->getImagePathNotAttempted(),
165 $lng->txt("wiki_notgraded")
166 );
167 break;
168 }
169
170 $this->tpl->setVariable("ICON_STATUS", $icon_rendered);
171
172 // mark
173 $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark"));
174 $this->tpl->setVariable(
175 "NAME_MARK",
176 "mark[" . $a_set["user_id"] . "]"
177 );
178 $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->getObject()->getId());
179
180 $this->tpl->setVariable(
181 "VAL_MARK",
183 );
184 }
185 }
186}
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static _lookupComment(int $a_usr_id, int $a_obj_id)
static _lookupMark(int $a_usr_id, int $a_obj_id)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
static _getAvatar(int $a_usr_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
ilLanguage $lng
static _lookupStatusTime(int $a_obj_id, int $a_user_id)
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_wiki_id)
fillRow(array $a_set)
Standard Version of Fill Row.
static lookupTitle(int $a_page_id, string $lang="-")
static getWikiContributors(int $a_wiki_id)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26