ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilWikiContributorsTableGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once("Services/Table/classes/class.ilTable2GUI.php");
25
35{
36 public function __construct(
37 $a_parent_obj,
38 $a_parent_cmd = "",
39 $a_wiki_id
40 ) {
41 global $DIC;
42
43 $this->ctrl = $DIC->ctrl();
44 $this->lng = $DIC->language();
45 $ilCtrl = $DIC->ctrl();
46 $lng = $DIC->language();
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49 $this->wiki_id = $a_wiki_id;
50
51 $this->addColumn("", "", "1");
52 //$this->addColumn("", "", "1");
53 $this->addColumn($lng->txt("wiki_contributor"), "", "33%");
54 $this->addColumn($lng->txt("wiki_page_changes"), "", "33%");
55 $this->addColumn($lng->txt("wiki_grading"), "", "33%");
56 $this->setEnableHeader(true);
57 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
58 $this->setRowTemplate(
59 "tpl.table_row_contributors.html",
60 "Modules/Wiki"
61 );
62 $this->getContributors();
63 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), "saveGrading"));
64 $this->addCommandButton("saveGrading", $lng->txt("save"));
65 //$this->addMultiCommand("saveGrading", $lng->txt("save"));
66
67 $this->setShowRowsSelector(true);
68
69 $this->setTitle($lng->txt("wiki_contributors"));
70 }
71
75 public function getContributors()
76 {
77 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
78 $contributors = ilWikiPage::getWikiContributors($this->wiki_id);
79 $this->setDefaultOrderField("lastname");
80 $this->setDefaultOrderDirection("asc");
81 $this->setData($contributors);
82 }
83
88 protected function fillRow($a_set)
89 {
91 $ilCtrl = $this->ctrl;
93
94 include_once("./Services/Tracking/classes/class.ilLPMarks.php");
95 include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
96
97 if (ilObject::_exists($a_set["user_id"])) {
98 arsort($a_set["pages"]);
99
100 // pages
101 foreach ($a_set["pages"] as $page_id => $cnt) {
102 if ($page_id > 0) {
103 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
105 $this->tpl->setCurrentBlock("page");
106 $this->tpl->setVariable("PAGE", $title);
107 $this->tpl->setVariable("CNT", $cnt);
108 $this->tpl->parseCurrentBlock();
109 }
110 }
111
112 $this->tpl->setVariable(
113 "TXT_LINKED_USER",
114 $user["lastname"] . ", " . $user["firstname"] . " [" . $login . "]"
115 );
116
117 // profile link
118 //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
119 //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
120 // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
121 //$this->tpl->setVariable("USER_LINK",
122 // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
123 $img = ilObjUser::_getPersonalPicturePath($a_set["user_id"], "xsmall");
124 $this->tpl->setVariable("IMG_USER", $img);
125 $this->tpl->setVariable(
126 "TXT_NAME",
127 htmlspecialchars($a_set["lastname"] . ", " . $a_set["firstname"])
128 );
129 $this->tpl->setVariable("USER_ID", $a_set["user_id"]);
130
131 // comment for learner
132 $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("wiki_comment_for_learner"));
133 $this->tpl->setVariable(
134 "NAME_LCOMMENT",
135 "lcomment[" . $a_set["user_id"] . "]"
136 );
137 $lpcomment = ilLPMarks::_lookupComment(
138 $a_set["user_id"],
139 $this->parent_obj->object->getId()
140 );
141 $this->tpl->setVariable(
142 "VAL_LCOMMENT",
143 ilUtil::prepareFormOutput($lpcomment)
144 );
145
146 // status
147 //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $member_id);
148 $status = ilWikiContributor::_lookupStatus($this->parent_obj->object->getId(), $a_set["user_id"]);
149 $this->tpl->setVariable("SEL_" . $status, ' selected="selected" ');
150 $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("wiki_notgraded"));
151 $this->tpl->setVariable("TXT_PASSED", $lng->txt("wiki_passed"));
152 $this->tpl->setVariable("TXT_FAILED", $lng->txt("wiki_failed"));
153 $this->tpl->setVariable("VAL_NOTGRADED", ilWikiContributor::STATUS_NOT_GRADED);
154 $this->tpl->setVariable("VAL_PASSED", ilWikiContributor::STATUS_PASSED);
155 $this->tpl->setVariable("VAL_FAILED", ilWikiContributor::STATUS_FAILED);
156 if (($sd = ilWikiContributor::_lookupStatusTime($this->parent_obj->object->getId(), $a_set["user_id"])) > 0) {
157 $this->tpl->setCurrentBlock("status_date");
158 $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
159 $this->tpl->setVariable(
160 "VAL_STATUS_DATE",
162 );
163 $this->tpl->parseCurrentBlock();
164 }
165
167
168 switch ($status) {
170 $icon_rendered = $icons->renderIcon(
171 $icons->getImagePathCompleted(),
172 $lng->txt("wiki_passed")
173 );
174 break;
176 $icon_rendered = $icons->renderIcon(
177 $icons->getImagePathFailed(),
178 $lng->txt("wiki_failed")
179 );
180 break;
181 default:
182 $icon_rendered = $icons->renderIcon(
183 $icons->getImagePathNotAttempted(),
184 $lng->txt("wiki_notgraded")
185 );
186 break;
187 }
188
189 $this->tpl->setVariable("ICON_STATUS", $icon_rendered);
190
191 // mark
192 $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark"));
193 $this->tpl->setVariable(
194 "NAME_MARK",
195 "mark[" . $a_set["user_id"] . "]"
196 );
197 $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->object->getId());
198
199 $this->tpl->setVariable(
200 "VAL_MARK",
202 );
203 }
204 }
205}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static _lookupMark($a_usr_id, $a_obj_id)
static _lookupComment($a_usr_id, $a_obj_id)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false, $html_export=false)
Get path to personal picture.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static _lookupStatusTime($a_obj_id, $a_user_id)
Lookup last change in mark or success status.
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
TableGUI class for listing users that contributed to the wiki.
fillRow($a_set)
Standard Version of Fill Row.
__construct( $a_parent_obj, $a_parent_cmd="", $a_wiki_id)
ilTable2GUI constructor.
getContributors()
Get contributors of wiki.
static getWikiContributors($a_wiki_id)
Get all contributors of wiki.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
$login
Definition: cron.php:13
global $DIC
Definition: goto.php:24
$img
Definition: imgupload.php:57
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc