ILIAS  release_4-4 Revision
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 
37  function ilWikiContributorsTableGUI($a_parent_obj, $a_parent_cmd = "",
38  $a_wiki_id)
39  {
40  global $ilCtrl, $lng;
41 
42  parent::__construct($a_parent_obj, $a_parent_cmd);
43  $this->wiki_id = $a_wiki_id;
44 
45  $this->addColumn("", "", "1");
46  //$this->addColumn("", "", "1");
47  $this->addColumn($lng->txt("wiki_contributor"), "", "33%");
48  $this->addColumn($lng->txt("wiki_page_changes"), "", "33%");
49  $this->addColumn($lng->txt("wiki_grading"), "", "33%");
50  $this->setEnableHeader(true);
51  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
52  $this->setRowTemplate("tpl.table_row_contributors.html",
53  "Modules/Wiki");
54  $this->getContributors();
55  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), "saveGrading"));
56  $this->addCommandButton("saveGrading", $lng->txt("save"));
57  //$this->addMultiCommand("saveGrading", $lng->txt("save"));
58 
59  $this->setShowRowsSelector(true);
60 
61  $this->setTitle($lng->txt("wiki_contributors"));
62  }
63 
67  function getContributors()
68  {
69  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
70  $contributors = ilWikiPage::getParentObjectContributors($this->wiki_id);
71  $this->setDefaultOrderField("lastname");
72  $this->setDefaultOrderDirection("asc");
73  $this->setData($contributors);
74  }
75 
80  protected function fillRow($a_set)
81  {
82  global $lng, $ilCtrl, $lng;
83 
84  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
85  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
86 
87  if (ilObject::_exists($a_set["user_id"]))
88  {
89  arsort($a_set["pages"]);
90 
91  // pages
92  foreach ($a_set["pages"] as $page_id => $cnt)
93  {
94  if ($page_id > 0)
95  {
96  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
97  $title = ilWikiPage::lookupTitle($page_id);
98  $this->tpl->setCurrentBlock("page");
99  $this->tpl->setVariable("PAGE", $title);
100  $this->tpl->setVariable("CNT", $cnt);
101  $this->tpl->parseCurrentBlock();
102  }
103  }
104 
105  $this->tpl->setVariable("TXT_LINKED_USER",
106  $user["lastname"].", ".$user["firstname"]." [".$login."]");
107 
108  // profile link
109  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
110  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
111  // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
112  //$this->tpl->setVariable("USER_LINK",
113  // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
114  $img = ilObjUser::_getPersonalPicturePath($a_set["user_id"], "xsmall");
115  $this->tpl->setVariable("IMG_USER", $img);
116  $this->tpl->setVariable("TXT_NAME",
117  htmlspecialchars($a_set["lastname"].", ".$a_set["firstname"]));
118  $this->tpl->setVariable("USER_ID", $a_set["user_id"]);
119 
120  // comment for learner
121  $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("wiki_comment_for_learner"));
122  $this->tpl->setVariable("NAME_LCOMMENT",
123  "lcomment[".$a_set["user_id"]."]");
124  $lpcomment = ilLPMarks::_lookupComment($a_set["user_id"],
125  $this->parent_obj->object->getId());
126  $this->tpl->setVariable("VAL_LCOMMENT",
127  ilUtil::prepareFormOutput($lpcomment));
128 
129  // status
130  //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $member_id);
131  $status = ilWikiContributor::_lookupStatus($this->parent_obj->object->getId(), $a_set["user_id"]);
132  $this->tpl->setVariable("SEL_".$status, ' selected="selected" ');
133  $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("wiki_notgraded"));
134  $this->tpl->setVariable("TXT_PASSED", $lng->txt("wiki_passed"));
135  $this->tpl->setVariable("TXT_FAILED", $lng->txt("wiki_failed"));
136  $this->tpl->setVariable("VAL_NOTGRADED", ilWikiContributor::STATUS_NOT_GRADED);
137  $this->tpl->setVariable("VAL_PASSED", ilWikiContributor::STATUS_PASSED);
138  $this->tpl->setVariable("VAL_FAILED", ilWikiContributor::STATUS_FAILED);
139  if (($sd = ilWikiContributor::_lookupStatusTime($this->parent_obj->object->getId(), $a_set["user_id"])) > 0)
140  {
141  $this->tpl->setCurrentBlock("status_date");
142  $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
143  $this->tpl->setVariable("VAL_STATUS_DATE",
145  $this->tpl->parseCurrentBlock();
146  }
147  switch($status)
148  {
149  case ilWikiContributor::STATUS_PASSED: $pic = "scorm/passed.png"; break;
150  case ilWikiContributor::STATUS_FAILED: $pic = "scorm/failed.png"; break;
151  default: $pic = "scorm/not_attempted.png"; break;
152  }
153  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
154  $this->tpl->setVariable("ALT_STATUS", $lng->txt("wiki_".$status));
155 
156  // mark
157  $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark"));
158  $this->tpl->setVariable("NAME_MARK",
159  "mark[".$a_set["user_id"]."]");
160  $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->object->getId());
161 
162  $this->tpl->setVariable("VAL_MARK",
164 
165  }
166 
167  }
168 
169 }
170 ?>
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.
static getParentObjectContributors($a_wiki_id)
Get all contributors of wiki.
TableGUI class for listing users that contributed to the wiki.
const IL_CAL_DATETIME
getContributors()
Get contributors of wiki.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
_lookupMark($a_usr_id, $a_obj_id)
ilWikiContributorsTableGUI($a_parent_obj, $a_parent_cmd="", $a_wiki_id)
global $ilCtrl
Definition: ilias.php:18
_lookupStatusTime($a_obj_id, $a_user_id)
Lookup last change in mark or success status.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="")
Add Command button.
fillRow($a_set)
Standard Version of Fill Row.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
_lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
_lookupComment($a_usr_id, $a_obj_id)
global $lng
Definition: privfeed.php:40
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
setFormAction($a_form_action)
Set Form action parameter.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.