ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilExSubmissionObjectGUI Class Reference

Object-based submissions (ends up as static file) More...

+ Inheritance diagram for ilExSubmissionObjectGUI:
+ Collaboration diagram for ilExSubmissionObjectGUI:

Public Member Functions

 executeCommand ()
 Execute command. More...
 
 submitBlog ($a_blog_id)
 Submit blog for assignment. More...
 
 submitPortfolio ($a_portfolio_id)
 Submit portfolio for assignment. More...
 
- Public Member Functions inherited from ilExSubmissionBaseGUI
 __construct (ilObjExercise $a_exercise, ilExSubmission $a_submission)
 
 returnToParentObject ()
 

Static Public Member Functions

static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 
static initGUIForSubmit ($a_ass_id, $a_user_id=null)
 
- Static Public Member Functions inherited from ilExSubmissionBaseGUI
static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 

Protected Member Functions

 renderResourceSelection ($a_title, $a_info, $a_cmd, $a_explorer_cmd, array $a_items=null)
 
 createBlogObject ()
 
 selectBlogObject ()
 
 saveBlogObject ()
 
 setSelectedBlogObject ()
 
 renderWorkspaceExplorer ($a_cmd)
 
 selectPortfolioObject ()
 
 initPortfolioTemplateForm (array $a_templates)
 
 createPortfolioFromAssignmentObject ()
 
 createPortfolioTemplateObject (ilPropertyFormGUI $a_form=null)
 
 setSelectedPortfolioTemplateObject ()
 
 createPortfolioObject ()
 
 setSelectedPortfolioObject ()
 
 askUnlinkPortfolioObject ()
 
 unlinkPortfolioObject ()
 
 askDirectSubmissionObject ()
 
 directSubmitObject ()
 
- Protected Member Functions inherited from ilExSubmissionBaseGUI
 handleTabs ()
 
 handleNewUpload ($a_no_notifications=false)
 
 handleRemovedUpload ()
 
 triggerAssignmentTool ()
 Trigger assigment tool. More...
 

Static Protected Member Functions

