ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 215 of file class.ilExAssignmentGUI.php.

216 {
217 global $lng, $ilCtrl;
218
219 $files = $a_ass->getFiles();
220 if (count($files) > 0)
221 {
222 $a_info->addSection($lng->txt("exc_files"));
223 foreach($files as $file)
224 {
225 // if download must be purchased first show a "buy"-button
226 if(IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($this->exc->getRefId(),'download') &&
227 !ilPaymentObject::_hasAccess($this->exc->getRefId(),'','download')))
228 {
229 $a_info->addProperty($file["name"],
230 $lng->txt("buy"),
231 $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
232 }
233 else
234 {
235 $a_info->addProperty($file["name"],
236 $lng->txt("download"),
237 $this->getSubmissionLink("downloadFile", array("file"=>urlencode($file["name"]))));
238 }
239 }
240 }
241 }
print $file
addProperty($a_name, $a_value, $a_link="")
add a property to current section
addSection($a_title)
add a new section
static _isBuyable($a_ref_id, $a_subtype='')
static _hasAccess($a_ref_id, $a_transaction=0, $a_subtype='')
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

References $file, $ilCtrl, $lng, ilPaymentObject\_hasAccess(), ilPaymentObject\_isBuyable(), 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 140 of file class.ilExAssignmentGUI.php.

141 {
142 global $lng;
143
144 if (!$a_ass->notStartedYet())
145 {
146 $inst = $a_ass->getInstruction();
147 if(trim($inst))
148 {
149 $a_info->addSection($lng->txt("exc_instruction"));
150
151 $is_html = (strlen($inst) != strlen(strip_tags($inst)));
152 if(!$is_html)
153 {
154 $inst = nl2br(ilUtil::makeClickable($inst, true));
155 }
156 $a_info->addProperty("", $inst);
157 }
158 }
159 }
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 196 of file class.ilExAssignmentGUI.php.

197 {
198 global $lng;
199
200 if ($a_ass->afterDeadline())
201 {
202 $button = ilLinkButton::getInstance();
203 $button->setCaption("exc_list_submission");
204 $button->setUrl($this->getSubmissionLink("listPublicSubmissions"));
205
206 $a_info->addProperty($lng->txt("exc_public_submission"), $button->render());
207 }
208 else
209 {
210 $a_info->addProperty($lng->txt("exc_public_submission"),
211 $lng->txt("exc_msg_public_submission"));
212 }
213 }
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 161 of file class.ilExAssignmentGUI.php.

