ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
24 include_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  {
90  $lng = $this->lng;
92  $lng = $this->lng;
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");
104  $title = ilWikiPage::lookupTitle($page_id);
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  switch ($status) {
166  case ilWikiContributor::STATUS_PASSED: $pic = "scorm/passed.svg"; break;
167  case ilWikiContributor::STATUS_FAILED: $pic = "scorm/failed.svg"; break;
168  default: $pic = "scorm/not_attempted.svg"; break;
169  }
170  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
171  $this->tpl->setVariable("ALT_STATUS", $lng->txt("wiki_" . $status));
172 
173  // mark
174  $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark"));
175  $this->tpl->setVariable(
176  "NAME_MARK",
177  "mark[" . $a_set["user_id"] . "]"
178  );
179  $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->object->getId());
180 
181  $this->tpl->setVariable(
182  "VAL_MARK",
184  );
185  }
186  }
187 }
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 public
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
TableGUI class for listing users that contributed to the wiki.
const IL_CAL_DATETIME
getContributors()
Get contributors of wiki.
global $DIC
Definition: saml.php:7
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static getWikiContributors($a_wiki_id)
Get all contributors of wiki.
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static _lookupStatusTime($a_obj_id, $a_user_id)
Lookup last change in mark or success status.
Class ilTable2GUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Date and time handling
$user
Definition: migrateto20.php:57
fillRow($a_set)
Standard Version of Fill Row.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
$login
Definition: cron.php:13
static _lookupMark($a_usr_id, $a_obj_id)
static _lookupComment($a_usr_id, $a_obj_id)
__construct( $a_parent_obj, $a_parent_cmd="", $a_wiki_id)