ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilExAssignmentGUI Class Reference

GUI class for exercise assignments. More...

+ Collaboration diagram for ilExAssignmentGUI:

Public Member Functions

 __construct (ilObjExercise $a_exc)
 Constructor. More...
 
 getOverviewHeader (ilExAssignment $a_ass)
 Get assignment header for overview. More...
 
 getOverviewBody (ilExAssignment $a_ass)
 Get assignment body for overview. More...
 
 getTimeString ($a_deadline)
 Get time string for deadline. More...
 

Protected Member Functions

 addInstructions (ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
 
 addSchedule (ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
 
 addPublicSubmissions (ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
 
 addFiles (ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
 
 addSubmission (ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
 
 addSubmissionFeedback (ilInfoScreenGUI $a_info, ilExAssignment $a_ass, $a_feedback_id, $a_show_global_feedback)
 
 getSubmissionLink ($a_cmd, array $a_params=null)
 

Protected Attributes

 $exc
 
 $current_ass_id
 

Detailed Description

GUI class for exercise assignments.

This is not a real GUI class, could be moved to ilObjExerciseGUI

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 11 of file class.ilExAssignmentGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExAssignmentGUI::__construct ( ilObjExercise  $a_exc)

Constructor.

Definition at line 19 of file class.ilExAssignmentGUI.php.

20 {
21 $this->exc = $a_exc;
22 }

Member Function Documentation

◆ addFiles()

ilExAssignmentGUI::addFiles ( ilInfoScreenGUI  $a_info,
ilExAssignment  $a_ass 
)
protected

Definition at line 247 of file class.ilExAssignmentGUI.php.

248 {
249 global $lng, $ilCtrl;
250
251 $files = $a_ass->getFiles();
252 if (count($files) > 0)
253 {
254 $a_info->addSection($lng->txt("exc_files"));
255 foreach($files as $file)
256 {
257 $a_info->addProperty($file["name"], $lng->txt("download"), $this->getSubmissionLink("downloadFile", array("file"=>urlencode($file["name"]))));
258 }
259 }
260 }
$files
Definition: add-vimline.php:18
addProperty($a_name, $a_value, $a_link="")
add a property to current section
addSection($a_title)
add a new section
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $files, $ilCtrl, $lng, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), and ilExAssignment\getFiles().

Referenced by getOverviewBody().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addInstructions()

ilExAssignmentGUI::addInstructions ( ilInfoScreenGUI  $a_info,
ilExAssignment  $a_ass 
)
protected

Definition at line 147 of file class.ilExAssignmentGUI.php.

148 {
149 global $lng;
150
151 if (!$a_ass->notStartedYet())
152 {
153 $inst = $a_ass->getInstruction();
154 if(trim($inst))
155 {
156 $a_info->addSection($lng->txt("exc_instruction"));
157
158 $is_html = (strlen($inst) != strlen(strip_tags($inst)));
159 if(!$is_html)
160 {
161 $inst = nl2br(ilUtil::makeClickable($inst, true));
162 }
163 $a_info->addProperty("", $inst);
164 }
165 }
166 }
getInstruction()
Get instruction.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen

References $lng, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), ilExAssignment\getInstruction(), ilUtil\makeClickable(), and ilExAssignment\notStartedYet().

Referenced by getOverviewBody().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addPublicSubmissions()

ilExAssignmentGUI::addPublicSubmissions ( ilInfoScreenGUI  $a_info,
ilExAssignment  $a_ass 
)
protected

Definition at line 228 of file class.ilExAssignmentGUI.php.

229 {
230 global $lng;
231
232 if ($a_ass->afterDeadline())
233 {
234 $button = ilLinkButton::getInstance();
235 $button->setCaption("exc_list_submission");
236 $button->setUrl($this->getSubmissionLink("listPublicSubmissions"));
237
238 $a_info->addProperty($lng->txt("exc_public_submission"), $button->render());
239 }
240 else
241 {
242 $a_info->addProperty($lng->txt("exc_public_submission"),
243 $lng->txt("exc_msg_public_submission"));
244 }
245 }
getSubmissionLink($a_cmd, array $a_params=null)
static getInstance()
Factory.

References $lng, ilInfoScreenGUI\addProperty(), ilExAssignment\afterDeadline(), ilLinkButton\getInstance(), and getSubmissionLink().

Referenced by getOverviewBody().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSchedule()

ilExAssignmentGUI::addSchedule ( ilInfoScreenGUI  $a_info,
ilExAssignment  $a_ass 
)
protected

Definition at line 168 of file class.ilExAssignmentGUI.php.

169 {
170 global $lng, $ilUser;
171
172 $idl = $a_ass->getPersonalDeadline($ilUser->getId());
173
174 $a_info->addSection($lng->txt("exc_schedule"));
175 if ($a_ass->getStartTime() > 0)
176 {
177 $a_info->addProperty($lng->txt("exc_start_time"),
179 }
180
181 // extended deadline info/warning
182 $late_dl = "";
183 if ($idl &&
184 $idl < time() &&
185 $a_ass->beforeDeadline()) // ext dl is last deadline
186 {
187 // extended deadline date should not be presented anywhere
189 $late_dl = "<br />".sprintf($lng->txt("exc_late_submission_warning"), $late_dl);
190 $late_dl = '<span class="warning">'.$late_dl.'</span>';
191 }
192
193 if ($a_ass->getDeadline())
194 {
196
197 // add late info if no idl
198 if ($late_dl &&
199 $idl == $a_ass->getDeadline())
200 {
201 $until .= $late_dl;
202 }
203
204 $a_info->addProperty($lng->txt("exc_edit_until"), $until);
205 }
206
207 if ($idl &&
208 $idl != $a_ass->getDeadline())
209 {
211
212 // add late info?
213 if ($late_dl)
214 {
215 $until .= $late_dl;
216 }
217
218 $a_info->addProperty($lng->txt("exc_individual_deadline"), $until);
219 }
220
221 if (!$a_ass->notStartedYet())
222 {
223 $a_info->addProperty($lng->txt("exc_time_to_send"),
224 "<b>".$this->getTimeString($idl)."</b>");
225 }
226 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
getPersonalDeadline($a_user_id)
Get individual deadline.
getStartTime()
Get start time (timestamp)
getDeadline()
Get deadline (timestamp)
$ilUser
Definition: imgupload.php:18

References $ilUser, $lng, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), ilExAssignment\beforeDeadline(), ilDatePresentation\formatDate(), ilExAssignment\getDeadline(), ilExAssignment\getPersonalDeadline(), ilExAssignment\getStartTime(), IL_CAL_UNIX, and ilExAssignment\notStartedYet().

Referenced by getOverviewBody().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubmission()

ilExAssignmentGUI::addSubmission ( ilInfoScreenGUI  $a_info,
ilExAssignment  $a_ass 
)
protected

Definition at line 262 of file class.ilExAssignmentGUI.php.

263 {
264 global $lng, $ilCtrl, $ilUser;
265
266 $a_info->addSection($lng->txt("exc_your_submission"));
267
268 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
269 $submission = new ilExSubmission($a_ass, $ilUser->getId());
270
271 include_once "Modules/Exercise/classes/class.ilExSubmissionGUI.php";
272 ilExSubmissionGUI::getOverviewContent($a_info, $submission);
273
274 $last_sub = null;
275 if($submission->hasSubmitted())
276 {
277 $last_sub = $submission->getLastSubmission();
278 if($last_sub)
279 {
281 $a_info->addProperty($lng->txt("exc_last_submission"), $last_sub);
282 }
283 }
284
285 include_once "Modules/Exercise/classes/class.ilExPeerReviewGUI.php";
286 ilExPeerReviewGUI::getOverviewContent($a_info, $submission);
287
288 // global feedback / sample solution
290 {
291 $show_global_feedback = ($a_ass->afterDeadlineStrict() && $a_ass->getFeedbackFile());
292 }
293 else
294 {
295 $show_global_feedback = ($last_sub && $a_ass->getFeedbackFile());
296 }
297
298 $this->addSubmissionFeedback($a_info, $a_ass, $submission->getFeedbackId(), $show_global_feedback);
299 }
const IL_CAL_DATETIME
addSubmissionFeedback(ilInfoScreenGUI $a_info, ilExAssignment $a_ass, $a_feedback_id, $a_show_global_feedback)
afterDeadlineStrict($a_include_personal=true)
getFeedbackDate()
Get (global) feedback file availability date.
getFeedbackFile()
Get (global) feedback file.
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
Exercise submission.

References $ilCtrl, $ilUser, $lng, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), addSubmissionFeedback(), ilExAssignment\afterDeadlineStrict(), ilExAssignment\FEEDBACK_DATE_DEADLINE, ilDatePresentation\formatDate(), ilExAssignment\getFeedbackDate(), ilExAssignment\getFeedbackFile(), ilExPeerReviewGUI\getOverviewContent(), ilExSubmissionGUI\getOverviewContent(), and IL_CAL_DATETIME.

Referenced by getOverviewBody().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubmissionFeedback()

ilExAssignmentGUI::addSubmissionFeedback ( ilInfoScreenGUI  $a_info,
ilExAssignment  $a_ass,
  $a_feedback_id,
  $a_show_global_feedback 
)
protected

Definition at line 301 of file class.ilExAssignmentGUI.php.

302 {
303 global $lng;
304
305 $storage = new ilFSStorageExercise($a_ass->getExerciseId(), $a_ass->getId());
306 $cnt_files = $storage->countFeedbackFiles($a_feedback_id);
307
308 $lpcomment = $a_ass->getMemberStatus()->getComment();
309 $mark = $a_ass->getMemberStatus()->getMark();
310 $status = $a_ass->getMemberStatus()->getStatus();
311
312 if ($lpcomment != "" ||
313 $mark != "" ||
314 $status != "notgraded" ||
315 $cnt_files > 0 ||
316 $a_show_global_feedback)
317 {
318 $a_info->addSection($lng->txt("exc_feedback_from_tutor"));
319 if ($lpcomment != "")
320 {
321 $a_info->addProperty($lng->txt("exc_comment"),
322 nl2br($lpcomment));
323 }
324 if ($mark != "")
325 {
326 $a_info->addProperty($lng->txt("exc_mark"),
327 $mark);
328 }
329
330 if ($status == "")
331 {
332// $a_info->addProperty($lng->txt("status"),
333// $lng->txt("message_no_delivered_files"));
334 }
335 else if ($status != "notgraded")
336 {
337 $img = '<img src="'.ilUtil::getImagePath("scorm/".$status.".svg").'" '.
338 ' alt="'.$lng->txt("exc_".$status).'" title="'.$lng->txt("exc_".$status).
339 '" />';
340 $a_info->addProperty($lng->txt("status"),
341 $img." ".$lng->txt("exc_".$status));
342 }
343
344 if ($cnt_files > 0)
345 {
346 $a_info->addSection($lng->txt("exc_fb_files").
347 '<a name="fb'.$a_ass->getId().'"></a>');
348
349 if($cnt_files > 0)
350 {
351 $files = $storage->getFeedbackFiles($a_feedback_id);
352 foreach($files as $file)
353 {
354 $a_info->addProperty($file,
355 $lng->txt("download"),
356 $this->getSubmissionLink("downloadFeedbackFile", array("file"=>urlencode($file))));
357 }
358 }
359 }
360
361 // #15002 - global feedback
362 if($a_show_global_feedback)
363 {
364 $a_info->addSection($lng->txt("exc_global_feedback_file"));
365
366 $a_info->addProperty($a_ass->getFeedbackFile(),
367 $lng->txt("download"),
368 $this->getSubmissionLink("downloadGlobalFeedbackFile"));
369 }
370 }
371 }
getExerciseId()
Get exercise id.
getId()
Get assignment id.
getMemberStatus($a_user_id=null)

References $file, $files, $img, $lng, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), ilExAssignment\getExerciseId(), ilExAssignment\getFeedbackFile(), ilExAssignment\getId(), and ilExAssignment\getMemberStatus().

Referenced by addSubmission().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverviewBody()

ilExAssignmentGUI::getOverviewBody ( ilExAssignment  $a_ass)

Get assignment body for overview.

Definition at line 115 of file class.ilExAssignmentGUI.php.

116 {
117 $this->current_ass_id = $a_ass->getId();
118
119 $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise");
120
121 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
122 include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
123
124 $info = new ilInfoScreenGUI(null);
125 $info->setTableClass("");
126
127 $this->addInstructions($info, $a_ass);
128 $this->addSchedule($info, $a_ass);
129
130 if ($this->exc->getShowSubmissions())
131 {
132 $this->addPublicSubmissions($info, $a_ass);
133 }
134
135 if (!$a_ass->notStartedYet())
136 {
137 $this->addFiles($info, $a_ass);
138 $this->addSubmission($info, $a_ass);
139 }
140
141 $tpl->setVariable("CONTENT", $info->getHTML());
142
143 return $tpl->get();
144 }
global $tpl
Definition: ilias.php:8
addSubmission(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
addSchedule(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
addFiles(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
addPublicSubmissions(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
addInstructions(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
Class ilInfoScreenGUI.
special template class to simplify handling of ITX/PEAR
$info
Definition: example_052.php:80

References $info, $tpl, addFiles(), addInstructions(), addPublicSubmissions(), addSchedule(), addSubmission(), ilExAssignment\getId(), and ilExAssignment\notStartedYet().

+ Here is the call graph for this function:

◆ getOverviewHeader()

ilExAssignmentGUI::getOverviewHeader ( ilExAssignment  $a_ass)

Get assignment header for overview.

Definition at line 27 of file class.ilExAssignmentGUI.php.

28 {
29 global $lng, $ilUser;
30
31 $lng->loadLanguageModule("exc");
32
33 $tpl = new ilTemplate("tpl.assignment_head.html", true, true, "Modules/Exercise");
34
35 // we are completely ignoring the extended deadline here
36
37 $idl = $a_ass->getPersonalDeadline($ilUser->getId());
38
39 // :TODO: meaning of "ended on"
40 $dl = max($a_ass->getDeadline(), $idl);
41 if ($dl &&
42 $dl < time())
43 {
44 $tpl->setCurrentBlock("prop");
45 $tpl->setVariable("PROP", $lng->txt("exc_ended_on"));
46 $tpl->setVariable("PROP_VAL",
48 $tpl->parseCurrentBlock();
49
50 // #14077
51 if($a_ass->getPeerReview() &&
52 $a_ass->getPeerReviewDeadline())
53 {
54 $tpl->setCurrentBlock("prop");
55 $tpl->setVariable("PROP", $lng->txt("exc_peer_review_deadline"));
56 $tpl->setVariable("PROP_VAL",
58 $tpl->parseCurrentBlock();
59 }
60 }
61 else if ($a_ass->notStartedYet())
62 {
63 $tpl->setCurrentBlock("prop");
64 $tpl->setVariable("PROP", $lng->txt("exc_starting_on"));
65 $tpl->setVariable("PROP_VAL",
67 $tpl->parseCurrentBlock();
68 }
69 else
70 {
71 $time_str = $this->getTimeString($idl);
72 $tpl->setCurrentBlock("prop");
73 $tpl->setVariable("PROP", $lng->txt("exc_time_to_send"));
74 $tpl->setVariable("PROP_VAL", $time_str);
75 $tpl->parseCurrentBlock();
76
77 if ($a_ass->getDeadline())
78 {
79 $tpl->setCurrentBlock("prop");
80 $tpl->setVariable("PROP", $lng->txt("exc_edit_until"));
81 $tpl->setVariable("PROP_VAL",
83 $tpl->parseCurrentBlock();
84 }
85
86 if ($idl && $idl != $a_ass->getDeadline())
87 {
88 $tpl->setCurrentBlock("prop");
89 $tpl->setVariable("PROP", $lng->txt("exc_individual_deadline"));
90 $tpl->setVariable("PROP_VAL",
92 $tpl->parseCurrentBlock();
93 }
94 }
95
96 $mand = "";
97 if ($a_ass->getMandatory())
98 {
99 $mand = " (".$lng->txt("exc_mandatory").")";
100 }
101 $tpl->setVariable("TITLE", $a_ass->getTitle().$mand);
102
103 // status icon
104 $stat = $a_ass->getMemberStatus()->getStatus();
105 $pic = $a_ass->getMemberStatus()->getStatusIcon();
106 $tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
107 $tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$stat));
108
109 return $tpl->get();
110 }
getTimeString($a_deadline)
Get time string for deadline.
getPeerReview()
Get peer review status.
getPeerReviewDeadline()
Get peer review deadline (timestamp)
getMandatory()
Get mandatory.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $ilUser, $lng, $tpl, ilDatePresentation\formatDate(), ilExAssignment\getDeadline(), ilUtil\getImagePath(), ilExAssignment\getMandatory(), ilExAssignment\getMemberStatus(), ilExAssignment\getPeerReview(), ilExAssignment\getPeerReviewDeadline(), ilExAssignment\getPersonalDeadline(), ilExAssignment\getStartTime(), getTimeString(), ilExAssignment\getTitle(), IL_CAL_UNIX, and ilExAssignment\notStartedYet().

+ Here is the call graph for this function:

◆ getSubmissionLink()

ilExAssignmentGUI::getSubmissionLink (   $a_cmd,
array  $a_params = null 
)
protected

Definition at line 397 of file class.ilExAssignmentGUI.php.

398 {
399 global $ilCtrl;
400
401 if(is_array($a_params))
402 {
403 foreach($a_params as $name => $value)
404 {
405 $ilCtrl->setParameterByClass("ilexsubmissiongui", $name, $value);
406 }
407 }
408
409 $ilCtrl->setParameterByClass("ilexsubmissiongui", "ass_id", $this->current_ass_id);
410 $url = $ilCtrl->getLinkTargetByClass("ilexsubmissiongui", $a_cmd);
411 $ilCtrl->setParameterByClass("ilexsubmissiongui", "ass_id", "");
412
413 if(is_array($a_params))
414 {
415 foreach($a_params as $name => $value)
416 {
417 $ilCtrl->setParameterByClass("ilexsubmissiongui", $name, "");
418 }
419 }
420
421 return $url;
422 }
$url
Definition: shib_logout.php:72

References $ilCtrl, and $url.

Referenced by addPublicSubmissions().

+ Here is the caller graph for this function:

◆ getTimeString()

ilExAssignmentGUI::getTimeString (   $a_deadline)

Get time string for deadline.

Definition at line 376 of file class.ilExAssignmentGUI.php.

377 {
378 global $lng;
379
380 if ($a_deadline == 0)
381 {
382 return $lng->txt("exc_no_deadline_specified");
383 }
384
385 if ($a_deadline - time() <= 0)
386 {
387 $time_str = $lng->txt("exc_time_over_short");
388 }
389 else
390 {
391 $time_str = ilUtil::period2String(new ilDateTime($a_deadline, IL_CAL_UNIX));
392 }
393
394 return $time_str;
395 }
static period2String(ilDateTime $a_from, $a_to=null)
Return a string of time period.

References $lng, IL_CAL_UNIX, and ilUtil\period2String().

Referenced by getOverviewHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $current_ass_id

ilExAssignmentGUI::$current_ass_id
protected

Definition at line 14 of file class.ilExAssignmentGUI.php.

◆ $exc

ilExAssignmentGUI::$exc
protected

Definition at line 13 of file class.ilExAssignmentGUI.php.


The documentation for this class was generated from the following file: