ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilExGradesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
6 include_once("./Modules/Exercise/classes/class.ilExAssignmentMemberStatus.php");
7 
17 {
18 
22  function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_mem_obj)
23  {
24  global $ilCtrl, $lng;
25 
26  $this->exc = $a_exc;
27  $this->exc_id = $this->exc->getId();
28 
29  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
30  $this->setId("exc_grades_".$this->exc_id);
31 
32  $this->mem_obj = $a_mem_obj;
33 
34  $mems = $this->mem_obj->getMembers();
35  $data = array();
36  foreach ($mems as $d)
37  {
39  $data[$d]["user_id"] = $d;
40  }
41 
42  parent::__construct($a_parent_obj, $a_parent_cmd);
43 
44  $this->setData($data);
45  $this->ass_data = ilExAssignment::getInstancesByExercise($this->exc_id);
46 
47 //var_dump($data);
48  $this->setTitle($lng->txt("exc_grades"));
49  $this->setTopCommands(true);
50  //$this->setLimit(9999);
51 
52 // $this->addColumn("", "", "1", true);
53  $this->addColumn($this->lng->txt("name"), "lastname");
54  $cnt = 1;
55  foreach ($this->ass_data as $ass)
56  {
57  $ilCtrl->setParameter($this->parent_obj, "ass_id", $ass->getId());
58  $cnt_str = '<a href="'.$ilCtrl->getLinkTarget($this->parent_obj, "members").'">'.$cnt.'</a>';
59  if ($ass->getMandatory())
60  {
61  $this->addColumn("<u>".$cnt_str."</u>", "", "", false, "", $ass->getTitle()." ".
62  "(".$lng->txt("exc_mandatory").")");
63  }
64  else
65  {
66  $this->addColumn($cnt_str, "", "", false, "", $ass->getTitle());
67  }
68  $cnt++;
69  }
70  $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
71 
72  $this->addColumn($this->lng->txt("exc_total_exc"), "");
73  $this->lng->loadLanguageModule("trac");
74  $this->addColumn($this->lng->txt("trac_comment"));
75 
76 // $this->addColumn($this->lng->txt("exc_grading"), "solved_time");
77 // $this->addColumn($this->lng->txt("mail"), "feedback_time");
78 
79  $this->setDefaultOrderField("lastname");
80  $this->setDefaultOrderDirection("asc");
81 
82  $this->setEnableHeader(true);
83  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
84  $this->setRowTemplate("tpl.exc_grades_row.html", "Modules/Exercise");
85  //$this->disable("footer");
86  $this->setEnableTitle(true);
87 // $this->setSelectAllCheckbox("assid");
88 
89  if (count($mems) > 0)
90  {
91  $this->addCommandButton("saveGrades", $lng->txt("exc_save_changes"));
92  }
93  }
94 
98  function numericOrdering($a_f)
99  {
100  if (in_array($a_f, array("order_val")))
101  {
102  return true;
103  }
104  return false;
105  }
106 
107 
111  protected function fillRow($d)
112  {
113  global $lng, $ilCtrl;
114 
115  $user_id = $d["user_id"];
116 
117  foreach ($this->ass_data as $ass)
118  {
119  $member_status = new ilExAssignmentMemberStatus($ass->getId(), $user_id);
120 
121  // grade
122  $this->tpl->setCurrentBlock("grade");
123  $status = $member_status->getStatus();
124  $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
125  $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
126  $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
127  $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
128  $pic = $member_status->getStatusIcon();
129  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
130  $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
131 
132  // mark
133  $mark = $member_status->getMark();
134  $this->tpl->setVariable("VAL_ONLY_MARK", $mark);
135 
136  $this->tpl->parseCurrentBlock();
137  }
138 
139  // exercise total
140 
141  // mark input
142  $this->tpl->setCurrentBlock("mark_input");
143  $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
144  $this->tpl->setVariable("NAME_MARK",
145  "mark[".$user_id."]");
146  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
147  $mark = ilLPMarks::_lookupMark($user_id, $this->exc_id);
148  $this->tpl->setVariable("VAL_MARK",
150  $this->tpl->parseCurrentBlock();
151 
152  $this->tpl->setCurrentBlock("grade");
153  $status = ilExerciseMembers::_lookupStatus($this->exc_id, $user_id);
154  $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
155  switch($status)
156  {
157  case "passed": $pic = "scorm/passed.svg"; break;
158  case "failed": $pic = "scorm/failed.svg"; break;
159  default: $pic = "scorm/not_attempted.svg"; break;
160  }
161  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
162  $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
163 
164  // mark
165  /*$this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
166  $this->tpl->setVariable("NAME_MARK",
167  "mark[".$d["id"]."]");
168  $mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
169  $this->tpl->setVariable("VAL_MARK",
170  ilUtil::prepareFormOutput($mark));*/
171 
172  $this->tpl->parseCurrentBlock();
173 
174  // name
175  $this->tpl->setVariable("TXT_NAME",
176  $d["lastname"].", ".$d["firstname"]." [".$d["login"]."]");
177  $this->tpl->setVariable("VAL_ID", $user_id);
178 
179  // #17679
180  $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id);
181  $url = $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant");
182  $ilCtrl->setParameter($this->parent_obj, "part_id", "");
183 
184  $this->tpl->setVariable("LINK_NAME", $url);
185 
186  // comment
187  $this->tpl->setVariable("ID_COMMENT", $user_id);
188  $c = ilLPMarks::_lookupComment($user_id, $this->exc_id);
189  $this->tpl->setVariable("VAL_COMMENT",
191 
192 
193  }
194 
195 }
196 ?>
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static _lookupName($a_user_id)
lookup user name
Exercise assignment member status.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
$url
Definition: shib_logout.php:72
__construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_mem_obj)
Constructor.
setId($a_val)
Set id.
for($col=0; $col< 50; $col++) $d
numericOrdering($a_f)
Check whether field is numeric.
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.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
Class ilTable2GUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current status (notgraded|passed|failed)
static getInstancesByExercise($a_exc_id)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:17
fillRow($d)
Fill table row.
setEnableHeader($a_enableheader)
Set Enable Header.
static _lookupMark($a_usr_id, $a_obj_id)
static _lookupComment($a_usr_id, $a_obj_id)
setEnableTitle($a_enabletitle)
Set Enable Title.
Exercise participant table.
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.