162 {
163 global $lng;
164
165 $a_info->addSection($lng->txt("exc_schedule"));
166 if ($a_ass->getStartTime() > 0)
167 {
168 $a_info->addProperty($lng->txt("exc_start_time"),
170 }
171 if ($a_ass->getDeadline())
172 {
174
175 // extended deadline date should not be presented anywhere
176
177 // extended deadline info/warning
178 if($a_ass->getDeadline() < time() &&
179 $a_ass->beforeDeadline())
180 {
182 $dl = "<br />".sprintf($lng->txt("exc_late_submission_warning"), $dl);
183 $dl = '<span class="warning">'.$dl.'</span>';
184 $until .= $dl;
185 }
186 $a_info->addProperty($lng->txt("exc_edit_until"), $until);
187 }
188 $time_str = $this->getTimeString($a_ass->getDeadline());
189 if (!$a_ass->notStartedYet())
190 {
191 $a_info->addProperty($lng->txt("exc_time_to_send"),
192 "<b>".$time_str."</b>");
193 }
194 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
getTimeString($a_deadline)
Get time string for deadline.
getStartTime()
Get start time (timestamp)
getDeadline()
Get deadline (timestamp)

References $lng, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), ilExAssignment\beforeDeadline(), ilDatePresentation\formatDate(), ilExAssignment\getDeadline(), ilExAssignment\getStartTime(), getTimeString(), 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 243 of file class.ilExAssignmentGUI.php.

244 {
245 global $lng, $ilCtrl, $ilUser;
246
247 // if submission must be purchased first
248 if(IS_PAYMENT_ENABLED
249 && (ilPaymentObject::_isBuyable($this->exc->getRefId(),'upload')
250 && !ilPaymentObject::_hasAccess($this->exc->getRefId(),'','upload')))
251 {
252 $a_info->addSection($lng->txt("exc_your_submission"));
253
254 $ilCtrl->clearParameters($this);
255
256 $ilCtrl->setParameter($this, "ref_id", $this->exc->getRefId());
257 $ilCtrl->setParameter($this,'subtype','upload');
258 $a_info->addProperty($lng->txt('exc_hand_in'),
259 $lng->txt("buy"),
260 $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
261 }
262 else
263 {
264 $a_info->addSection($lng->txt("exc_your_submission"));
265
266 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
267 $submission = new ilExSubmission($a_ass, $ilUser->getId());
268
269 include_once "Modules/Exercise/classes/class.ilExSubmissionGUI.php";
270 ilExSubmissionGUI::getOverviewContent($a_info, $submission);
271
272 $last_sub = null;
273 if($submission->hasSubmitted())
274 {
275 $last_sub = $submission->getLastSubmission();
276 if($last_sub)
277 {
279 $a_info->addProperty($lng->txt("exc_last_submission"), $last_sub);
280 }
281 }
282
283 include_once "Modules/Exercise/classes/class.ilExPeerReviewGUI.php";
284 ilExPeerReviewGUI::getOverviewContent($a_info, $submission);
285
286 // global feedback / sample solution
288 {
289 $show_global_feedback = ($a_ass->afterDeadlineStrict() && $a_ass->getFeedbackFile());
290 }
291 else
292 {
293 $show_global_feedback = ($last_sub && $a_ass->getFeedbackFile());
294 }
295
296 $this->addSubmissionFeedback($a_info, $a_ass, $submission->getFeedbackId(), $show_global_feedback);
297 }
298 }
const IL_CAL_DATETIME
addSubmissionFeedback(ilInfoScreenGUI $a_info, ilExAssignment $a_ass, $a_feedback_id, $a_show_global_feedback)
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.
global $ilUser
Definition: imgupload.php:15

References $ilCtrl, $ilUser, $lng, ilPaymentObject\_hasAccess(), ilPaymentObject\_isBuyable(), 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 300 of file class.ilExAssignmentGUI.php.

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

References $file, $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 103 of file class.ilExAssignmentGUI.php.

104 {
105 $this->current_ass_id = $a_ass->getId();
106
107 $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise");
108
109 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
110 include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
111
112 if(IS_PAYMENT_ENABLED)
113 {
114 include_once './Services/Payment/classes/class.ilPaymentObject.php';
115 }
116
117 $info = new ilInfoScreenGUI(null);
118 $info->setTableClass("");
119
120 $this->addInstructions($info, $a_ass);
121 $this->addSchedule($info, $a_ass);
122
123 if ($this->exc->getShowSubmissions())
124 {
125 $this->addPublicSubmissions($info, $a_ass);
126 }
127
128 if (!$a_ass->notStartedYet())
129 {
130 $this->addFiles($info, $a_ass);
131 $this->addSubmission($info, $a_ass);
132 }
133
134 $tpl->setVariable("CONTENT", $info->getHTML());
135
136 return $tpl->get();
137 }
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;
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 if ($a_ass->getDeadline() &&
38 $a_ass->getDeadline() < time())
39 {
40 $tpl->setCurrentBlock("prop");
41 $tpl->setVariable("PROP", $lng->txt("exc_ended_on"));
42 $tpl->setVariable("PROP_VAL",
44 $tpl->parseCurrentBlock();
45
46 // #14077
47 if($a_ass->getPeerReview() &&
48 $a_ass->getPeerReviewDeadline())
49 {
50 $tpl->setCurrentBlock("prop");
51 $tpl->setVariable("PROP", $lng->txt("exc_peer_review_deadline"));
52 $tpl->setVariable("PROP_VAL",
54 $tpl->parseCurrentBlock();
55 }
56 }
57 else if ($a_ass->notStartedYet())
58 {
59 $tpl->setCurrentBlock("prop");
60 $tpl->setVariable("PROP", $lng->txt("exc_starting_on"));
61 $tpl->setVariable("PROP_VAL",
63 $tpl->parseCurrentBlock();
64 }
65 else
66 {
67 $time_str = $this->getTimeString($a_ass->getDeadline());
68 $tpl->setCurrentBlock("prop");
69 $tpl->setVariable("PROP", $lng->txt("exc_time_to_send"));
70 $tpl->setVariable("PROP_VAL", $time_str);
71 $tpl->parseCurrentBlock();
72
73 if ($a_ass->getDeadline())
74 {
75 $tpl->setCurrentBlock("prop");
76 $tpl->setVariable("PROP", $lng->txt("exc_edit_until"));
77 $tpl->setVariable("PROP_VAL",
79 $tpl->parseCurrentBlock();
80 }
81
82 }
83
84 $mand = "";
85 if ($a_ass->getMandatory())
86 {
87 $mand = " (".$lng->txt("exc_mandatory").")";
88 }
89 $tpl->setVariable("TITLE", $a_ass->getTitle().$mand);
90
91 // status icon
92 $stat = $a_ass->getMemberStatus()->getStatus();
93 $pic = $a_ass->getMemberStatus()->getStatusIcon();
94 $tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
95 $tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$stat));
96
97 return $tpl->get();
98 }
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 $lng, $tpl, ilDatePresentation\formatDate(), ilExAssignment\getDeadline(), ilUtil\getImagePath(), ilExAssignment\getMandatory(), ilExAssignment\getMemberStatus(), ilExAssignment\getPeerReview(), ilExAssignment\getPeerReviewDeadline(), 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 396 of file class.ilExAssignmentGUI.php.

397 {
398 global $ilCtrl;
399
400 if(is_array($a_params))
401 {
402 foreach($a_params as $name => $value)
403 {
404 $ilCtrl->setParameterByClass("ilexsubmissiongui", $name, $value);
405 }
406 }
407
408 $ilCtrl->setParameterByClass("ilexsubmissiongui", "ass_id", $this->current_ass_id);
409 $url = $ilCtrl->getLinkTargetByClass("ilexsubmissiongui", $a_cmd);
410 $ilCtrl->setParameterByClass("ilexsubmissiongui", "ass_id", "");
411
412 if(is_array($a_params))
413 {
414 foreach($a_params as $name => $value)
415 {
416 $ilCtrl->setParameterByClass("ilexsubmissiongui", $name, "");
417 }
418 }
419
420 return $url;
421 }
$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 375 of file class.ilExAssignmentGUI.php.

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

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

Referenced by addSchedule(), and 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: