ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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");
6
16{
17
21 function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_mem_obj)
22 {
23 global $ilCtrl, $lng, $ilAccess, $lng;
24
25 $this->exc = $a_exc;
26 $this->exc_id = $this->exc->getId();
27
28 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
29 $this->setId("exc_grades_".$this->exc_id);
30
31 $this->mem_obj = $a_mem_obj;
32
33 $mems = $this->mem_obj->getMembers();
34 $data = array();
35 foreach ($mems as $d)
36 {
38 $data[$d]["user_id"] = $d;
39 }
40
41 parent::__construct($a_parent_obj, $a_parent_cmd);
42
43 $this->setData($data);
44 $this->ass_data = ilExAssignment::getAssignmentDataOfExercise($this->exc_id);
45
46//var_dump($data);
47 $this->setTitle($lng->txt("exc_grades"));
48 $this->setTopCommands(true);
49 //$this->setLimit(9999);
50
51// $this->addColumn("", "", "1", true);
52 $this->addColumn($this->lng->txt("name"), "lastname");
53 $cnt = 1;
54 foreach ($this->ass_data as $ass)
55 {
56 $ilCtrl->setParameter($this->parent_obj, "ass_id", $ass["id"]);
57 $cnt_str = '<a href="'.$ilCtrl->getLinkTarget($this->parent_obj, "members").'">'.$cnt.'</a>';
58 if ($ass["mandatory"])
59 {
60 $this->addColumn("<u>".$cnt_str."</u>", "", "", false, "", $ass["title"]." ".
61 "(".$lng->txt("exc_mandatory").")");
62 }
63 else
64 {
65 $this->addColumn($cnt_str, "", "", false, "", $ass["title"]);
66 }
67 $cnt++;
68 }
69 $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
70 $this->addColumn($this->lng->txt("exc_total_exc"), "");
71 $this->addColumn($this->lng->txt("exc_comment_for_learner"), "", "1%");
72
73// $this->addColumn($this->lng->txt("exc_grading"), "solved_time");
74// $this->addColumn($this->lng->txt("mail"), "feedback_time");
75
76 $this->setDefaultOrderField("lastname");
77 $this->setDefaultOrderDirection("asc");
78
79 $this->setEnableHeader(true);
80 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
81 $this->setRowTemplate("tpl.exc_grades_row.html", "Modules/Exercise");
82 //$this->disable("footer");
83 $this->setEnableTitle(true);
84// $this->setSelectAllCheckbox("assid");
85
86 if (count($mems) > 0)
87 {
88 $this->addCommandButton("saveGrades", $lng->txt("exc_save_changes"));
89 }
90 }
91
95 function numericOrdering($a_f)
96 {
97 if (in_array($a_f, array("order_val")))
98 {
99 return true;
100 }
101 return false;
102 }
103
104
108 protected function fillRow($d)
109 {
110 global $lng, $ilCtrl;
111
112
113 $user_id = $d["user_id"];
114
115 foreach ($this->ass_data as $ass)
116 {
117 // grade
118 $this->tpl->setCurrentBlock("grade");
119 $status = ilExAssignment::lookupStatusOfUser($ass["id"], $user_id);
120 $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
121 $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
122 $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
123 $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
124 switch($status)
125 {
126 case "passed": $pic = "scorm/passed.svg"; break;
127 case "failed": $pic = "scorm/failed.svg"; break;
128 default: $pic = "scorm/not_attempted.svg"; break;
129 }
130 $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
131 $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
132
133 // mark
134 $mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
135 $this->tpl->setVariable("VAL_ONLY_MARK", $mark);
136
137 $this->tpl->parseCurrentBlock();
138 }
139
140 // exercise total
141
142 // mark input
143 $this->tpl->setCurrentBlock("mark_input");
144 $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
145 $this->tpl->setVariable("NAME_MARK",
146 "mark[".$user_id."]");
147 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
148 $mark = ilLPMarks::_lookupMark($user_id, $this->exc_id);
149 $this->tpl->setVariable("VAL_MARK",
151 $this->tpl->parseCurrentBlock();
152
153 $this->tpl->setCurrentBlock("grade");
154 $status = ilExerciseMembers::_lookupStatus($this->exc_id, $user_id);
155 $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
156 switch($status)
157 {
158 case "passed": $pic = "scorm/passed.svg"; break;
159 case "failed": $pic = "scorm/failed.svg"; break;
160 default: $pic = "scorm/not_attempted.svg"; break;
161 }
162 $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
163 $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
164
165 // mark
166 /*$this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
167 $this->tpl->setVariable("NAME_MARK",
168 "mark[".$d["id"]."]");
169 $mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
170 $this->tpl->setVariable("VAL_MARK",
171 ilUtil::prepareFormOutput($mark));*/
172
173 $this->tpl->parseCurrentBlock();
174
175 // name
176 $this->tpl->setVariable("TXT_NAME",
177 $d["lastname"].", ".$d["firstname"]." [".$d["login"]."]");
178 $this->tpl->setVariable("VAL_ID", $user_id);
179 $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id);
180 $this->tpl->setVariable("LINK_NAME",
181 $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant"));
182
183 // comment
184 $this->tpl->setVariable("ID_COMMENT", $user_id);
185 $c = ilLPMarks::_lookupComment($user_id, $this->exc_id);
186 $this->tpl->setVariable("VAL_COMMENT",
188 }
189
190}
191?>
lookupMarkOfUser($a_ass_id, $a_user_id)
Lookup user mark.
lookupStatusOfUser($a_ass_id, $a_user_id)
was: getStatusByMember
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
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)
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable 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