ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  public function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_mem_obj)
23  {
24  global $DIC;
25 
26  $this->ctrl = $DIC->ctrl();
27  $this->lng = $DIC->language();
28  $ilCtrl = $DIC->ctrl();
29  $lng = $DIC->language();
30 
31  $this->exc = $a_exc;
32  $this->exc_id = $this->exc->getId();
33 
34  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
35  $this->setId("exc_grades_" . $this->exc_id);
36 
37  $this->mem_obj = $a_mem_obj;
38 
39  $mems = $this->mem_obj->getMembers();
40  $mems = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
41  'edit_submissions_grades',
42  'edit_submissions_grades',
43  $this->exc->getRefId(),
44  $mems
45  );
46 
47  $data = array();
48  foreach ($mems as $d) {
50  $data[$d]["user_id"] = $d;
51  $data[$d]["name"] = $data[$d]["lastname"] . ", " .$data[$d]["firstname"];
52  }
53 
54  parent::__construct($a_parent_obj, $a_parent_cmd);
55  $this->setData($data);
56  $this->ass_data = ilExAssignment::getInstancesByExercise($this->exc_id);
57 
58  //var_dump($data);
59  $this->setTitle($lng->txt("exc_grades"));
60  $this->setTopCommands(true);
61  //$this->setLimit(9999);
62 
63  // $this->addColumn("", "", "1", true);
64  $this->addColumn($this->lng->txt("name"), "name");
65  $cnt = 1;
66  foreach ($this->ass_data as $ass) {
67  $ilCtrl->setParameter($this->parent_obj, "ass_id", $ass->getId());
68  $cnt_str = '<a href="' . $ilCtrl->getLinkTarget($this->parent_obj, "members") . '">' . $cnt . '</a>';
69  if ($ass->getMandatory()) {
70  $this->addColumn("<u>" . $cnt_str . "</u>", "", "", false, "", $ass->getTitle() . " " .
71  "(" . $lng->txt("exc_mandatory") . ")");
72  } else {
73  $this->addColumn($cnt_str, "", "", false, "", $ass->getTitle());
74  }
75  $cnt++;
76  }
77  $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
78 
79  $this->addColumn($this->lng->txt("exc_total_exc"), "");
80  $this->lng->loadLanguageModule("trac");
81  $this->addColumn($this->lng->txt("trac_comment"));
82 
83  // $this->addColumn($this->lng->txt("exc_grading"), "solved_time");
84  // $this->addColumn($this->lng->txt("mail"), "feedback_time");
85 
86  $this->setDefaultOrderField("name");
87  $this->setDefaultOrderDirection("asc");
88 
89  $this->setEnableHeader(true);
90  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
91  $this->setRowTemplate("tpl.exc_grades_row.html", "Modules/Exercise");
92  //$this->disable("footer");
93  $this->setEnableTitle(true);
94  // $this->setSelectAllCheckbox("assid");
95 
96  if (count($mems) > 0) {
97  $this->addCommandButton("saveGrades", $lng->txt("exc_save_changes"));
98  }
99  }
100 
104  public function numericOrdering($a_f)
105  {
106  if (in_array($a_f, array("order_val"))) {
107  return true;
108  }
109  return false;
110  }
111 
112 
116  protected function fillRow($d)
117  {
118  $lng = $this->lng;
120 
121  $user_id = $d["user_id"];
122 
123  foreach ($this->ass_data as $ass) {
124  $member_status = new ilExAssignmentMemberStatus($ass->getId(), $user_id);
125 
126  // grade
127  $this->tpl->setCurrentBlock("grade");
128  $status = $member_status->getStatus();
129  $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
130  $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
131  $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
132  $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
133  $pic = $member_status->getStatusIcon();
134  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
135  $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
136 
137  // mark
138  $mark = $member_status->getMark();
139  $this->tpl->setVariable("VAL_ONLY_MARK", $mark);
140 
141  $this->tpl->parseCurrentBlock();
142  }
143 
144  // exercise total
145 
146  // mark input
147  $this->tpl->setCurrentBlock("mark_input");
148  $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
149  $this->tpl->setVariable(
150  "NAME_MARK",
151  "mark[" . $user_id . "]"
152  );
153  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
154  $mark = ilLPMarks::_lookupMark($user_id, $this->exc_id);
155  $this->tpl->setVariable(
156  "VAL_MARK",
158  );
159  $this->tpl->parseCurrentBlock();
160 
161  $this->tpl->setCurrentBlock("grade");
162  $status = ilExerciseMembers::_lookupStatus($this->exc_id, $user_id);
163  $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
164  switch ($status) {
165  case "passed": $pic = "scorm/passed.svg"; break;
166  case "failed": $pic = "scorm/failed.svg"; break;
167  default: $pic = "scorm/not_attempted.svg"; break;
168  }
169  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
170  $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
171 
172  // mark
173  /*$this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
174  $this->tpl->setVariable("NAME_MARK",
175  "mark[".$d["id"]."]");
176  $mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
177  $this->tpl->setVariable("VAL_MARK",
178  ilUtil::prepareFormOutput($mark));*/
179 
180  $this->tpl->parseCurrentBlock();
181 
182  // name
183  $this->tpl->setVariable(
184  "TXT_NAME",
185  $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]"
186  );
187  $this->tpl->setVariable("VAL_ID", $user_id);
188 
189  // #17679
190  $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id);
191  $url = $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant");
192  $ilCtrl->setParameter($this->parent_obj, "part_id", "");
193 
194  $this->tpl->setVariable("LINK_NAME", $url);
195 
196  // comment
197  $this->tpl->setVariable("ID_COMMENT", $user_id);
198  $c = ilLPMarks::_lookupComment($user_id, $this->exc_id);
199  $this->tpl->setVariable(
200  "VAL_COMMENT",
202  );
203  }
204 }
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.
global $DIC
Definition: saml.php:7
__construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_mem_obj)
Constructor.
setId($a_val)
Set id.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
fillRow($d)
Fill table row.
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.
setEnableHeader($a_enableheader)
Set Enable Header.
$url
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.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.