38 protected \ILIAS\DI\UIServices
$ui;
46 $this->main_tpl = $DIC->ui()->mainTemplate();
48 $this->
ctrl = $DIC->ctrl();
49 $this->
lng = $DIC->language();
50 $this->user_id = $a_user_id;
51 $this->obj_id = $a_obj_id;
53 $this->port_request = $DIC->portfolio()
58 $this->ass_id = $this->port_request->getExcAssId();
59 $this->file = $this->port_request->getExcFile();
60 $this->
ui = $DIC->ui();
61 $this->exc_domain = $DIC->exercise()->internal()->domain();
70 $this->
ctrl->returnToParent($this);
73 $next_class = $ilCtrl->getNextClass($this);
74 $cmd = $ilCtrl->getCmd();
76 switch ($next_class) {
90 bool $a_add_submit =
false,
91 bool $as_array =
false 97 $part = self::getExerciseInfo($a_user_id,
$exercise[
"ass_id"], $a_add_submit, $as_array);
102 if (count($info) && !$as_array) {
103 return implode(
"<br />", $info);
120 int $a_assignment_id,
121 bool $a_add_submit =
false,
122 bool $as_array =
false 132 $lng = $DIC->language();
133 $ilCtrl = $DIC->ctrl();
137 $exercise_id = $ass->getExerciseId();
143 $times_up = $ass->afterDeadlineStrict();
147 $exc_ref_id = array_shift($ref_ids);
150 $info_arr[
"ass_title"] = $ass->getTitle();
152 $lng->
txt(
"prtf_exercise_info"),
160 if ($a_add_submit && !$times_up && !$as_array) {
161 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $a_assignment_id);
162 $submit_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"finalize");
163 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
165 $buttons[] = $ui->factory()->button()->primary($lng->
txt(
"prtf_finalize_portfolio"), $submit_link);
170 $info_arr[
"submitted"] =
false;
171 if ($submission->hasSubmitted()) {
173 $submitted = $submission->getSelectedObject();
176 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $a_assignment_id);
177 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"downloadExcSubFile");
178 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
183 $text .=
"<p>" . sprintf(
184 $lng->
txt(
"prtf_exercise_submitted_info"),
188 $buttons[] = $ui->factory()->button()->standard($lng->
txt(
"prtf_download_submission"), $dl_link);
193 $info_arr[
"submitted"] =
true;
194 if ($submitted?->getTimestamp() ==
"") {
195 $info_arr[
"submitted"] =
false;
203 $inst = $ass->getInstruction();
205 $tooltip .= nl2br($inst);
208 $ass_files = $ass->getFiles();
209 if (!$as_array && count($ass_files) > 0) {
211 $tooltip .=
"<br /><br />";
216 foreach ($ass_files as $file) {
217 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $a_assignment_id);
218 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"file", urlencode($file[
"name"]));
219 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"downloadExcAssFile");
220 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"file",
"");
221 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
223 $items[] = $ui->renderer()->render($ui->factory()->button()->shy($file[
"name"], $dl_link));
225 $list = $ui->factory()->listing()->unordered($items);
226 $tooltip .= $ui->renderer()->render($list);
230 $modal = $ui->factory()->modal()->roundtrip($lng->
txt(
"exc_instruction"), $ui->factory()->legacy()->content($tooltip))
231 ->withCancelButtonLabel($lng->
txt(
"close"));
232 $elements[] = $modal;
233 $buttons[] = $ui->factory()->button()->standard($lng->
txt(
"exc_instruction"),
'#')
234 ->withOnClick($modal->getShowSignal());
241 $elements[] = $ui->factory()->messageBox()->info($text)
243 ->withButtons($buttons);
245 return $ui->renderer()->render($elements);
252 $ass_files = $ass->getFiles();
253 if (count($ass_files) > 0) {
254 foreach ($ass_files as $file) {
255 if ($file[
"name"] == $this->file) {
266 $sub_manager = $this->exc_domain->submission($this->ass_id);
267 $sub = $sub_manager->getSubmissionsOfUser($this->user_id)->current();
271 $ass->getTitle() .
" - " .
272 $user_data[
"firstname"] .
" " .
273 $user_data[
"lastname"] .
" (" .
274 $user_data[
"login"] .
").zip";
276 $sub_manager->deliverFile(
293 $exc_gui->submitPortfolio($this->obj_id);
295 $this->main_tpl->setOnScreenMessage(
'success', $lng->
txt(
"prtf_finalized"),
true);
296 $ilCtrl->returnToParent($this);
312 if ($state->isSubmissionAllowed()) {
313 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $ass_id);
314 $submit_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"finalize");
315 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
316 $button = $ui->factory()->button()->primary($lng->
txt(
"prtf_finalize_portfolio"), $submit_link);
331 if ($submission->hasSubmitted()) {
333 $submitted = $submission->getSelectedObject();
334 if ($submitted?->getTimestamp() !=
"") {
335 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass", $ass_id);
336 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilportfolioexercisegui",
"downloadExcSubFile");
337 $ilCtrl->setParameterByClass(
"ilportfolioexercisegui",
"ass",
"");
338 $button = $ui->factory()->button()->standard($lng->
txt(
"prtf_download_submission"), $dl_link);
358 if (count($pages) > 0) {
360 if ($submit_button) {
361 $buttons[
$ass_id][] = $submit_button;
365 if ($download_button) {
366 $buttons[
$ass_id][] = $download_button;
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
static array static setUseRelativeDates(bool $a_status)
set use relative dates
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Interface Observer Contains several chained tasks and infos about them.
static checkExercise(int $a_user_id, int $a_obj_id, bool $a_add_submit=false, bool $as_array=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupName(int $a_user_id)
lookup user name
getDownloadSubmissionButton(int $ass_id)
__construct(int $a_user_id, int $a_obj_id)
getSubmitButton(int $ass_id)
Get submit link.
Class ilPortfolioExerciseGUI.
static useRelativeDates()
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
getActionButtons()
Get action buttons.
static initGUIForSubmit(int $a_ass_id, ?int $a_user_id=null)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
ilGlobalTemplateInterface $main_tpl
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
getAssignmentsOfPortfolio()
StandardGUIRequest $port_request
static getExerciseInfo(int $a_user_id, int $a_assignment_id, bool $a_add_submit=false, bool $as_array=false)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
finalize()
Finalize and submit portfolio to exercise.
Exercise submission //TODO: This class has many static methods related to delivered "files"...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Exercise InternalDomainService $exc_domain