ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
6include_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->addColumn($this->lng->txt("exc_comment_for_learner"), "", "1%");
74
75// $this->addColumn($this->lng->txt("exc_grading"), "solved_time");
76// $this->addColumn($this->lng->txt("mail"), "feedback_time");
77
78 $this->setDefaultOrderField("lastname");
79 $this->setDefaultOrderDirection("asc");
80
81 $this->setEnableHeader(true);
82 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
83 $this->setRowTemplate("tpl.exc_grades_row.html", "Modules/Exercise");
84 //$this->disable("footer");
85 $this->setEnableTitle(true);
86// $this->setSelectAllCheckbox("assid");
87
88 if (count($mems) > 0)
89 {
90 $this->addCommandButton("saveGrades", $lng->txt("exc_save_changes"));
91 }
92 }
93
97 function numericOrdering($a_f)
98 {
99 if (in_array($a_f, array("order_val")))
100 {
101 return true;
102 }
103 return false;
104 }
105
106
110 protected function fillRow($d)
111 {
112 global $lng, $ilCtrl;
113
114 $user_id = $d["user_id"];
115
116 foreach ($this->ass_data as $ass)
117 {
118 $member_status = new ilExAssignmentMemberStatus($ass->getId(), $user_id);
119
120 // grade
121 $this->tpl->setCurrentBlock("grade");
122 $status = $member_status->getStatus();
123 $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
124 $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
125 $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
126 $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
127 $pic = $member_status->getStatusIcon();
128 $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
129 $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
130
131 // mark
132 $mark = $member_status->getMark();
133 $this->tpl->setVariable("VAL_ONLY_MARK", $mark);
134
135 $this->tpl->parseCurrentBlock();
136 }
137
138 // exercise total
139
140 // mark input
141 $this->tpl->setCurrentBlock("mark_input");
142 $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
143 $this->tpl->setVariable("NAME_MARK",
144 "mark[".$user_id."]");
145 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
146 $mark = ilLPMarks::_lookupMark($user_id, $this->exc_id);
147 $this->tpl->setVariable("VAL_MARK",
149 $this->tpl->parseCurrentBlock();
150
151 $this->tpl->setCurrentBlock("grade");
152 $status = ilExerciseMembers::_lookupStatus($this->exc_id, $user_id);
153 $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
154 switch($status)
155 {
156 case "passed": $pic = "scorm/passed.svg"; break;
157 case "failed": $pic = "scorm/failed.svg"; break;
158 default: $pic = "scorm/not_attempted.svg"; break;
159 }
160 $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
161 $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
162
163 // mark
164 /*$this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
165 $this->tpl->setVariable("NAME_MARK",
166 "mark[".$d["id"]."]");
167 $mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
168 $this->tpl->setVariable("VAL_MARK",
169 ilUtil::prepareFormOutput($mark));*/
170
171 $this->tpl->parseCurrentBlock();
172
173 // name
174 $this->tpl->setVariable("TXT_NAME",
175 $d["lastname"].", ".$d["firstname"]." [".$d["login"]."]");
176 $this->tpl->setVariable("VAL_ID", $user_id);
177
178 // #17679
179 $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id);
180 $url = $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant");
181 $ilCtrl->setParameter($this->parent_obj, "part_id", "");
182
183 $this->tpl->setVariable("LINK_NAME", $url);
184
185 // comment
186 $this->tpl->setVariable("ID_COMMENT", $user_id);
187 $c = ilLPMarks::_lookupComment($user_id, $this->exc_id);
188 $this->tpl->setVariable("VAL_COMMENT",
190
191
192 }
193
194}
195?>
Exercise assignment member status.
static getInstancesByExercise($a_exc_id)
Exercise participant table.
numericOrdering($a_f)
Check whether field is numeric.
__construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_mem_obj)
Constructor.
_lookupStatus($a_obj_id, $a_user_id)
Lookup current status (notgraded|passed|failed)
_lookupComment($a_usr_id, $a_obj_id)
_lookupMark($a_usr_id, $a_obj_id)
static _lookupName($a_user_id)
lookup user name
Class ilTable2GUI.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
setEnableHeader($a_enableheader)
Set Enable Header.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$url
Definition: shib_logout.php:72