43 $this->ctrl = $DIC->ctrl();
44 $this->lng = $DIC->language();
45 $this->user_id = $a_user_id;
46 $this->obj_id = $a_obj_id;
47 $this->ass_id = (int)
$_GET[
"ass"];
48 $this->file = trim(
$_GET[
"file"]);
49 $this->
ui = $DIC->ui();
58 $this->ctrl->returnToParent($this);
61 $next_class = $ilCtrl->getNextClass($this);
62 $cmd = $ilCtrl->getCmd();
64 switch ($next_class) {
73 public static function checkExercise($a_user_id, $a_obj_id, $a_add_submit =
false, $as_array =
false)
78 foreach (
$pe->getAssignmentsOfPortfolio() as
$exercise) {
79 $part = self::getExerciseInfo($a_user_id,
$exercise[
"ass_id"], $a_add_submit, $as_array);
84 if (
sizeof($info) && !$as_array) {
85 return implode(
"<br />", $info);
101 protected static function getExerciseInfo($a_user_id, $a_assignment_id, $a_add_submit =
false, $as_array =
false)
111 $lng = $DIC->language();
112 $ilCtrl = $DIC->ctrl();
115 $exercise_id = $ass->getExerciseId();
121 $times_up = $ass->afterDeadlineStrict();
127 $info_arr[
"ass_title"] = $ass->getTitle();
129 $lng->txt(
"prtf_exercise_info"),
137 if ($a_add_submit && !$times_up && !$as_array) {
138 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $a_assignment_id);
139 $submit_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"finalize");
140 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
142 $buttons[] =
$ui->factory()->button()->primary(
$lng->txt(
"prtf_finalize_portfolio"), $submit_link);
147 $info_arr[
"submitted"] =
false;
148 if ($submission->hasSubmitted()) {
150 $submitted = $submission->getSelectedObject();
153 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $a_assignment_id);
154 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"downloadExcSubFile");
155 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
160 $text .=
"<p>" . sprintf(
161 $lng->txt(
"prtf_exercise_submitted_info"),
165 $buttons[] =
$ui->factory()->button()->standard(
$lng->txt(
"prtf_download_submission"), $dl_link);
170 $info_arr[
"submitted"] =
true;
171 if ($submitted[
"ts"] ==
"") {
172 $info_arr[
"submitted"] =
false;
180 $inst = $ass->getInstruction();
182 $tooltip .= nl2br($inst);
185 $ass_files = $ass->getFiles();
187 if (count($ass_files) > 0) {
189 $tooltip .=
"<br /><br />";
194 foreach ($ass_files as
$file) {
195 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $a_assignment_id);
196 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"file", urlencode($file[
"name"]));
197 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"downloadExcAssFile");
198 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"file",
"");
199 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
201 $items[] =
$ui->renderer()->render(
$ui->factory()->button()->shy($file[
"name"], $dl_link));
203 $list =
$ui->factory()->listing()->unordered($items);
204 $tooltip .=
$ui->renderer()->render($list);
209 $modal =
$ui->factory()->modal()->roundtrip(
$lng->txt(
"exc_instruction"),
$ui->factory()->legacy($tooltip))
210 ->withCancelButtonLabel(
"close");
211 $elements[] = $modal;
212 $buttons[] =
$ui->factory()->button()->standard(
$lng->txt(
"exc_instruction"),
'#')
213 ->withOnClick($modal->getShowSignal());
220 $elements[] =
$ui->factory()->messageBox()->info($text)
222 ->withButtons($buttons);
224 return $ui->renderer()->render($elements);
231 $ass_files = $ass->getFiles();
232 if (count($ass_files) > 0) {
233 foreach ($ass_files as
$file) {
234 if ($file[
"name"] == $this->file) {
246 $submitted = $submission->getFiles();
247 if (count($submitted) > 0) {
248 $submitted = array_pop($submitted);
252 $ass->getTitle() .
" - " .
253 $user_data[
"firstname"] .
" " .
254 $user_data[
"lastname"] .
" (" .
255 $user_data[
"login"] .
").zip";
270 $exc_gui->submitPortfolio($this->obj_id);
272 ilUtil::sendSuccess(
$lng->txt(
"prtf_finalized"),
true);
273 $ilCtrl->returnToParent($this);
290 if ($state->isSubmissionAllowed()) {
291 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $ass_id);
292 $submit_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"finalize");
293 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
294 $button =
$ui->factory()->button()->primary(
$lng->txt(
"prtf_finalize_portfolio"), $submit_link);
314 if ($submission->hasSubmitted()) {
316 $submitted = $submission->getSelectedObject();
317 if ($submitted[
"ts"] !=
"") {
318 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $ass_id);
319 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"downloadExcSubFile");
320 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
321 $button =
$ui->factory()->button()->standard(
$lng->txt(
"prtf_download_submission"), $dl_link);
339 foreach (
$pe->getAssignmentsOfPortfolio() as
$exercise) {
343 if ($submit_button != null) {
344 $buttons[
$ass_id][] = $submit_button;
347 if ($download_button != null) {
348 $buttons[
$ass_id][] = $download_button;
static _lookupName($a_user_id)
lookup user name
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
getDownloadSubmissionButton(int $ass_id)
Get download button.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getSubmitButton(int $ass_id)
Get submit link.
Class ilPortfolioExerciseGUI.
static _getAllReferences($a_id)
get all reference ids of object
static getInstanceByIds($a_ass_id, $a_user_id=0)
Get instance by IDs (recommended for consumer code)
static useRelativeDates()
check if relative dates are used
static initGUIForSubmit($a_ass_id, $a_user_id=null)
getActionButtons()
Get action buttons.
static checkExercise($a_user_id, $a_obj_id, $a_add_submit=false, $as_array=false)
finalize()
Finalize and submit portfolio to exercise.
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
__construct($a_user_id, $a_obj_id)
Exercise info for portfolios.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getExerciseInfo($a_user_id, $a_assignment_id, $a_add_submit=false, $as_array=false)