ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 

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
 
 $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 594 of file class.ilExSubmissionObjectGUI.php.

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

595  {
596  $tpl = $this->tpl;
597 
598  if (!$this->submission->canSubmit()) {
599  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
600  $this->returnToParentObject();
601  }
602 
603  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
604  $conf = new ilConfirmationGUI();
605 
606  if ($_REQUEST["blog_id"]) {
607  $this->ctrl->setParameter($this, "blog_id", $_REQUEST["blog_id"]);
608  $txt = $this->lng->txt("exc_direct_submit_blog");
609  } else {
610  $this->ctrl->setParameter($this, "prtf_id", $_REQUEST["prtf_id"]);
611  $txt = $this->lng->txt("exc_direct_submit_portfolio");
612  }
613  $conf->setFormAction($this->ctrl->getFormAction($this, "directSubmit"));
614 
615  $conf->setHeaderText($txt);
616  $conf->setConfirm($this->lng->txt("exc_direct_submit"), "directSubmit");
617  $conf->setCancel($this->lng->txt("exc_direct_no_submit"), "returnToParent");
618 
619  $tpl->setContent($conf->getHTML());
620  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$txt
Definition: error.php:11
Confirmation screen class.
+ Here is the call graph for this function:

◆ askUnlinkPortfolioObject()

ilExSubmissionObjectGUI::askUnlinkPortfolioObject ( )
protected

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

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

554  {
555  $tpl = $this->tpl;
556 
557  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
558  $conf = new ilConfirmationGUI();
559  $conf->setFormAction($this->ctrl->getFormAction($this, "unlinkPortfolio"));
560  $conf->setHeaderText($this->lng->txt("exc_sure_unlink_portfolio", "sure_unlink_portfolio"));
561  $conf->setConfirm($this->lng->txt("confirm"), "unlinkPortfolio");
562  $conf->setCancel($this->lng->txt("cancel"), "returnToParent");
563 
564  $submission = $this->submission->getSelectedObject();
565  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
566  $port = new ilObjPortfolio($submission["filetitle"], false);
567 
568  $conf->addItem("id[]", "", $port->getTitle(), ilUtil::getImagePath("icon_prtf.svg"));
569 
570  $tpl->setContent($conf->getHTML());
571  }
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 259 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by saveBlogObject().

260  {
261  $this->handleTabs();
262 
263  return $this->renderResourceSelection(
264  "exc_create_blog",
265  "exc_create_blog_select_info",
266  "saveBlog",
267  "createBlog"
268  );
269  }
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 423 of file class.ilExSubmissionObjectGUI.php.

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

424  {
425  global $DIC;
426 
427  $ctrl = $DIC->ctrl();
428 
429  include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
430 
432 
433  //template id is stored in the DB with the ref_id.
434  $template_id = $this->assignment->getPortfolioTemplateId();
435  //get the object id to compare with a list of template objects.
436  $template_object_id = ilObject::_lookupObjectId($template_id);
437 
438  // select a template, if available
439  if (count($templates) > 0 && $template_object_id == 0) {
441  return;
442  }
443 
444  $title = $this->exercise->getTitle() . " - " . $this->assignment->getTitle();
445  $ctrl->setParameterByClass("ilObjPortfolioGUI", "exc_id", $this->exercise->getRefId());
446  $ctrl->setParameterByClass("ilObjPortfolioGUI", "ass_id", $this->assignment->getId());
447  $ctrl->setParameterByClass("ilObjPortfolioGUI", "pt", $title);
448 
449  if ($template_object_id > 0) {
450  $ctrl->setParameterByClass("ilObjPortfolioGUI", "prtt", $template_object_id);
451  }
452  $ctrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
453  $ctrl->redirectByClass(array("ilPersonalDesktopGUI", "ilPortfolioRepositoryGUI", "ilObjPortfolioGUI"), "createPortfolioFromAssignment");
454  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
createPortfolioTemplateObject(ilPropertyFormGUI $a_form=null)
static _lookupObjectId($a_ref_id)
lookup object id
static getAvailablePortfolioTemplates($a_permission="read")
$template_id
+ Here is the call graph for this function:

◆ createPortfolioObject()

ilExSubmissionObjectGUI::createPortfolioObject ( )
protected

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

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

Referenced by setSelectedPortfolioTemplateObject().

511  {
512  if (!$this->submission->canSubmit()) {
513  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
514  $this->returnToParentObject();
515  }
516 
517  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
518  $portfolio = new ilObjPortfolio();
519  $portfolio->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
520  $portfolio->create();
521 
522  $this->submission->deleteAllFiles();
523  $this->handleRemovedUpload();
524 
525  $this->submission->addResourceObject($portfolio->getId());
526 
527  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_created"), true);
528  $this->returnToParentObject();
529  }
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 456 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by createPortfolioFromAssignmentObject(), and setSelectedPortfolioTemplateObject().

457  {
458  if (!$this->submission->canSubmit()) {
459  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
460  $this->returnToParentObject();
461  }
462 
463  include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
465  if (!sizeof($templates)) {
466  $this->returnToParentObject();
467  }
468 
469  if (!$a_form) {
470  $a_form = $this->initPortfolioTemplateForm($templates);
471  }
472 
473  $this->tpl->setContent($a_form->getHTML());
474  }
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 622 of file class.ilExSubmissionObjectGUI.php.

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

623  {
624  if (!$this->submission->canSubmit()) {
625  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
626  $this->returnToParentObject();
627  }
628 
629  $success = false;
630 
631  // submit current version of blog
632  if ($_REQUEST["blog_id"]) {
633  $success = $this->submitBlog($_REQUEST["blog_id"]);
634  $this->ctrl->setParameter($this, "blog_id", "");
635  }
636  // submit current version of portfolio
637  elseif ($_REQUEST["prtf_id"]) {
638  $success = $this->submitPortfolio($_REQUEST["prtf_id"]);
639  $this->ctrl->setParameter($this, "prtf_id", "");
640  }
641 
642  if ($success) {
643  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
644  } else {
645  ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
646  }
647  $this->ctrl->redirect($this, "returnToParent");
648  }
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  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
57  $wsp_tree = new ilWorkspaceTree($a_submission->getUserId());
58 
59  // #12939
60  if (!$wsp_tree->getRootId()) {
61  $wsp_tree->createTreeForUser($a_submission->getUserId());
62  }
63 
64  $files_str = "";
65  $buttons_str = "";
66  $valid_blog = false;
67  $selected_blog = $a_submission->getSelectedObject();
68  if ($selected_blog) {
69  $blog_id = (int) $selected_blog["filetitle"];
70  $node = $wsp_tree->getNodeData($blog_id);
71  if ($node["title"]) {
72  // #10116
73  $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
74  $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
75  $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
76  $files_str = '<a href="' . $blog_link . '">' .
77  $node["title"] . '</a>';
78  $valid_blog = true;
79  }
80  // remove invalid resource if no upload yet (see download below)
81  elseif (substr($selected_blog["filename"], -1) == "/") {
82  // #16887
83  $a_submission->deleteResourceObject($selected_blog["returned_id"]);
84  }
85  }
86  if ($a_submission->canSubmit()) {
87  if (!$valid_blog) {
88  $button = ilLinkButton::getInstance();
89  $button->setCaption("exc_create_blog");
90  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createBlog"));
91  $buttons_str .= $button->render();
92  }
93  // #10462
94  $blogs = sizeof($wsp_tree->getObjectsFromType("blog"));
95  if ((!$valid_blog && $blogs)
96  || ($valid_blog && $blogs > 1)) {
97  $button = ilLinkButton::getInstance();
98  $button->setCaption("exc_select_blog" . ($valid_blog ? "_change" : ""));
99  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectBlog"));
100  $buttons_str .= " " . $button->render();
101  }
102  }
103 
104  // todo: move this to ks somehow
105  if ($buttons_str != "") {
106  $files_str .= "<p>" . $buttons_str . "</p>";
107  }
108 
109 
110  if ($files_str) {
111  $a_info->addProperty($lng->txt("exc_blog_returned"), $files_str);
112  }
113  if ($a_submission->hasSubmitted()) {
114  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_blog["returned_id"]);
115  $dl_link = $ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
116  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
117 
118  $button = ilLinkButton::getInstance();
119  $button->setCaption("download");
120  $button->setUrl($dl_link);
121 
122  $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
123  }
124  }
createTreeForUser($a_user_id)
Create personal workspace tree for user.
global $DIC
Definition: saml.php:7
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.
+ Here is the call graph for this function:

◆ getOverviewContentPortfolio()

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

Definition at line 126 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().

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

◆ initGUIForSubmit()

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

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

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

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

725  {
726  global $DIC;
727 
728  $ilUser = $DIC->user();
729 
730  if (!$a_user_id) {
731  $a_user_id = $ilUser->getId();
732  }
733 
734  include_once "Modules/Exercise/classes/class.ilObjExercise.php";
735  include_once "Modules/Exercise/classes/class.ilExAssignment.php";
736  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
737 
738  $ass = new ilExAssignment($a_ass_id);
739  $sub = new ilExSubmission($ass, $a_user_id);
740  $exc_id = $ass->getExerciseId();
741 
742  // #11173 - ref_id is needed for notifications
743  $exc_ref_id = array_shift(ilObject::_getAllReferences($exc_id));
744  $exc = new ilObjExercise($exc_ref_id, true);
745 
746  return new self($exc, $sub);
747  }
Exercise assignment.
global $DIC
Definition: saml.php:7
static _getAllReferences($a_id)
get all reference ids of object
Class ilObjExercise.
$ilUser
Definition: imgupload.php:18
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 401 of file class.ilExSubmissionObjectGUI.php.

References $form, $id, $title, and ilFormPropertyGUI\setRequired().

Referenced by createPortfolioTemplateObject(), and setSelectedPortfolioTemplateObject().

402  {
403  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
404  $form = new ilPropertyFormGUI();
405  $form->setTitle($this->lng->txt("exc_create_portfolio") . ": " . $this->assignment->getTitle());
406  $form->setFormAction($this->ctrl->getFormAction($this, "setSelectedPortfolioTemplate"));
407 
408  $prtt = new ilRadioGroupInputGUI($this->lng->txt("obj_prtt"), "prtt");
409  $prtt->setRequired(true);
410  $prtt->addOption(new ilRadioOption($this->lng->txt("exc_create_portfolio_no_template"), -1));
411  foreach ($a_templates as $id => $title) {
412  $prtt->addOption(new ilRadioOption('"' . $title . '"', $id));
413  }
414  $prtt->setValue(-1);
415  $form->addItem($prtt);
416 
417  $form->addCommandButton("setSelectedPortfolioTemplate", $this->lng->txt("save"));
418  $form->addCommandButton("returnToParent", $this->lng->txt("cancel"));
419 
420  return $form;
421  }
This class represents an option in a radio group.
This class represents a property form user interface.
if(!array_key_exists('StateId', $_REQUEST)) $id
This class represents a property in a property form.
if(isset($_POST['submit'])) $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 215 of file class.ilExSubmissionObjectGUI.php.

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

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

216  {
217  if (!$this->submission->canSubmit()) {
218  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
219  $this->returnToParentObject();
220  }
221 
222  $tpl = new ilTemplate("tpl.exc_select_resource.html", true, true, "Modules/Exercise");
223 
224  if (is_array($a_items)) {
225  $tpl->setCurrentBlock("item");
226  foreach ($a_items as $item_id => $item_title) {
227  $tpl->setVariable("ITEM_ID", $item_id);
228  $tpl->setVariable("ITEM_TITLE", $item_title);
229  $tpl->parseCurrentBlock();
230  }
231  $tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
232  $tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
233  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
234  $tpl->setVariable("CMD_SUBMIT", $a_cmd);
235  $tpl->setVariable("CMD_CANCEL", "returnToParent");
236  $html = $tpl->get();
237  } elseif ($a_explorer_cmd) {
238  $html = $this->renderWorkspaceExplorer($a_explorer_cmd);
239  }
240 
241 
242  ilUtil::sendInfo($this->lng->txt($a_info));
243 
244  $title = $this->lng->txt($a_title) . ": " . $this->assignment->getTitle();
245 
246  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
247  $panel = ilPanelGUI::getInstance();
248  $panel->setBody($html);
249  $panel->setHeading($title);
250 
251  $this->tpl->setContent($panel->getHTML());
252  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
special template class to simplify handling of ITX/PEAR
static getInstance()
Get instance.
$html
Definition: example_001.php:87
+ 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 352 of file class.ilExSubmissionObjectGUI.php.

References exit, and ilTreeExplorerGUI\setTypeWhiteList().

Referenced by renderResourceSelection().

353  {
354  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
355  switch ($a_cmd) {
356  case "selectBlog":
357  $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "setSelectedBlog");
358  $exp2->setTypeWhiteList(array("blog", "wsrt", "wfld"));
359  $exp2->setSelectableTypes(array("blog"));
360  break;
361 
362  case "createBlog":
363  $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "saveBlog");
364  $exp2->setTypeWhiteList(array("wsrt", "wfld"));
365  $exp2->setSelectableTypes(array("wsrt", "wfld"));
366  break;
367  }
368  if (!$exp2->handleCommand()) {
369  return $exp2->getHTML();
370  }
371  exit;
372  }
setTypeWhiteList($a_val)
Set type white list.
Explorer for selecting a personal workspace item.
exit
Definition: backend.php:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveBlogObject()

ilExSubmissionObjectGUI::saveBlogObject ( )
protected

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

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

284  {
285  if (!$this->submission->canSubmit()) {
286  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
287  $this->returnToParentObject();
288  }
289 
290  if (!$_GET["sel_wsp_obj"]) {
291  ilUtil::sendFailure($this->lng->txt("select_one"));
292  return $this->createBlogObject();
293  }
294 
295  $parent_node = $_GET["sel_wsp_obj"];
296 
297  include_once "Modules/Blog/classes/class.ilObjBlog.php";
298  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
299  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
300 
301  $blog = new ilObjBlog();
302  $blog->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
303  $blog->create();
304 
305  $tree = new ilWorkspaceTree($this->submission->getUserId()); // #15993
306 
307  $node_id = $tree->insertObject($parent_node, $blog->getId());
308 
309  $access_handler = new ilWorkspaceAccessHandler($tree);
310  $access_handler->setPermissions($parent_node, $node_id);
311 
312  $this->submission->deleteAllFiles();
313  $this->handleRemovedUpload();
314 
315  $this->submission->addResourceObject($node_id);
316 
317  ilUtil::sendSuccess($this->lng->txt("exc_blog_created"), true);
318  $this->returnToParentObject();
319  }
$_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.
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 271 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by setSelectedBlogObject().

272  {
273  $this->handleTabs();
274 
275  return $this->renderResourceSelection(
276  "exc_select_blog",
277  "exc_select_blog_info",
278  "setSelectedBlog",
279  "selectBlog"
280  );
281  }
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 379 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by setSelectedPortfolioObject().

380  {
381  $this->handleTabs();
382 
383  $items = array();
384  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
385  $portfolios = ilObjPortfolio::getPortfoliosOfUser($this->submission->getUserId());
386  if ($portfolios) {
387  foreach ($portfolios as $portfolio) {
388  $items[$portfolio["id"]] = $portfolio["title"];
389  }
390  }
391 
392  return $this->renderResourceSelection(
393  "exc_select_portfolio",
394  "exc_select_portfolio_info",
395  "setSelectedPortfolio",
396  null,
397  $items
398  );
399  }
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 321 of file class.ilExSubmissionObjectGUI.php.

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

322  {
323  if (!$this->submission->canSubmit()) {
324  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
325  $this->returnToParentObject();
326  }
327 
328  if ($_GET["sel_wsp_obj"]) {
329  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
330  $tree = new ilWorkspaceTree($this->submission->getUserId());
331  $node = $tree->getNodeData($_GET["sel_wsp_obj"]);
332  if ($node && $node["type"] == "blog") {
333  $this->submission->deleteAllFiles();
334  $this->handleRemovedUpload();
335 
336  $this->submission->addResourceObject($node["wsp_id"]);
337 
338  ilUtil::sendSuccess($this->lng->txt("exc_blog_selected"), true);
339  $this->ctrl->setParameter($this, "blog_id", $node["wsp_id"]);
340  $this->ctrl->redirect($this, "askDirectSubmission");
341  }
342  }
343 
344  // ilUtil::sendFailure($this->lng->txt("select_one_blog"));
345  return $this->selectBlogObject();
346  }
$_GET["client_id"]
Tree handler for personal workspace.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ setSelectedPortfolioObject()

ilExSubmissionObjectGUI::setSelectedPortfolioObject ( )
protected

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

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

532  {
533  if (!$this->submission->canSubmit()) {
534  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
535  $this->returnToParentObject();
536  }
537 
538  if ($_POST["item"]) {
539  $this->submission->deleteAllFiles();
540  $this->handleRemovedUpload();
541 
542  $this->submission->addResourceObject($_POST["item"]);
543 
544  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_selected"), true);
545  $this->ctrl->setParameter($this, "prtf_id", $_POST["item"]);
546  $this->ctrl->redirect($this, "askDirectSubmission");
547  }
548 
549  ilUtil::sendFailure($this->lng->txt("select_one"));
550  return $this->selectPortfolioObject();
551  }
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 476 of file class.ilExSubmissionObjectGUI.php.

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

477  {
478  if (!$this->submission->canSubmit()) {
479  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
480  $this->returnToParentObject();
481  }
482 
483  include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
485  if (!sizeof($templates)) {
486  $this->ctrl->redirect($this, "returnToParent");
487  }
488 
489  $form = $this->initPortfolioTemplateForm($templates);
490  if ($form->checkInput()) {
491  $prtt = $form->getInput("prtt");
492  if ($prtt > 0 && array_key_exists($prtt, $templates)) {
493  $title = $this->exercise->getTitle() . " - " . $this->assignment->getTitle();
494  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "exc_id", $this->exercise->getRefId());
495  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "ass_id", $this->assignment->getId());
496  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "pt", $title);
497  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "prtt", $prtt);
498  $this->ctrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
499  $this->ctrl->redirectByClass(array("ilPersonalDesktopGUI", "ilPortfolioRepositoryGUI", "ilObjPortfolioGUI"), "createPortfolioFromTemplate");
500  } else {
501  // do not use template
502  return $this->createPortfolioObject();
503  }
504  }
505 
506  $form->setValuesByPost();
508  }
$_GET["client_id"]
createPortfolioTemplateObject(ilPropertyFormGUI $a_form=null)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
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 656 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by directSubmitObject().

657  {
658  if (!$this->submission->canSubmit()) {
659  return;
660  }
661 
662  $blog_id = $a_blog_id;
663 
664  include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
665  $blog_gui = new ilObjBlogGUI($blog_id, ilObjBlogGUI::WORKSPACE_NODE_ID);
666  if ($blog_gui->object) {
667  $file = $blog_gui->buildExportFile();
668  $size = filesize($file);
669  if ($size) {
670  $this->submission->deleteAllFiles();
671 
672  $meta = array(
673  "name" => $blog_id,
674  "tmp_name" => $file,
675  "size" => $size
676  );
677  $this->submission->uploadFile($meta, true);
678 
679  $this->handleNewUpload();
680  return true;
681  }
682  }
683  return false;
684  }
$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 692 of file class.ilExSubmissionObjectGUI.php.

References $size, and ilExSubmissionBaseGUI\handleNewUpload().

Referenced by directSubmitObject().

693  {
694  if (!$this->submission->canSubmit()) {
695  return;
696  }
697 
698  $prtf_id = $a_portfolio_id;
699 
700  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
701  $prtf = new ilObjPortfolio($prtf_id, false);
702  if ($prtf->getTitle()) {
703  include_once "Modules/Portfolio/classes/class.ilPortfolioHTMLExport.php";
704  $export = new ilPortfolioHTMLExport(null, $prtf);
705  $file = $export->buildExportFile();
706  $size = filesize($file);
707  if ($size) {
708  $this->submission->deleteAllFiles();
709 
710  $meta = array(
711  "name" => $prtf_id,
712  "tmp_name" => $file,
713  "size" => $size
714  );
715  $this->submission->uploadFile($meta, true);
716 
717  $this->handleNewUpload();
718  return true;
719  }
720  }
721  return false;
722  }
$size
Definition: RandomTest.php:84
Portfolio HTML exporter 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 573 of file class.ilExSubmissionObjectGUI.php.

References $DIC, $user, and ilExSubmission\deleteResourceObject().

574  {
575  global $DIC;
576 
577  $user = $DIC->user();
578 
579  $portfolio = $this->submission->getSelectedObject();
580  $port_id = $portfolio["returned_id"];
581 
582  $ilsub = new ilExSubmission($this->assignment, $user->getId());
583  $ilsub->deleteResourceObject($port_id);
584 
585  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_unlinked_from_assignment"), true);
586 
587  $this->ctrl->redirect($this, "returnToParent");
588  }
global $DIC
Definition: saml.php:7
$user
Definition: migrateto20.php:57
deleteResourceObject($a_returned_id)
Remove personal resource to assigment.
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: