ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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->addMultiCommand("saveGrading", $lng->txt("save"));
57 
58  $this->setTitle($lng->txt("wiki_contributors"));
59  }
60 
64  function getContributors()
65  {
66  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
67  $contributors = ilWikiPage::getParentObjectContributors($this->wiki_id);
68  $this->setDefaultOrderField("lastname");
69  $this->setDefaultOrderDirection("asc");
70  $this->setData($contributors);
71  }
72 
77  protected function fillRow($a_set)
78  {
79  global $lng, $ilCtrl, $lng;
80 
81  include_once("./Services/Tracking/classes/class.ilLPMarks.php");
82  include_once("./Modules/Wiki/classes/class.ilWikiContributor.php");
83 
84  if (ilObject::_exists($a_set["user_id"]))
85  {
86  arsort($a_set["pages"]);
87 
88  // pages
89  foreach ($a_set["pages"] as $page_id => $cnt)
90  {
91  if ($page_id > 0)
92  {
93  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
94  $title = ilWikiPage::lookupTitle($page_id);
95  $this->tpl->setCurrentBlock("page");
96  $this->tpl->setVariable("PAGE", $title);
97  $this->tpl->setVariable("CNT", $cnt);
98  $this->tpl->parseCurrentBlock();
99  }
100  }
101 
102  $this->tpl->setVariable("TXT_LINKED_USER",
103  $user["lastname"].", ".$user["firstname"]." [".$login."]");
104 
105  // profile link
106  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
107  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
108  // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
109  //$this->tpl->setVariable("USER_LINK",
110  // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
111  $img = ilObjUser::_getPersonalPicturePath($a_set["user_id"], "xsmall");
112  $this->tpl->setVariable("IMG_USER", $img);
113  $this->tpl->setVariable("TXT_NAME",
114  $a_set["lastname"].", ".$a_set["firstname"]);
115  $this->tpl->setVariable("USER_ID", $a_set["user_id"]);
116 
117  // comment for learner
118  $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("wiki_comment_for_learner"));
119  $this->tpl->setVariable("NAME_LCOMMENT",
120  "lcomment[".$a_set["user_id"]."]");
121  $lpcomment = ilLPMarks::_lookupComment($a_set["user_id"],
122  $this->parent_obj->object->getId());
123  $this->tpl->setVariable("VAL_LCOMMENT",
124  ilUtil::prepareFormOutput($lpcomment));
125 
126  // status
127  //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $member_id);
128  $status = ilWikiContributor::_lookupStatus($this->parent_obj->object->getId(), $a_set["user_id"]);
129  $this->tpl->setVariable("SEL_".$status, ' selected="selected" ');
130  $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("wiki_notgraded"));
131  $this->tpl->setVariable("TXT_PASSED", $lng->txt("wiki_passed"));
132  $this->tpl->setVariable("TXT_FAILED", $lng->txt("wiki_failed"));
133  $this->tpl->setVariable("VAL_NOTGRADED", ilWikiContributor::STATUS_NOT_GRADED);
134  $this->tpl->setVariable("VAL_PASSED", ilWikiContributor::STATUS_PASSED);
135  $this->tpl->setVariable("VAL_FAILED", ilWikiContributor::STATUS_FAILED);
136  if (($sd = ilWikiContributor::_lookupStatusTime($this->parent_obj->object->getId(), $a_set["user_id"])) > 0)
137  {
138  $this->tpl->setCurrentBlock("status_date");
139  $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
140  $this->tpl->setVariable("VAL_STATUS_DATE",
142  $this->tpl->parseCurrentBlock();
143  }
144  switch($status)
145  {
146  case ilWikiContributor::STATUS_PASSED: $pic = "scorm/passed.png"; break;
147  case ilWikiContributor::STATUS_FAILED: $pic = "scorm/failed.png"; break;
148  default: $pic = "scorm/not_attempted.png"; break;
149  }
150  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
151  $this->tpl->setVariable("ALT_STATUS", $lng->txt("wiki_".$status));
152 
153  // mark
154  $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark"));
155  $this->tpl->setVariable("NAME_MARK",
156  "mark[".$a_set["user_id"]."]");
157  $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->object->getId());
158 
159  $this->tpl->setVariable("VAL_MARK",
161 
162  }
163 
164  }
165 
166 }
167 ?>