ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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

 $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

ilBlogExerciseGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilBlogExerciseGUI::__construct (   $a_node_id)

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

References $_GET.

23  {
24  $this->node_id = $a_node_id;
25  $this->ass_id = (int)$_GET["ass"];
26  $this->file = trim($_GET["file"]);
27  }
$_GET["client_id"]

Member Function Documentation

◆ checkExercise()

static ilBlogExerciseGUI::checkExercise (   $a_node_id)
static

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

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

Referenced by ilObjBlogGUI\render().

52  {
53  global $tree, $ilUser;
54 
55  $exercises = ilExSubmission::findUserFiles($ilUser->getId(), $a_node_id);
56  // #0022794
57  if (!$exercises)
58  {
59  $exercises = ilExSubmission::findUserFiles($ilUser->getId(), $a_node_id.".sec");
60  }
61  if($exercises)
62  {
63  $info = array();
64  foreach($exercises as $exercise)
65  {
66  // #9988
67  $active_ref = false;
68  foreach(ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id)
69  {
70  if(!$tree->isSaved($ref_id))
71  {
72  $active_ref = true;
73  break;
74  }
75  }
76  if($active_ref)
77  {
78  $part = self::getExerciseInfo($exercise["ass_id"]);
79  if($part)
80  {
81  $info[] = $part;
82  }
83  }
84  }
85  if(sizeof($info))
86  {
87  return implode("<br />", $info);
88  }
89  }
90  }
static _getAllReferences($a_id)
get all reference ids of object
$info
Definition: example_052.php:80
static findUserFiles($a_user_id, $a_filetitle)
Check if given file was assigned.
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ downloadExcAssFile()

ilBlogExerciseGUI::downloadExcAssFile ( )
protected

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

References $file, and ilUtil\deliverFile().

207  {
208  if($this->file)
209  {
210  include_once "Modules/Exercise/classes/class.ilExAssignment.php";
211  $ass = new ilExAssignment($this->ass_id);
212  $ass_files = $ass->getFiles();
213  if (count($ass_files) > 0)
214  {
215  foreach($ass_files as $file)
216  {
217  if($file["name"] == $this->file)
218  {
219  ilUtil::deliverFile($file["fullpath"], $file["name"]);
220  }
221  }
222  }
223  }
224  }
Exercise assignment.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ downloadExcSubFile()

ilBlogExerciseGUI::downloadExcSubFile ( )
protected

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

References $ilUser, ilObjUser\_lookupName(), ilObject\_lookupTitle(), ilUtil\deliverFile(), and ilExSubmission\getFiles().

227  {
228  global $ilUser;
229 
230  $ass = new ilExAssignment($this->ass_id);
231  $submission = new ilExSubmission($ass, $ilUser->getId());
232  $submitted = $submission->getFiles();
233  if (count($submitted) > 0)
234  {
235  $submitted = array_pop($submitted);
236 
237  $user_data = ilObjUser::_lookupName($submitted["user_id"]);
238  $title = ilObject::_lookupTitle($submitted["obj_id"])." - ".
239  $ass->getTitle()." - ".
240  $user_data["firstname"]." ".
241  $user_data["lastname"]." (".
242  $user_data["login"].").zip";
243 
244  ilUtil::deliverFile($submitted["filename"], $title);
245  }
246  }
static _lookupName($a_user_id)
lookup user name
Exercise assignment.
static _lookupTitle($a_id)
lookup object title
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
global $ilUser
Definition: imgupload.php:15
Exercise submission.
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
+ Here is the call graph for this function:

◆ executeCommand()

ilBlogExerciseGUI::executeCommand ( )

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

References $cmd, and $ilCtrl.

