ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilBlogExerciseGUI Class Reference

Class ilBlogExerciseGUI. More...

+ Collaboration diagram for ilBlogExerciseGUI:

Public Member Functions

 __construct ($a_node_id)
 
 executeCommand ()
 

Static Public Member Functions

static checkExercise ($a_node_id)
 

Protected Member Functions

 downloadExcAssFile ()
 
 downloadExcSubFile ()
 
 finalize ()
 Finalize and submit blog to exercise. More...
 

Static Protected Member Functions

static getExerciseInfo ($a_assignment_id)
 

Protected Attributes

 $ctrl
 
 $user
 
 $lng
 
 $node_id
 
 $ass_id
 
 $file
 

Detailed Description

Class ilBlogExerciseGUI.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Id
class.ilObjFolderGUI.php 25134 2010-08-13 14:22:11Z smeyer

@ilCtrl_Calls ilBlogExerciseGUI:

Definition at line 16 of file class.ilBlogExerciseGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBlogExerciseGUI::__construct (   $a_node_id)

Definition at line 37 of file class.ilBlogExerciseGUI.php.

38 {
39 global $DIC;
40
41 $this->ctrl = $DIC->ctrl();
42 $this->user = $DIC->user();
43 $this->lng = $DIC->language();
44 $this->node_id = $a_node_id;
45 $this->ass_id = (int) $_GET["ass"];
46 $this->file = trim(ilUtil::stripSlashes($_GET["file"]));
47 }
user()
Definition: user.php:4
$_GET["client_id"]
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $DIC
Definition: saml.php:7

References $_GET, $DIC, ilUtil\stripSlashes(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkExercise()

static ilBlogExerciseGUI::checkExercise (   $a_node_id)
static

Definition at line 69 of file class.ilBlogExerciseGUI.php.

70 {
71 global $DIC;
72
73 $tree = $DIC->repositoryTree();
74 $ilUser = $DIC->user();
75
76 $exercises = ilExSubmission::findUserFiles($ilUser->getId(), $a_node_id);
77 // #0022794
78 if (!$exercises) {
79 $exercises = ilExSubmission::findUserFiles($ilUser->getId(), $a_node_id . ".sec");
80 }
81 if ($exercises) {
82 $info = array();
83 foreach ($exercises as $exercise) {
84 // #9988
85 $active_ref = false;
86 foreach (ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id) {
87 if (!$tree->isSaved($ref_id)) {
88 $active_ref = true;
89 break;
90 }
91 }
92 if ($active_ref) {
93 $part = self::getExerciseInfo($exercise["ass_id"]);
94 if ($part) {
95 $info[] = $part;
96 }
97 }
98 }
99 if (sizeof($info)) {
100 return implode("<br />", $info);
101 }
102 }
103 }
static getExerciseInfo($a_assignment_id)
static findUserFiles($a_user_id, $a_filetitle)
Check if given file was assigned.
static _getAllReferences($a_id)
get all reference ids of object
$info
Definition: index.php:5
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, $info, ilObject\_getAllReferences(), ilExSubmission\findUserFiles(), and getExerciseInfo().

Referenced by ilObjBlogGUI\render().

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

◆ downloadExcAssFile()

ilBlogExerciseGUI::downloadExcAssFile ( )
protected

Definition at line 219 of file class.ilBlogExerciseGUI.php.

220 {
221 if ($this->file) {
222 include_once "Modules/Exercise/classes/class.ilExAssignment.php";
223 $ass = new ilExAssignment($this->ass_id);
224 $ass_files = $ass->getFiles();
225 if (count($ass_files) > 0) {
226 foreach ($ass_files as $file) {
227 if ($file["name"] == $this->file) {
228 ilUtil::deliverFile($file["fullpath"], $file["name"]);
229 }
230 }
231 }
232 }
233 }
Exercise assignment.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.

References $file, and ilUtil\deliverFile().

+ Here is the call graph for this function:

◆ downloadExcSubFile()

ilBlogExerciseGUI::downloadExcSubFile ( )
protected

Definition at line 235 of file class.ilBlogExerciseGUI.php.

236 {
238
239 $ass = new ilExAssignment($this->ass_id);
240 $submission = new ilExSubmission($ass, $ilUser->getId());
241 $submitted = $submission->getFiles();
242 if (count($submitted) > 0) {
243 $submitted = array_pop($submitted);
244
245 $user_data = ilObjUser::_lookupName($submitted["user_id"]);
246 $title = ilObject::_lookupTitle($submitted["obj_id"]) . " - " .
247 $ass->getTitle() . " - " .
248 $user_data["firstname"] . " " .
249 $user_data["lastname"] . " (" .
250 $user_data["login"] . ").zip";
251
252 ilUtil::deliverFile($submitted["filename"], $title);
253 }
254 }
Exercise submission.
static _lookupName($a_user_id)
lookup user name
static _lookupTitle($a_id)
lookup object title

References $ilUser, $title, $user, ilObjUser\_lookupName(), ilObject\_lookupTitle(), and ilUtil\deliverFile().

+ Here is the call graph for this function:

◆ executeCommand()

ilBlogExerciseGUI::executeCommand ( )

Definition at line 49 of file class.ilBlogExerciseGUI.php.

50 {
52
53 if (!$this->ass_id) {
54 $this->ctrl->returnToParent($this);
55 }
56
57 $next_class = $ilCtrl->getNextClass($this);
58 $cmd = $ilCtrl->getCmd();
59
60 switch ($next_class) {
61 default:
62 $this->$cmd();
63 break;
64 }
65
66 return true;
67 }
global $ilCtrl
Definition: ilias.php:18

References $ctrl, and $ilCtrl.

◆ finalize()

ilBlogExerciseGUI::finalize ( )
protected

Finalize and submit blog to exercise.

Definition at line 259 of file class.ilBlogExerciseGUI.php.

260 {
263
264 include_once "Modules/Exercise/classes/class.ilExSubmissionBaseGUI.php";
265 include_once "Modules/Exercise/classes/class.ilExSubmissionObjectGUI.php";
266 $exc_gui = ilExSubmissionObjectGUI::initGUIForSubmit($this->ass_id);
267 $exc_gui->submitBlog($this->node_id);
268
269 ilUtil::sendSuccess($lng->txt("blog_finalized"), true);
270 $ilCtrl->returnToParent($this);
271 }
static initGUIForSubmit($a_ass_id, $a_user_id=null)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $ctrl, $ilCtrl, $lng, ilExSubmissionObjectGUI\initGUIForSubmit(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ getExerciseInfo()

static ilBlogExerciseGUI::getExerciseInfo (   $a_assignment_id)
staticprotected

Definition at line 105 of file class.ilBlogExerciseGUI.php.

106 {
107 global $DIC;
108
109 $lng = $DIC->language();
110 $ilCtrl = $DIC->ctrl();
111 $ilUser = $DIC->user();
112 $ass = new ilExAssignment($a_assignment_id);
113 $exercise_id = $ass->getExerciseId();
114 if (!$exercise_id) {
115 return;
116 }
117
118 // is the assignment still open?
119 $times_up = $ass->afterDeadlineStrict();
120
121 // exercise goto
122 include_once "./Services/Link/classes/class.ilLink.php";
123 $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
124 $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
125
126 $info = sprintf(
127 $lng->txt("blog_exercise_info"),
128 $ass->getTitle(),
129 "<a href=\"" . $exc_link . "\">" .
130 ilObject::_lookupTitle($exercise_id) . "</a>"
131 );
132
133 // submit button
134 if (!$times_up) {
135 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
136 $submit_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "finalize");
137 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
138
139 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
140 $button = ilLinkButton::getInstance();
141 $button->setCaption("blog_finalize_blog");
142 $button->setPrimary(true);
143 $button->setUrl($submit_link);
144 $info .= " " . $button->render();
145 }
146
147 // submitted files
148 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
149 $submission = new ilExSubmission($ass, $ilUser->getId());
150 if ($submission->hasSubmitted()) {
151 // #16888
152 $submitted = $submission->getSelectedObject();
153
154 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
155 $dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcSubFile");
156 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
157
160
161 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
162 $button = ilLinkButton::getInstance();
163 $button->setCaption("download");
164 $button->setUrl($dl_link);
165
166 $info .= "<br />" . sprintf(
167 $lng->txt("blog_exercise_submitted_info"),
169 $button->render()
170 );
171
173 }
174
175
176 // work instructions incl. files
177
178 $tooltip = "";
179
180 $inst = $ass->getInstruction();
181 if ($inst) {
182 $tooltip .= nl2br($inst);
183 }
184
185 $ass_files = $ass->getFiles();
186 if (count($ass_files) > 0) {
187 $tooltip .= "<br /><br />";
188
189 foreach ($ass_files as $file) {
190 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
191 $ilCtrl->setParameterByClass("ilblogexercisegui", "file", urlencode($file["name"]));
192 $dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcAssFile");
193 $ilCtrl->setParameterByClass("ilblogexercisegui", "file", "");
194 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
195
196 $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" .
197 $lng->txt("download") . "</a>";
198 }
199 }
200
201 if ($tooltip) {
202 $ol_id = "exc_ass_" . $a_assignment_id;
203
204 include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
205 $overlay = new ilOverlayGUI($ol_id);
206
207 // overlay
208 $overlay->setAnchor($ol_id . "_tr");
209 $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
210 $overlay->add();
211
212 $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $lng->txt("exc_instruction") . "</a></div>" .
213 "<div id=\"" . $ol_id . "\" style=\"display:none; padding:10px;\" class=\"ilOverlay\">" . $tooltip . "</div>";
214 }
215
216 return "<div>" . $info . "</div>";
217 }
sprintf('%.4f', $callTime)
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
@classDescription Date and time handling
static getInstance()
Factory.
This is a utility class for the yui overlays.

References $DIC, $file, $ilCtrl, $ilUser, $info, $lng, ilObject\_getAllReferences(), ilLink\_getStaticLink(), ilObject\_lookupTitle(), ilDatePresentation\formatDate(), ilLinkButton\getInstance(), IL_CAL_DATETIME, ilDatePresentation\setUseRelativeDates(), sprintf, and ilDatePresentation\useRelativeDates().

Referenced by checkExercise().

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

Field Documentation

◆ $ass_id

ilBlogExerciseGUI::$ass_id
protected

Definition at line 34 of file class.ilBlogExerciseGUI.php.

◆ $ctrl

ilBlogExerciseGUI::$ctrl
protected

Definition at line 21 of file class.ilBlogExerciseGUI.php.

Referenced by executeCommand(), and finalize().

◆ $file

ilBlogExerciseGUI::$file
protected

Definition at line 35 of file class.ilBlogExerciseGUI.php.

Referenced by downloadExcAssFile(), and getExerciseInfo().

◆ $lng

ilBlogExerciseGUI::$lng
protected

Definition at line 31 of file class.ilBlogExerciseGUI.php.

Referenced by finalize(), and getExerciseInfo().

◆ $node_id

ilBlogExerciseGUI::$node_id
protected

Definition at line 33 of file class.ilBlogExerciseGUI.php.

◆ $user

ilBlogExerciseGUI::$user
protected

Definition at line 26 of file class.ilBlogExerciseGUI.php.

Referenced by downloadExcSubFile().


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