ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPortfolioExerciseGUI Class Reference

Class ilPortfolioExerciseGUI. More...

+ Collaboration diagram for ilPortfolioExerciseGUI:

Public Member Functions

 __construct ($a_user_id, $a_obj_id)
 
 executeCommand ()
 
 downloadExcAssFile ()
 
 downloadExcSubFile ()
 

Static Public Member Functions

static checkExercise ($a_user_id, $a_obj_id, $a_add_submit=false)
 

Protected Member Functions

 finalize ()
 Finalize and submit portfolio to exercise. More...
 

Static Protected Member Functions

static getExerciseInfo ($a_user_id, $a_assignment_id, $a_add_submit=false)
 

Protected Attributes

 $user_id
 
 $obj_id
 
 $ass_id
 
 $file
 

Detailed Description

Class ilPortfolioExerciseGUI.

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 ilPortfolioExerciseGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilPortfolioExerciseGUI::__construct (   $a_user_id,
  $a_obj_id 
)

Definition at line 23 of file class.ilPortfolioExerciseGUI.php.

24 {
25 $this->user_id = $a_user_id;
26 $this->obj_id = $a_obj_id;
27 $this->ass_id = (int)$_GET["ass"];
28 $this->file = trim($_GET["file"]);
29 }
$_GET["client_id"]

References $_GET.

Member Function Documentation

◆ checkExercise()

static ilPortfolioExerciseGUI::checkExercise (   $a_user_id,
  $a_obj_id,
  $a_add_submit = false 
)
static

Definition at line 54 of file class.ilPortfolioExerciseGUI.php.

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

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

Referenced by ilObjPortfolioBaseGUI\view().

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

◆ downloadExcAssFile()

ilPortfolioExerciseGUI::downloadExcAssFile ( )

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

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

ilPortfolioExerciseGUI::downloadExcSubFile ( )

Definition at line 239 of file class.ilPortfolioExerciseGUI.php.

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

References ilObjUser\_lookupName(), ilObject\_lookupTitle(), and ilUtil\deliverFile().

+ Here is the call graph for this function:

◆ executeCommand()

ilPortfolioExerciseGUI::executeCommand ( )

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

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

References $cmd, and $ilCtrl.

◆ finalize()

ilPortfolioExerciseGUI::finalize ( )
protected

Finalize and submit portfolio to exercise.

Definition at line 262 of file class.ilPortfolioExerciseGUI.php.

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

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

+ Here is the call graph for this function:

◆ getExerciseInfo()

static ilPortfolioExerciseGUI::getExerciseInfo (   $a_user_id,
  $a_assignment_id,
  $a_add_submit = false 
)
staticprotected

Definition at line 96 of file class.ilPortfolioExerciseGUI.php.

97 {
98 global $lng, $ilCtrl;
99
100 include_once "Modules/Exercise/classes/class.ilExAssignment.php";
101 $ass = new ilExAssignment($a_assignment_id);
102 $exercise_id = $ass->getExerciseId();
103 if(!$exercise_id)
104 {
105 return;
106 }
107
108 // is the assignment still open?
109 $times_up = $ass->afterDeadlineStrict();
110
111 // exercise goto
112 include_once "./Services/Link/classes/class.ilLink.php";
113 $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
114 $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
115
116 $info = sprintf($lng->txt("prtf_exercise_info"),
117 $ass->getTitle(),
118 "<a href=\"".$exc_link."\">".
119 ilObject::_lookupTitle($exercise_id)."</a>");
120
121 // submit button
122 if($a_add_submit && !$times_up)
123 {
124 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "ass", $a_assignment_id);
125 $submit_link = $ilCtrl->getLinkTargetByClass("ilportfolioexercisegui", "finalize");
126 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "ass", "");
127
128 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
129 $button = ilLinkButton::getInstance();
130 $button->setCaption("prtf_finalize_portfolio");
131 $button->setPrimary(true);
132 $button->setUrl($submit_link);
133 $info .= " ".$button->render();
134 }
135
136 // submitted files
137 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
138 $submission = new ilExSubmission($ass, $a_user_id);
139 if($submission->hasSubmitted())
140 {
141 // #16888
142 $submitted = $submission->getSelectedObject();
143
144 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "ass", $a_assignment_id);
145 $dl_link = $ilCtrl->getLinkTargetByClass("ilportfolioexercisegui", "downloadExcSubFile");
146 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "ass", "");
147
150
151 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
152 $button = ilLinkButton::getInstance();
153 $button->setCaption("download");
154 $button->setUrl($dl_link);
155
156 $info .= "<br />".sprintf($lng->txt("prtf_exercise_submitted_info"),
158 $button->render());
159
161 }
162
163
164 // work instructions incl. files
165
166 $tooltip = "";
167
168 $inst = $ass->getInstruction();
169 if($inst)
170 {
171 $tooltip .= nl2br($inst);
172 }
173
174 $ass_files = $ass->getFiles();
175 if (count($ass_files) > 0)
176 {
177 if($tooltip)
178 {
179 $tooltip .= "<br /><br />";
180 }
181
182 foreach($ass_files as $file)
183 {
184 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "ass", $a_assignment_id);
185 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "file", urlencode($file["name"]));
186 $dl_link = $ilCtrl->getLinkTargetByClass("ilportfolioexercisegui", "downloadExcAssFile");
187 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "file", "");
188 $ilCtrl->setParameterByClass("ilportfolioexercisegui", "ass", "");
189
190 $tooltip .= $file["name"].": <a href=\"".$dl_link."\">".
191 $lng->txt("download")."</a>";
192 }
193 }
194
195 if($tooltip)
196 {
197 $ol_id = "exc_ass_".$a_assignment_id;
198
199 include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
200 $overlay = new ilOverlayGUI($ol_id);
201
202 // overlay
203 $overlay->setAnchor($ol_id."_tr");
204 $overlay->setTrigger($ol_id."_tr", "click", $ol_id."_tr");
205 $overlay->setAutoHide(false);
206 // $overlay->setCloseElementId($cl_id);
207 $overlay->add();
208
209 // trigger
210 $overlay->addTrigger($ol_id."_tr", "click", $ol_id."_tr");
211
212 $info .= "<div id=\"".$ol_id."_tr\"><a href=\"#\">".$lng->txt("exc_instruction")."</a></div>".
213 "<div id=\"".$ol_id."\" style=\"display:none; background-color:white; border: 1px solid #bbb; padding: 10px;\">".$tooltip."</div>";
214 }
215
216 return $info;
217 }
const IL_CAL_DATETIME
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
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 $file, $ilCtrl, $info, $lng, ilObject\_getAllReferences(), ilLink\_getStaticLink(), ilObject\_lookupTitle(), ilDatePresentation\formatDate(), ilLinkButton\getInstance(), 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

ilPortfolioExerciseGUI::$ass_id
protected

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

◆ $file

ilPortfolioExerciseGUI::$file
protected

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

Referenced by downloadExcAssFile(), and getExerciseInfo().

◆ $obj_id

ilPortfolioExerciseGUI::$obj_id
protected

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

◆ $user_id

ilPortfolioExerciseGUI::$user_id
protected

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


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