ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAssignmentsTableGUI.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_id)
22 {
23 global $ilCtrl, $lng;
24
25 $this->exc_id = $a_exc_id;
26 $this->setId("excass".$this->exc_id);
27
28 parent::__construct($a_parent_obj, $a_parent_cmd);
29
30 $this->setTitle($lng->txt("exc_assignments"));
31 $this->setTopCommands(true);
32
33 // if you add pagination and disable the unlimited setting:
34 // fix saving of ordering of single pages!
35 $this->setLimit(9999);
36
37 $this->addColumn("", "", "1", true);
38 $this->addColumn($this->lng->txt("title"), "title");
39 $this->addColumn($this->lng->txt("exc_assignment_type"), "type");
40 $this->addColumn($this->lng->txt("exc_presentation_order"), "order_val");
41 $this->addColumn($this->lng->txt("exc_start_time"), "start_time");
42 $this->addColumn($this->lng->txt("exc_deadline"), "deadline");
43 $this->addColumn($this->lng->txt("exc_mandatory"), "mandatory");
44 $this->addColumn($this->lng->txt("exc_peer_review"), "peer");
45 $this->addColumn($this->lng->txt("exc_instruction"), "", "30%");
46 $this->addColumn($this->lng->txt("actions"));
47
48 $this->setDefaultOrderField("val_order");
49 $this->setDefaultOrderDirection("asc");
50
51 //$this->setDefaultOrderField("name");
52 //$this->setDefaultOrderDirection("asc");
53
54 $this->setEnableHeader(true);
55 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
56 $this->setRowTemplate("tpl.exc_assignments_row.html", "Modules/Exercise");
57 //$this->disable("footer");
58 $this->setEnableTitle(true);
59 $this->setSelectAllCheckbox("id");
60
61 $this->addMultiCommand("confirmAssignmentsDeletion", $lng->txt("delete"));
62
63 $this->addCommandButton("orderAssignmentsByDeadline", $lng->txt("exc_order_by_deadline"));
64 $this->addCommandButton("saveAssignmentOrder", $lng->txt("exc_save_order"));
65 //$this->addCommandButton("addAssignment", $lng->txt("exc_add_assignment"));
66
67 $types_map = array(
68 ilExAssignment::TYPE_UPLOAD => $lng->txt("exc_type_upload"),
69 ilExAssignment::TYPE_UPLOAD_TEAM => $lng->txt("exc_type_upload_team"),
70 ilExAssignment::TYPE_BLOG => $lng->txt("exc_type_blog"),
71 ilExAssignment::TYPE_PORTFOLIO => $lng->txt("exc_type_portfolio"),
72 ilExAssignment::TYPE_TEXT => $lng->txt("exc_type_text"),
73 );
74
75 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
76 include_once("./Modules/Exercise/classes/class.ilExPeerReview.php");
78 foreach($data as $idx => $row)
79 {
80 // #14450
81 if($row["peer"])
82 {
83 $data[$idx]["peer_invalid"] = true;
84 $peer_review = new ilExPeerReview(new ilExAssignment($row["id"]));
85 $peer_reviews = $peer_review->validatePeerReviewGroups();
86 $data[$idx]["peer_invalid"] = $peer_reviews["invalid"];
87 }
88
89 $data[$idx]["type"] = $types_map[$row["type"]];
90 }
91
92 $this->setData($data);
93 }
94
95 function numericOrdering($a_field)
96 {
97 // #12000
98 if(in_array($a_field, array("order_val", "deadline", "start_time")))
99 {
100 return true;
101 }
102 return false;
103 }
104
108 protected function fillRow($d)
109 {
110 global $lng, $ilCtrl;
111
112 $this->tpl->setVariable("ID", $d["id"]);
113 if ($d["deadline"] > 0)
114 {
116 if($d["deadline2"] > 0)
117 {
118 $dl .= "<br />(".ilDatePresentation::formatDate(new ilDateTime($d["deadline2"],IL_CAL_UNIX)).")";
119 }
120 $this->tpl->setVariable("TXT_DEADLINE", $dl);
121 }
122 if ($d["start_time"] > 0)
123 {
124 $this->tpl->setVariable("TXT_START_TIME",
126 }
127 $this->tpl->setVariable("TXT_INSTRUCTIONS",
128 nl2br(trim(ilUtil::shortenText(strip_tags($d["instruction"]), 200, true))));
129
130 if ($d["mandatory"])
131 {
132 $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("yes"));
133 }
134 else
135 {
136 $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("no"));
137 }
138
139 $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
140
141 if ($d["peer"])
142 {
143 $this->tpl->setVariable("TXT_PEER", $lng->txt("yes")." (".$d["peer_min"].")");
144
145 if($d["peer_invalid"])
146 {
147 $this->tpl->setVariable("TXT_PEER_INVALID", $lng->txt("exc_peer_reviews_invalid_warning"));
148 }
149
150 $this->tpl->setVariable("TXT_PEER_OVERVIEW", $lng->txt("exc_peer_review_overview"));
151 $this->tpl->setVariable("CMD_PEER_OVERVIEW",
152 $ilCtrl->getLinkTargetByClass("ilexpeerreviewgui", "showPeerReviewOverview"));
153 }
154 else
155 {
156 $this->tpl->setVariable("TXT_PEER", $lng->txt("no"));
157 }
158
159 $this->tpl->setVariable("TXT_TITLE", $d["title"]);
160 $this->tpl->setVariable("TXT_TYPE", $d["type"]);
161 $this->tpl->setVariable("ORDER_VAL", $d["order_val"]);
162
163 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
164 $this->tpl->setVariable("CMD_EDIT",
165 $ilCtrl->getLinkTarget($this->parent_obj, "editAssignment"));
166 }
167
168}
169?>
const IL_CAL_UNIX
__construct($a_parent_obj, $a_parent_cmd, $a_exc_id)
Constructor.
numericOrdering($a_field)
Should this field be sorted numeric?
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Exercise assignment.
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
Exercise peer review.
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.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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 shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40