static getOverviewContentBlog (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 
static getOverviewContentPortfolio (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 

Additional Inherited Members

- Protected Attributes inherited from ilExSubmissionBaseGUI
 $ctrl
 
 $tabs_gui
 
 $lng
 
 $tpl
 
 $exercise
 
 $submission
 
 $assignment
 
 $mandatory_manager
 
 $tool_context
 
 $type_guis
 

Detailed Description

Object-based submissions (ends up as static file)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

ilExSubmissionObjectGUI:

Definition at line 12 of file class.ilExSubmissionObjectGUI.php.

Member Function Documentation

◆ askDirectSubmissionObject()

ilExSubmissionObjectGUI::askDirectSubmissionObject ( )
protected

Definition at line 575 of file class.ilExSubmissionObjectGUI.php.

References ilExSubmissionBaseGUI\$tpl, $txt, ilExSubmissionBaseGUI\returnToParentObject(), and ilUtil\sendInfo().

576  {
577  $tpl = $this->tpl;
578 
579  if (!$this->submission->canSubmit()) {
580  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
581  $this->returnToParentObject();
582  }
583 
584  $conf = new ilConfirmationGUI();
585 
586  if ($_REQUEST["blog_id"]) {
587  $this->ctrl->setParameter($this, "blog_id", $_REQUEST["blog_id"]);
588  $txt = $this->lng->txt("exc_direct_submit_blog");
589  } else {
590  $this->ctrl->setParameter($this, "prtf_id", $_REQUEST["prtf_id"]);
591  $txt = $this->lng->txt("exc_direct_submit_portfolio");
592  }
593  $conf->setFormAction($this->ctrl->getFormAction($this, "directSubmit"));
594 
595  $conf->setHeaderText($txt);
596  $conf->setConfirm($this->lng->txt("exc_direct_submit"), "directSubmit");
597  $conf->setCancel($this->lng->txt("exc_direct_no_submit"), "returnToParent");
598 
599  $tpl->setContent($conf->getHTML());
600  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$txt
Definition: error.php:13
Confirmation screen class.
+ Here is the call graph for this function:

◆ askUnlinkPortfolioObject()

ilExSubmissionObjectGUI::askUnlinkPortfolioObject ( )
protected

Definition at line 536 of file class.ilExSubmissionObjectGUI.php.

References ilExSubmissionBaseGUI\$submission, ilExSubmissionBaseGUI\$tpl, and ilUtil\getImagePath().

537  {
538  $tpl = $this->tpl;
539 
540  $conf = new ilConfirmationGUI();
541  $conf->setFormAction($this->ctrl->getFormAction($this, "unlinkPortfolio"));
542  $conf->setHeaderText($this->lng->txt("exc_sure_unlink_portfolio", "sure_unlink_portfolio"));
543  $conf->setConfirm($this->lng->txt("confirm"), "unlinkPortfolio");
544  $conf->setCancel($this->lng->txt("cancel"), "returnToParent");
545 
546  $submission = $this->submission->getSelectedObject();
547  $port = new ilObjPortfolio($submission["filetitle"], false);
548 
549  $conf->addItem("id[]", "", $port->getTitle(), ilUtil::getImagePath("icon_prtf.svg"));
550 
551  $tpl->setContent($conf->getHTML());
552  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Confirmation screen class.
+ Here is the call graph for this function:

◆ createBlogObject()

ilExSubmissionObjectGUI::createBlogObject ( )
protected

Definition at line 255 of file class.ilExSubmissionObjectGUI.php.

References ilExSubmissionBaseGUI\handleTabs(), and renderResourceSelection().

Referenced by saveBlogObject().

256  {
257  $this->handleTabs();
258 
259  return $this->renderResourceSelection(
260  "exc_create_blog",
261  "exc_create_blog_select_info",
262  "saveBlog",
263  "createBlog"
264  );
265  }
renderResourceSelection($a_title, $a_info, $a_cmd, $a_explorer_cmd, array $a_items=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPortfolioFromAssignmentObject()

ilExSubmissionObjectGUI::createPortfolioFromAssignmentObject ( )
protected

Definition at line 411 of file class.ilExSubmissionObjectGUI.php.

References $_GET, ilExSubmissionBaseGUI\$ctrl, $DIC, ilObject\_lookupObjectId(), createPortfolioTemplateObject(), and ilObjPortfolioTemplate\getAvailablePortfolioTemplates().

412  {
413  global $DIC;
414 
415  $ctrl = $DIC->ctrl();
416 
418 
419  //template id is stored in the DB with the ref_id.
420  $template_id = $this->assignment->getPortfolioTemplateId();
421  //get the object id to compare with a list of template objects.
422  $template_object_id = ilObject::_lookupObjectId($template_id);
423 
424  // select a template, if available
425  if (count($templates) > 0 && $template_object_id == 0) {
427  return;
428  }
429 
430  $title = $this->exercise->getTitle() . " - " . $this->assignment->getTitle();
431  $ctrl->setParameterByClass("ilObjPortfolioGUI", "exc_id", $this->exercise->getRefId());
432  $ctrl->setParameterByClass("ilObjPortfolioGUI", "ass_id", $this->assignment->getId());
433  $ctrl->setParameterByClass("ilObjPortfolioGUI", "pt", $title);
434 
435  if ($template_object_id > 0) {
436  $ctrl->setParameterByClass("ilObjPortfolioGUI", "prtt", $template_object_id);
437  }
438  $ctrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
439  $ctrl->redirectByClass(array("ildashboardgui", "ilPortfolioRepositoryGUI", "ilObjPortfolioGUI"), "createPortfolioFromAssignment");
440  }
$_GET["client_id"]
createPortfolioTemplateObject(ilPropertyFormGUI $a_form=null)
static _lookupObjectId($a_ref_id)
lookup object id
static getAvailablePortfolioTemplates($a_permission="read")
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ createPortfolioObject()

ilExSubmissionObjectGUI::createPortfolioObject ( )
protected

Definition at line 494 of file class.ilExSubmissionObjectGUI.php.

References ilExSubmissionBaseGUI\handleRemovedUpload(), ilExSubmissionBaseGUI\returnToParentObject(), and ilUtil\sendInfo().

Referenced by setSelectedPortfolioTemplateObject().

495  {
496  if (!$this->submission->canSubmit()) {
497  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
498  $this->returnToParentObject();
499  }
500 
501  $portfolio = new ilObjPortfolio();
502  $portfolio->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
503  $portfolio->create();
504 
505  $this->submission->deleteAllFiles();
506  $this->handleRemovedUpload();
507 
508  $this->submission->addResourceObject($portfolio->getId());
509 
510  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_created"), true);
511  $this->returnToParentObject();
512  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPortfolioTemplateObject()

ilExSubmissionObjectGUI::createPortfolioTemplateObject ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 442 of file class.ilExSubmissionObjectGUI.php.

References ilObjPortfolioTemplate\getAvailablePortfolioTemplates(), initPortfolioTemplateForm(), ilExSubmissionBaseGUI\returnToParentObject(), and ilUtil\sendInfo().

Referenced by createPortfolioFromAssignmentObject(), and setSelectedPortfolioTemplateObject().

443  {
444  if (!$this->submission->canSubmit()) {
445  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
446  $this->returnToParentObject();
447  }
448 
450  if (!sizeof($templates)) {
451  $this->returnToParentObject();
452  }
453 
454  if (!$a_form) {
455  $a_form = $this->initPortfolioTemplateForm($templates);
456  }
457 
458  $this->tpl->setContent($a_form->getHTML());
459  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getAvailablePortfolioTemplates($a_permission="read")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ directSubmitObject()

ilExSubmissionObjectGUI::directSubmitObject ( )
protected

Definition at line 602 of file class.ilExSubmissionObjectGUI.php.

References $success, ilExSubmissionBaseGUI\returnToParentObject(), ilUtil\sendFailure(), ilUtil\sendInfo(), submitBlog(), and submitPortfolio().

603  {
604  if (!$this->submission->canSubmit()) {
605  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
606  $this->returnToParentObject();
607  }
608 
609  $success = false;
610 
611  // submit current version of blog
612  if ($_REQUEST["blog_id"]) {
613  $success = $this->submitBlog($_REQUEST["blog_id"]);
614  $this->ctrl->setParameter($this, "blog_id", "");
615  }
616  // submit current version of portfolio
617  elseif ($_REQUEST["prtf_id"]) {
618  $success = $this->submitPortfolio($_REQUEST["prtf_id"]);
619  $this->ctrl->setParameter($this, "prtf_id", "");
620  }
621 
622  if ($success) {
623  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
624  } else {
625  ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
626  }
627  $this->ctrl->redirect($this, "returnToParent");
628  }
submitBlog($a_blog_id)
Submit blog for assignment.
submitPortfolio($a_portfolio_id)
Submit portfolio for assignment.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$success
Definition: Utf8Test.php:86
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ executeCommand()

ilExSubmissionObjectGUI::executeCommand ( )

Execute command.

Returns
mixed
Exceptions
ilCtrlException

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

References ilExSubmissionBaseGUI\$ctrl, $ilCtrl, and ilExSubmissionBaseGUI\returnToParentObject().

21  {
23 
24  if (!$this->submission->canView()) {
25  $this->returnToParentObject();
26  }
27 
28  $class = $ilCtrl->getNextClass($this);
29  $cmd = $ilCtrl->getCmd();
30 
31  switch ($class) {
32  default:
33  $this->{$cmd . "Object"}();
34  break;
35  }
36  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getOverviewContent()

static ilExSubmissionObjectGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
static

Definition at line 38 of file class.ilExSubmissionObjectGUI.php.

References ilExSubmission\getAssignment(), ilExAssignment\TYPE_BLOG, and ilExAssignment\TYPE_PORTFOLIO.

39  {
40  switch ($a_submission->getAssignment()->getType()) {
42  return self::getOverviewContentBlog($a_info, $a_submission);
43 
45  return self::getOverviewContentPortfolio($a_info, $a_submission);
46  }
47  }
+ Here is the call graph for this function:

◆ getOverviewContentBlog()

static ilExSubmissionObjectGUI::getOverviewContentBlog ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
staticprotected

Definition at line 49 of file class.ilExSubmissionObjectGUI.php.

References $DIC, $ilCtrl, ilExSubmissionBaseGUI\$lng, ilInfoScreenGUI\addProperty(), ilExSubmission\canSubmit(), ilWorkspaceTree\createTreeForUser(), ilExSubmission\deleteResourceObject(), ilLinkButton\getInstance(), ilExSubmission\getSelectedObject(), ilExSubmission\getUserId(), and ilExSubmission\hasSubmitted().

50  {
51  global $DIC;
52 
53  $lng = $DIC->language();
54  $ilCtrl = $DIC->ctrl();
55 
56  $wsp_tree = new ilWorkspaceTree($a_submission->getUserId());
57 
58  // #12939
59  if (!$wsp_tree->getRootId()) {
60  $wsp_tree->createTreeForUser($a_submission->getUserId());
61  }
62 
63  $files_str = "";
64  $buttons_str = "";
65  $valid_blog = false;
66  $selected_blog = $a_submission->getSelectedObject();
67  if ($selected_blog) {
68  $blog_id = (int) $selected_blog["filetitle"];
69  $node = $wsp_tree->getNodeData($blog_id);
70  if ($node["title"]) {
71  // #10116
72  $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
73  $blog_link = $ilCtrl->getLinkTargetByClass(array("ildashboardgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
74  $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
75  $files_str = '<a href="' . $blog_link . '">' .
76  $node["title"] . '</a>';
77  $valid_blog = true;
78  }
79  // remove invalid resource if no upload yet (see download below)
80  elseif (substr($selected_blog["filename"], -1) == "/") {
81  // #16887
82  $a_submission->deleteResourceObject($selected_blog["returned_id"]);
83  }
84  }
85  if ($a_submission->canSubmit()) {
86  if (!$valid_blog) {
87  $button = ilLinkButton::getInstance();
88  $button->setCaption("exc_create_blog");
89  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createBlog"));
90  $buttons_str .= $button->render();
91  }
92  // #10462
93  $blogs = sizeof($wsp_tree->getObjectsFromType("blog"));
94  if ((!$valid_blog && $blogs)
95  || ($valid_blog && $blogs > 1)) {
96  $button = ilLinkButton::getInstance();
97  $button->setCaption("exc_select_blog" . ($valid_blog ? "_change" : ""));
98  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectBlog"));
99  $buttons_str .= " " . $button->render();
100  }
101  }
102 
103  // todo: move this to ks somehow
104  if ($buttons_str != "") {
105  $files_str .= "<p>" . $buttons_str . "</p>";
106  }
107 
108 
109  if ($files_str) {
110  $a_info->addProperty($lng->txt("exc_blog_returned"), $files_str);
111  }
112  if ($a_submission->hasSubmitted()) {
113  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_blog["returned_id"]);
114  $dl_link = $ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
115  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
116 
117  $button = ilLinkButton::getInstance();
118  $button->setCaption("download");
119  $button->setUrl($dl_link);
120 
121  $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
122  }
123  }
createTreeForUser($a_user_id)
Create personal workspace tree for user.
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
addProperty($a_name, $a_value, $a_link="")
add a property to current section
deleteResourceObject($a_returned_id)
Remove personal resource to assigment.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ getOverviewContentPortfolio()

static ilExSubmissionObjectGUI::getOverviewContentPortfolio ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
staticprotected

Definition at line 125 of file class.ilExSubmissionObjectGUI.php.

References $_GET, $DIC, $ilCtrl, ilExSubmissionBaseGUI\$lng, ilObject\_exists(), ilInfoScreenGUI\addProperty(), ilExSubmission\canSubmit(), ilExSubmission\deleteResourceObject(), ilLinkButton\getInstance(), ilObjPortfolio\getPortfoliosOfUser(), ilExSubmission\getSelectedObject(), ilExSubmission\getUserId(), and ilExSubmission\hasSubmitted().

126  {
127  global $DIC;
128 
129  $lng = $DIC->language();
130  $ilCtrl = $DIC->ctrl();
131 
132  $files_str = "";
133  $buttons_str = "";
134  $valid_prtf = false;
135  $selected_prtf = $a_submission->getSelectedObject();
136  if ($selected_prtf) {
137  $portfolio_id = (int) $selected_prtf["filetitle"];
138 
139  // #11746
140  if (ilObject::_exists($portfolio_id, false, "prtf")) {
141  $portfolio = new ilObjPortfolio($portfolio_id, false);
142  if ($portfolio->getTitle()) {
143  // #10116 / #12791
144  $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
145 
146  $ref_id = $_REQUEST['ref_id'];
147  $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", $ref_id);
148 
149  $ilCtrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
150 
151  $prtf_link = $ilCtrl->getLinkTargetByClass(array("ildashboardgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view");
152  $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
153  $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", "");
154 
155 
156  $files_str = '<a href="' . $prtf_link .
157  '">' . $portfolio->getTitle() . '</a>';
158  $valid_prtf = true;
159  }
160  }
161  // remove invalid resource if no upload yet (see download below)
162  elseif (substr($selected_prtf["filename"], -1) == "/") {
163  // #16887
164  $a_submission->deleteResourceObject($selected_prtf["returned_id"]);
165  }
166  }
167  if ($a_submission->canSubmit()) {
168  if (!$valid_prtf) {
169  $button = ilLinkButton::getInstance();
170  $button->setCaption("exc_create_portfolio");
171  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createPortfolioFromAssignment"));
172 
173  $buttons_str .= "" . $button->render();
174  }
175  // #10462
176  //selectPortfolio ( remove it? )
177  $prtfs = sizeof(ilObjPortfolio::getPortfoliosOfUser($a_submission->getUserId()));
178  if ((!$valid_prtf && $prtfs)
179  || ($valid_prtf && $prtfs > 1)) {
180  $button = ilLinkButton::getInstance();
181  $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_change" : ""));
182  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectPortfolio"));
183  $buttons_str .= " " . $button->render();
184  }
185  if ($valid_prtf) {
186  $button = ilLinkButton::getInstance();
187  $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_unlink" : ""));
188  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "askUnlinkPortfolio"));
189  $buttons_str .= " " . $button->render();
190  }
191  }
192  // todo: move this to ks somehow
193  if ($buttons_str != "") {
194  $files_str .= "<p>" . $buttons_str . "</p>";
195  }
196  if ($files_str) {
197  $a_info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
198  }
199  if ($a_submission->hasSubmitted()) {
200  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_prtf["returned_id"]);
201  $dl_link = $ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
202  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
203 
204  $button = ilLinkButton::getInstance();
205  $button->setCaption("download");
206  $button->setUrl($dl_link);
207 
208  $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
209  }
210  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$_GET["client_id"]
static getPortfoliosOfUser($a_user_id)
Get views of user.
global $ilCtrl
Definition: ilias.php:18
addProperty($a_name, $a_value, $a_link="")
add a property to current section
deleteResourceObject($a_returned_id)
Remove personal resource to assigment.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ initGUIForSubmit()

static ilExSubmissionObjectGUI::initGUIForSubmit (   $a_ass_id,
  $a_user_id = null 
)
static

Definition at line 703 of file class.ilExSubmissionObjectGUI.php.

References $DIC, $ilUser, and ilObject\_getAllReferences().

Referenced by ilBlogExerciseGUI\finalize(), and ilPortfolioExerciseGUI\finalize().

704  {
705  global $DIC;
706 
707  $ilUser = $DIC->user();
708 
709  if (!$a_user_id) {
710  $a_user_id = $ilUser->getId();
711  }
712 
713  $ass = new ilExAssignment($a_ass_id);
714  $sub = new ilExSubmission($ass, $a_user_id);
715  $exc_id = $ass->getExerciseId();
716 
717  // #11173 - ref_id is needed for notifications
718  $exc_ref_id = array_shift(ilObject::_getAllReferences($exc_id));
719  $exc = new ilObjExercise($exc_ref_id, true);
720 
721  return new self($exc, $sub);
722  }
Exercise assignment.
static _getAllReferences($a_id)
get all reference ids of object
Class ilObjExercise.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPortfolioTemplateForm()

ilExSubmissionObjectGUI::initPortfolioTemplateForm ( array  $a_templates)
protected

Definition at line 390 of file class.ilExSubmissionObjectGUI.php.

References ilFormPropertyGUI\setRequired().

Referenced by createPortfolioTemplateObject(), and setSelectedPortfolioTemplateObject().

391  {
392  $form = new ilPropertyFormGUI();
393  $form->setTitle($this->lng->txt("exc_create_portfolio") . ": " . $this->assignment->getTitle());
394  $form->setFormAction($this->ctrl->getFormAction($this, "setSelectedPortfolioTemplate"));
395 
396  $prtt = new ilRadioGroupInputGUI($this->lng->txt("obj_prtt"), "prtt");
397  $prtt->setRequired(true);
398  $prtt->addOption(new ilRadioOption($this->lng->txt("exc_create_portfolio_no_template"), -1));
399  foreach ($a_templates as $id => $title) {
400  $prtt->addOption(new ilRadioOption('"' . $title . '"', $id));
401  }
402  $prtt->setValue(-1);
403  $form->addItem($prtt);
404 
405  $form->addCommandButton("setSelectedPortfolioTemplate", $this->lng->txt("save"));
406  $form->addCommandButton("returnToParent", $this->lng->txt("cancel"));
407 
408  return $form;
409  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderResourceSelection()

ilExSubmissionObjectGUI::renderResourceSelection (   $a_title,
  $a_info,
  $a_cmd,
  $a_explorer_cmd,
array  $a_items = null 
)
protected

Definition at line 212 of file class.ilExSubmissionObjectGUI.php.

References ilExSubmissionBaseGUI\$tpl, ilPanelGUI\getInstance(), renderWorkspaceExplorer(), ilExSubmissionBaseGUI\returnToParentObject(), and ilUtil\sendInfo().

Referenced by createBlogObject(), selectBlogObject(), and selectPortfolioObject().

213  {
214  if (!$this->submission->canSubmit()) {
215  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
216  $this->returnToParentObject();
217  }
218 
219  $tpl = new ilTemplate("tpl.exc_select_resource.html", true, true, "Modules/Exercise");
220 
221  if (is_array($a_items)) {
222  $tpl->setCurrentBlock("item");
223  foreach ($a_items as $item_id => $item_title) {
224  $tpl->setVariable("ITEM_ID", $item_id);
225  $tpl->setVariable("ITEM_TITLE", $item_title);
226  $tpl->parseCurrentBlock();
227  }
228  $tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
229  $tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
230  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
231  $tpl->setVariable("CMD_SUBMIT", $a_cmd);
232  $tpl->setVariable("CMD_CANCEL", "returnToParent");
233  $html = $tpl->get();
234  } elseif ($a_explorer_cmd) {
235  $html = $this->renderWorkspaceExplorer($a_explorer_cmd);
236  }
237 
238 
239  ilUtil::sendInfo($this->lng->txt($a_info));
240 
241  $title = $this->lng->txt($a_title) . ": " . $this->assignment->getTitle();
242 
243  $panel = ilPanelGUI::getInstance();
244  $panel->setBody($html);
245  $panel->setHeading($title);
246 
247  $this->tpl->setContent($panel->getHTML());
248  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getInstance()
Get instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderWorkspaceExplorer()

ilExSubmissionObjectGUI::renderWorkspaceExplorer (   $a_cmd)
protected
Parameters
string$a_cmd
Returns
string

Definition at line 343 of file class.ilExSubmissionObjectGUI.php.

References exit, and ilTreeExplorerGUI\setTypeWhiteList().

Referenced by renderResourceSelection().

344  {
345  switch ($a_cmd) {
346  case "selectBlog":
347  $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "setSelectedBlog");
348  $exp2->setTypeWhiteList(array("blog", "wsrt", "wfld"));
349  $exp2->setSelectableTypes(array("blog"));
350  break;
351 
352  case "createBlog":
353  $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "saveBlog");
354  $exp2->setTypeWhiteList(array("wsrt", "wfld"));
355  $exp2->setSelectableTypes(array("wsrt", "wfld"));
356  break;
357  }
358  if (!$exp2->handleCommand()) {
359  return $exp2->getHTML();
360  }
361  exit;
362  }
exit
Definition: login.php:29
setTypeWhiteList($a_val)
Set type white list.
Explorer for selecting a personal workspace item.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveBlogObject()

ilExSubmissionObjectGUI::saveBlogObject ( )
protected

Definition at line 279 of file class.ilExSubmissionObjectGUI.php.

References $_GET, createBlogObject(), ilExSubmissionBaseGUI\handleRemovedUpload(), ilWorkspaceTree\insertObject(), ilExSubmissionBaseGUI\returnToParentObject(), ilUtil\sendFailure(), and ilUtil\sendInfo().

280  {
281  if (!$this->submission->canSubmit()) {
282  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
283  $this->returnToParentObject();
284  }
285 
286  if (!$_GET["sel_wsp_obj"]) {
287  ilUtil::sendFailure($this->lng->txt("select_one"));
288  return $this->createBlogObject();
289  }
290 
291  $parent_node = $_GET["sel_wsp_obj"];
292 
293  $blog = new ilObjBlog();
294  $blog->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
295  $blog->create();
296 
297  $tree = new ilWorkspaceTree($this->submission->getUserId()); // #15993
298 
299  $node_id = $tree->insertObject($parent_node, $blog->getId());
300 
301  $access_handler = new ilWorkspaceAccessHandler($tree);
302  $access_handler->setPermissions($parent_node, $node_id);
303 
304  $this->submission->deleteAllFiles();
305  $this->handleRemovedUpload();
306 
307  $this->submission->addResourceObject($node_id);
308 
309  ilUtil::sendSuccess($this->lng->txt("exc_blog_created"), true);
310  $this->returnToParentObject();
311  }
$_GET["client_id"]
Access handler for personal workspace.
Tree handler for personal workspace.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilObjBlog.
insertObject($a_parent_node_id, $a_object_id)
Add object to tree.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ selectBlogObject()

ilExSubmissionObjectGUI::selectBlogObject ( )
protected

Definition at line 267 of file class.ilExSubmissionObjectGUI.php.

References ilExSubmissionBaseGUI\handleTabs(), and renderResourceSelection().

Referenced by setSelectedBlogObject().

268  {
269  $this->handleTabs();
270 
271  return $this->renderResourceSelection(
272  "exc_select_blog",
273  "exc_select_blog_info",
274  "setSelectedBlog",
275  "selectBlog"
276  );
277  }
renderResourceSelection($a_title, $a_info, $a_cmd, $a_explorer_cmd, array $a_items=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectPortfolioObject()

ilExSubmissionObjectGUI::selectPortfolioObject ( )
protected

Definition at line 369 of file class.ilExSubmissionObjectGUI.php.

References ilObjPortfolio\getPortfoliosOfUser(), ilExSubmissionBaseGUI\handleTabs(), and renderResourceSelection().

Referenced by setSelectedPortfolioObject().

370  {
371  $this->handleTabs();
372 
373  $items = array();
374  $portfolios = ilObjPortfolio::getPortfoliosOfUser($this->submission->getUserId());
375  if ($portfolios) {
376  foreach ($portfolios as $portfolio) {
377  $items[$portfolio["id"]] = $portfolio["title"];
378  }
379  }
380 
381  return $this->renderResourceSelection(
382  "exc_select_portfolio",
383  "exc_select_portfolio_info",
384  "setSelectedPortfolio",
385  null,
386  $items
387  );
388  }
static getPortfoliosOfUser($a_user_id)
Get views of user.
renderResourceSelection($a_title, $a_info, $a_cmd, $a_explorer_cmd, array $a_items=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedBlogObject()

ilExSubmissionObjectGUI::setSelectedBlogObject ( )
protected

Definition at line 313 of file class.ilExSubmissionObjectGUI.php.

References $_GET, ilTree\getNodeData(), ilExSubmissionBaseGUI\handleRemovedUpload(), ilExSubmissionBaseGUI\returnToParentObject(), selectBlogObject(), and ilUtil\sendInfo().

314  {
315  if (!$this->submission->canSubmit()) {
316  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
317  $this->returnToParentObject();
318  }
319 
320  if ($_GET["sel_wsp_obj"]) {
321  $tree = new ilWorkspaceTree($this->submission->getUserId());
322  $node = $tree->getNodeData($_GET["sel_wsp_obj"]);
323  if ($node && $node["type"] == "blog") {
324  $this->submission->deleteAllFiles();
325  $this->handleRemovedUpload();
326 
327  $this->submission->addResourceObject($node["wsp_id"]);
328 
329  ilUtil::sendSuccess($this->lng->txt("exc_blog_selected"), true);
330  $this->ctrl->setParameter($this, "blog_id", $node["wsp_id"]);
331  $this->ctrl->redirect($this, "askDirectSubmission");
332  }
333  }
334 
335  // ilUtil::sendFailure($this->lng->txt("select_one_blog"));
336  return $this->selectBlogObject();
337  }
$_GET["client_id"]
Tree handler for personal workspace.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getNodeData($a_node_id, $a_tree_pk=null)
get all information of a node.
+ Here is the call graph for this function:

◆ setSelectedPortfolioObject()

ilExSubmissionObjectGUI::setSelectedPortfolioObject ( )
protected

Definition at line 514 of file class.ilExSubmissionObjectGUI.php.

References $_POST, ilExSubmissionBaseGUI\handleRemovedUpload(), ilExSubmissionBaseGUI\returnToParentObject(), selectPortfolioObject(), ilUtil\sendFailure(), and ilUtil\sendInfo().

515  {
516  if (!$this->submission->canSubmit()) {
517  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
518  $this->returnToParentObject();
519  }
520 
521  if ($_POST["item"]) {
522  $this->submission->deleteAllFiles();
523  $this->handleRemovedUpload();
524 
525  $this->submission->addResourceObject($_POST["item"]);
526 
527  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_selected"), true);
528  $this->ctrl->setParameter($this, "prtf_id", $_POST["item"]);
529  $this->ctrl->redirect($this, "askDirectSubmission");
530  }
531 
532  ilUtil::sendFailure($this->lng->txt("select_one"));
533  return $this->selectPortfolioObject();
534  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ setSelectedPortfolioTemplateObject()

ilExSubmissionObjectGUI::setSelectedPortfolioTemplateObject ( )
protected

Definition at line 461 of file class.ilExSubmissionObjectGUI.php.

References $_GET, createPortfolioObject(), createPortfolioTemplateObject(), ilObjPortfolioTemplate\getAvailablePortfolioTemplates(), initPortfolioTemplateForm(), ilExSubmissionBaseGUI\returnToParentObject(), and ilUtil\sendInfo().

462  {
463  if (!$this->submission->canSubmit()) {
464  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
465  $this->returnToParentObject();
466  }
467 
469  if (!sizeof($templates)) {
470  $this->ctrl->redirect($this, "returnToParent");
471  }
472 
473  $form = $this->initPortfolioTemplateForm($templates);
474  if ($form->checkInput()) {
475  $prtt = $form->getInput("prtt");
476  if ($prtt > 0 && array_key_exists($prtt, $templates)) {
477  $title = $this->exercise->getTitle() . " - " . $this->assignment->getTitle();
478  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "exc_id", $this->exercise->getRefId());
479  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "ass_id", $this->assignment->getId());
480  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "pt", $title);
481  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "prtt", $prtt);
482  $this->ctrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
483  $this->ctrl->redirectByClass(array("ildashboardgui", "ilPortfolioRepositoryGUI", "ilObjPortfolioGUI"), "createPortfolioFromTemplate");
484  } else {
485  // do not use template
486  return $this->createPortfolioObject();
487  }
488  }
489 
490  $form->setValuesByPost();
491  $this->createPortfolioTemplateObject($form);
492  }
$_GET["client_id"]
createPortfolioTemplateObject(ilPropertyFormGUI $a_form=null)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getAvailablePortfolioTemplates($a_permission="read")
+ Here is the call graph for this function:

◆ submitBlog()

ilExSubmissionObjectGUI::submitBlog (   $a_blog_id)

Submit blog for assignment.

Parameters
int$a_blog_id
Returns
bool

Definition at line 636 of file class.ilExSubmissionObjectGUI.php.

References $size, ilExSubmissionBaseGUI\handleNewUpload(), and ilObject2GUI\WORKSPACE_NODE_ID.

Referenced by directSubmitObject().

637  {
638  if (!$this->submission->canSubmit()) {
639  return;
640  }
641 
642  $blog_id = $a_blog_id;
643 
644  $blog_gui = new ilObjBlogGUI($blog_id, ilObjBlogGUI::WORKSPACE_NODE_ID);
645  if ($blog_gui->object) {
646  $file = $blog_gui->buildExportFile();
647  $size = filesize($file);
648  if ($size) {
649  $this->submission->deleteAllFiles();
650 
651  $meta = array(
652  "name" => $blog_id,
653  "tmp_name" => $file,
654  "size" => $size
655  );
656  $this->submission->uploadFile($meta, true);
657 
658  $this->handleNewUpload();
659  return true;
660  }
661  }
662  return false;
663  }
$size
Definition: RandomTest.php:84
handleNewUpload($a_no_notifications=false)
Class ilObjBlogGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ submitPortfolio()

ilExSubmissionObjectGUI::submitPortfolio (   $a_portfolio_id)

Submit portfolio for assignment.

Parameters
int$a_portfolio_id
Returns
bool

Definition at line 671 of file class.ilExSubmissionObjectGUI.php.

References $size, and ilExSubmissionBaseGUI\handleNewUpload().

Referenced by directSubmitObject().

672  {
673  if (!$this->submission->canSubmit()) {
674  return;
675  }
676 
677  $prtf_id = $a_portfolio_id;
678 
679  $prtf = new ilObjPortfolio($prtf_id, false);
680  if ($prtf->getTitle()) {
681  $port_gui = new ilObjPortfolioGUI($prtf_id);
682  $port_export = new \ILIAS\Portfolio\Export\PortfolioHtmlExport($port_gui);
683  $file = $port_export->exportHtml();
684 
685  $size = filesize($file);
686  if ($size) {
687  $this->submission->deleteAllFiles();
688 
689  $meta = array(
690  "name" => $prtf_id,
691  "tmp_name" => $file,
692  "size" => $size
693  );
694  $this->submission->uploadFile($meta, true);
695 
696  $this->handleNewUpload();
697  return true;
698  }
699  }
700  return false;
701  }
$size
Definition: RandomTest.php:84
Portfolio view gui class.
handleNewUpload($a_no_notifications=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unlinkPortfolioObject()

ilExSubmissionObjectGUI::unlinkPortfolioObject ( )
protected

Definition at line 554 of file class.ilExSubmissionObjectGUI.php.

References $DIC, and ilExSubmission\deleteResourceObject().

555  {
556  global $DIC;
557 
558  $user = $DIC->user();
559 
560  $portfolio = $this->submission->getSelectedObject();
561  $port_id = $portfolio["returned_id"];
562 
563  $ilsub = new ilExSubmission($this->assignment, $user->getId());
564  $ilsub->deleteResourceObject($port_id);
565 
566  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_unlinked_from_assignment"), true);
567 
568  $this->ctrl->redirect($this, "returnToParent");
569  }
deleteResourceObject($a_returned_id)
Remove personal resource to assigment.
$DIC
Definition: xapitoken.php:46
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
+ Here is the call graph for this function:

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