ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAppointmentPresentationExerciseGUI.php
Go to the documentation of this file.
1<?php
2include_once './Services/Calendar/interfaces/interface.ilCalendarAppointmentPresentation.php';
3include_once './Services/Calendar/classes/AppointmentPresentation/class.ilAppointmentPresentationGUI.php';
4
15{
17 {
18 global $DIC;
19
20 $this->lng->loadLanguageModule("exc");
21
22 include_once "./Modules/Exercise/classes/class.ilObjExercise.php";
23 include_once('./Services/Link/classes/class.ilLink.php');
24 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
25
26 $f = $DIC->ui()->factory();
27 $r = $DIC->ui()->renderer();
28 $ctrl = $DIC->ctrl();
29
30 $a_app = $this->appointment;
31 $exc_obj = new ilObjExercise($this->getObjIdForAppointment(), false);
32 //is this safe?
33
34 $refs = $this->getReadableRefIds($this->getObjIdForAppointment());
35 $exc_ref = current($refs);
36
37 // common section: title, location, parent info
38 $this->addCommonSection($a_app, $this->getObjIdForAppointment(), null, true);
39
40 //Assignment title information
41 $this->addInfoSection($this->lng->txt("cal_exc_info"));
42
43 //var_dump($a_app); exit;
44 $ass_id = $a_app["event"]->getContextId() / 10; // see ilExAssignment->handleCalendarEntries $dl parameter
45
46 $assignment = new ilExAssignment($ass_id);
47 $assignment_instructions = trim($assignment->getInstruction());
48 if ($assignment_instructions != "") {
49 #21517
50 $is_html = (strlen($assignment_instructions) != strlen(strip_tags($assignment_instructions)));
51 if (!$is_html) {
52 $assignment_instructions = nl2br($assignment_instructions);
53 }
54 $this->addInfoProperty($this->lng->txt("exc_instruction"), $assignment_instructions);
55 }
56 $files = $assignment->getFiles();
57 if (count($files) > 0 && !$assignment->notStartedYet()) {
58 $this->has_files = true;
59 $str_files = array();
60 foreach ($files as $file) {
61 $ctrl->setParameterByClass("ilexsubmissiongui", "ref_id", $exc_ref);
62 $ctrl->setParameterByClass("ilexsubmissiongui", "file", urlencode($file["name"]));
63 $ctrl->setParameterByClass("ilexsubmissiongui", "ass_id", $ass_id);
64 $url = $ctrl->getLinkTargetByClass(array("ilExerciseHandlerGUI","ilobjexercisegui", "ilexsubmissiongui"), "downloadFile");
65 $ctrl->setParameterByClass("ilexsubmissiongui", "ass_id", "");
66 $ctrl->setParameterByClass("ilexsubmissiongui", "file", "");
67 $ctrl->setParameterByClass("ilexsubmissiongui", "ref_if", "");
68 $str_files[$file["name"]] = $r->render($f->button()->shy($file["name"], $url));
69 }
70 ksort($str_files, SORT_NATURAL | SORT_FLAG_CASE);
71 $str_files = implode("<br>", $str_files);
72 $this->addInfoProperty($this->lng->txt("exc_instruction_files"), $str_files);
73 $this->addListItemProperty($this->lng->txt("exc_instruction_files"), str_replace("<br>", ", ", $str_files));
74 }
75
76 //pass mode
77 if ($assignment->getMandatory()) {
78 $this->addInfoProperty($this->lng->txt("exc_mandatory"), $this->lng->txt("yes"));
79 $this->addListItemProperty($this->lng->txt("exc_mandatory"), $this->lng->txt("yes"));
80 } else {
81 $this->addInfoProperty($this->lng->txt("exc_mandatory"), $this->lng->txt("no"));
82 $this->addListItemProperty($this->lng->txt("exc_mandatory"), $this->lng->txt("no"));
83 }
84
85 // last edited
86 $this->addLastUpdate($a_app);
87
88 //go to the exercise.
89 $this->addAction(
90 $this->lng->txt("cal_exc_open"),
91 "goto.php?target=exc_" . $exc_ref . "_" . $ass_id . "&client_id=" . CLIENT_ID
92 );
93 }
94}
$files
Definition: add-vimline.php:18
An exception for terminatinating execution or to throw for unit testing.
addListItemProperty($a_txt, $a_val)
Add list item property.
getReadableRefIds($a_obj_id)
Get readable ref ids.
addCommonSection($a_app, $a_obj_id=0, $cat_info=null, $a_container_info=false)
Add common section.
addInfoProperty($a_txt, $a_val)
Add info property.
Exercise assignment.
Class ilObjExercise.
$r
Definition: example_031.php:79
$url
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $DIC
Definition: saml.php:7