30  {
31  global $ilCtrl;
32 
33  if(!$this->ass_id)
34  {
35  $this->ctrl->returnToParent($this);
36  }
37 
38  $next_class = $ilCtrl->getNextClass($this);
39  $cmd = $ilCtrl->getCmd();
40 
41  switch($next_class)
42  {
43  default:
44  $this->$cmd();
45  break;
46  }
47 
48  return true;
49  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ finalize()

ilBlogExerciseGUI::finalize ( )
protected

Finalize and submit blog to exercise.

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

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

252  {
253  global $ilCtrl, $lng;
254 
255  include_once "Modules/Exercise/classes/class.ilExSubmissionBaseGUI.php";
256  include_once "Modules/Exercise/classes/class.ilExSubmissionObjectGUI.php";
257  $exc_gui = ilExSubmissionObjectGUI::initGUIForSubmit($this->ass_id);
258  $exc_gui->submitBlog($this->node_id);
259 
260  ilUtil::sendSuccess($lng->txt("blog_finalized"), true);
261  $ilCtrl->returnToParent($this);
262  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
static initGUIForSubmit($a_ass_id, $a_user_id=null)
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getExerciseInfo()

static ilBlogExerciseGUI::getExerciseInfo (   $a_assignment_id)
staticprotected

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

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

93  {
94  global $lng, $ilCtrl, $ilUser;
95 
96  $ass = new ilExAssignment($a_assignment_id);
97  $exercise_id = $ass->getExerciseId();
98  if(!$exercise_id)
99  {
100  return;
101  }
102 
103  // is the assignment still open?
104  $times_up = $ass->afterDeadlineStrict();
105 
106  // exercise goto
107  include_once "./Services/Link/classes/class.ilLink.php";
108  $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
109  $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
110 
111  $info = sprintf($lng->txt("blog_exercise_info"),
112  $ass->getTitle(),
113  "<a href=\"".$exc_link."\">".
114  ilObject::_lookupTitle($exercise_id)."</a>");
115 
116  // submit button
117  if(!$times_up)
118  {
119  $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
120  $submit_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "finalize");
121  $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
122 
123  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
124  $button = ilLinkButton::getInstance();
125  $button->setCaption("blog_finalize_blog");
126  $button->setPrimary(true);
127  $button->setUrl($submit_link);
128  $info .= " ".$button->render();
129  }
130 
131  // submitted files
132  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
133  $submission = new ilExSubmission($ass, $ilUser->getId());
134  if($submission->hasSubmitted())
135  {
136  // #16888
137  $submitted = $submission->getSelectedObject();
138 
139  $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
140  $dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcSubFile");
141  $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
142 
145 
146  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
147  $button = ilLinkButton::getInstance();
148  $button->setCaption("download");
149  $button->setUrl($dl_link);
150 
151  $info .= "<br />".sprintf($lng->txt("blog_exercise_submitted_info"),
153  $button->render());
154 
156  }
157 
158 
159  // work instructions incl. files
160 
161  $tooltip = "";
162 
163  $inst = $ass->getInstruction();
164  if($inst)
165  {
166  $tooltip .= nl2br($inst);
167  }
168 
169  $ass_files = $ass->getFiles();
170  if (count($ass_files) > 0)
171  {
172  $tooltip .= "<br /><br />";
173 
174  foreach($ass_files as $file)
175  {
176  $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
177  $ilCtrl->setParameterByClass("ilblogexercisegui", "file", urlencode($file["name"]));
178  $dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcAssFile");
179  $ilCtrl->setParameterByClass("ilblogexercisegui", "file", "");
180  $ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
181 
182  $tooltip .= $file["name"].": <a href=\"".$dl_link."\">".
183  $lng->txt("download")."</a>";
184  }
185  }
186 
187  if($tooltip)
188  {
189  $ol_id = "exc_ass_".$a_assignment_id;
190 
191  include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
192  $overlay = new ilOverlayGUI($ol_id);
193 
194  // overlay
195  $overlay->setAnchor($ol_id."_tr");
196  $overlay->setTrigger($ol_id."_tr", "click", $ol_id."_tr");
197  $overlay->add();
198 
199  $info .= "<div id=\"".$ol_id."_tr\"><a href=\"#\">".$lng->txt("exc_instruction")."</a></div>".
200  "<div id=\"".$ol_id."\" style=\"display:none; padding:10px;\" class=\"ilOverlay\">".$tooltip."</div>";
201  }
202 
203  return "<div>".$info."</div>";
204  }
Exercise assignment.
const IL_CAL_DATETIME
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static useRelativeDates()
check if relative dates are used
global $ilCtrl
Definition: ilias.php:18
$info
Definition: example_052.php:80
This is a utility class for the yui overlays.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
Exercise submission.
+ Here is the call graph for this function:

Field Documentation

◆ $ass_id

ilBlogExerciseGUI::$ass_id
protected

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

◆ $file

ilBlogExerciseGUI::$file
protected

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

Referenced by downloadExcAssFile(), and getExerciseInfo().

◆ $node_id

ilBlogExerciseGUI::$node_id
protected

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


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