ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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, $exercise, $ilUser, $info, $tree, 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 215 of file class.ilBlogExerciseGUI.php.

216 {
217 if ($this->file) {
218 include_once "Modules/Exercise/classes/class.ilExAssignment.php";
219 $ass = new ilExAssignment($this->ass_id);
220 $ass_files = $ass->getFiles();
221 if (count($ass_files) > 0) {
222 foreach ($ass_files as $file) {
223 if ($file["name"] == $this->file) {
224 ilUtil::deliverFile($file["fullpath"], $file["name"]);
225 }
226 }
227 }
228 }
229 }
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 231 of file class.ilBlogExerciseGUI.php.

232 {
234
235 $ass = new ilExAssignment($this->ass_id);
236 $submission = new ilExSubmission($ass, $ilUser->getId());
237 $submitted = $submission->getFiles();
238 if (count($submitted) > 0) {
239 $submitted = array_pop($submitted);
240
241 $user_data = ilObjUser::_lookupName($submitted["user_id"]);
242 $title = ilObject::_lookupTitle($submitted["obj_id"]) . " - " .
243 $ass->getTitle() . " - " .
244 $user_data["firstname"] . " " .
245 $user_data["lastname"] . " (" .
246 $user_data["login"] . ").zip";
247
248 ilUtil::deliverFile($submitted["filename"], $title);
249 }
250 }
Exercise submission //TODO: This class has to much static methods related to delivered "files".
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 255 of file class.ilBlogExerciseGUI.php.

256 {
259
260 include_once "Modules/Exercise/classes/class.ilExSubmissionBaseGUI.php";
261 include_once "Modules/Exercise/classes/class.ilExSubmissionObjectGUI.php";
262 $exc_gui = ilExSubmissionObjectGUI::initGUIForSubmit($this->ass_id);
263 $exc_gui->submitBlog($this->node_id);
264
265 ilUtil::sendSuccess($lng->txt("blog_finalized"), true);
266 $ilCtrl->returnToParent($this);
267 }
static initGUIForSubmit($a_ass_id, $a_user_id=null)

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

+ 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 $ui = $DIC->ui();
110
111 $links = [];
112 $buttons = [];
113 $elements = [];
114
115 $lng = $DIC->language();
116 $ilCtrl = $DIC->ctrl();
117 $ilUser = $DIC->user();
118
119 $ass = new ilExAssignment($a_assignment_id);
120 $exercise_id = $ass->getExerciseId();
121 if (!$exercise_id) {
122 return;
123 }
124
125 // is the assignment still open?
126 $times_up = $ass->afterDeadlineStrict();
127
128 // exercise goto
129 include_once "./Services/Link/classes/class.ilLink.php";
130 $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
131 $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
132
133 $text = sprintf(
134 $lng->txt("blog_exercise_info"),
135 $ass->getTitle(),
136 ilObject::_lookupTitle($exercise_id)
137 );
138 $links[] = $ui->factory()->link()->standard(ilObject::_lookupTitle($exercise_id), $exc_link);
139
140 // submit button
141 if (!$times_up) {
142 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
143 $submit_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "finalize");
144 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
145
146 $buttons[] = $ui->factory()->button()->primary($lng->txt("blog_finalize_blog"), $submit_link);
147 }
148
149 // submitted files
150 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
151 $submission = new ilExSubmission($ass, $ilUser->getId());
152 if ($submission->hasSubmitted()) {
153 // #16888
154 $submitted = $submission->getSelectedObject();
155
156 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
157 $dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcSubFile");
158 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
159
162
163 $text .= "<br />" . sprintf(
164 $lng->txt("blog_exercise_submitted_info"),
166 ""
167 );
168
170 $buttons[] = $ui->factory()->button()->standard($lng->txt("blog_download_submission"), $dl_link);
171 }
172
173
174 // work instructions incl. files
175
176 $tooltip = "";
177
178 $inst = $ass->getInstruction();
179 if ($inst) {
180 $tooltip .= nl2br($inst);
181 }
182
183 $ass_files = $ass->getFiles();
184 if (count($ass_files) > 0) {
185 $tooltip .= "<br /><br />";
186
187 foreach ($ass_files as $file) {
188 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
189 $ilCtrl->setParameterByClass("ilblogexercisegui", "file", urlencode($file["name"]));
190 $dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcAssFile");
191 $ilCtrl->setParameterByClass("ilblogexercisegui", "file", "");
192 $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
193
194 $items[] = $ui->renderer()->render($ui->factory()->button()->shy($file["name"], $dl_link));
195 }
196 $list = $ui->factory()->listing()->unordered($items);
197 $tooltip .= $ui->renderer()->render($list);
198 }
199
200 if ($tooltip) {
201 $modal = $ui->factory()->modal()->roundtrip($lng->txt("exc_instruction"), $ui->factory()->legacy($tooltip))
202 ->withCancelButtonLabel("close");
203 $elements[] = $modal;
204 $buttons[] = $ui->factory()->button()->standard($lng->txt("exc_instruction"), '#')
205 ->withOnClick($modal->getShowSignal());
206 }
207
208 $elements[] = $ui->factory()->messageBox()->info($text)
209 ->withLinks($links)
210 ->withButtons($buttons);
211
212 return $ui->renderer()->render($elements);
213 }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=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
$links
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
$text
Definition: errorreport.php:18

References $DIC, $file, $ilCtrl, $ilUser, $links, $list, $lng, $text, ilObject\_getAllReferences(), ilLink\_getStaticLink(), ilObject\_lookupTitle(), ilDatePresentation\formatDate(), IL_CAL_DATETIME, ilDatePresentation\setUseRelativeDates(), 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: