ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilExSubmissionObjectGUI Class Reference

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

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

Public Member Functions

 executeCommand ()
 
 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
 

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  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
585  $conf = new ilConfirmationGUI();
586 
587  if ($_REQUEST["blog_id"]) {
588  $this->ctrl->setParameter($this, "blog_id", $_REQUEST["blog_id"]);
589  $txt = $this->lng->txt("exc_direct_submit_blog");
590  } else {
591  $this->ctrl->setParameter($this, "prtf_id", $_REQUEST["prtf_id"]);
592  $txt = $this->lng->txt("exc_direct_submit_portfolio");
593  }
594  $conf->setFormAction($this->ctrl->getFormAction($this, "directSubmit"));
595 
596  $conf->setHeaderText($txt);
597  $conf->setConfirm($this->lng->txt("exc_direct_submit"), "directSubmit");
598  $conf->setCancel($this->lng->txt("exc_direct_no_submit"), "returnToParent");
599 
600  $tpl->setContent($conf->getHTML());
601  }
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 534 of file class.ilExSubmissionObjectGUI.php.

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

535  {
536  $tpl = $this->tpl;
537 
538  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
539  $conf = new ilConfirmationGUI();
540  $conf->setFormAction($this->ctrl->getFormAction($this, "unlinkPortfolio"));
541  $conf->setHeaderText($this->lng->txt("exc_sure_unlink_portfolio", "sure_unlink_portfolio"));
542  $conf->setConfirm($this->lng->txt("confirm"), "unlinkPortfolio");
543  $conf->setCancel($this->lng->txt("cancel"), "returnToParent");
544 
545  $submission = $this->submission->getSelectedObject();
546  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
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 240 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by saveBlogObject().

241  {
242  $this->handleTabs();
243 
244  return $this->renderResourceSelection(
245  "exc_create_blog",
246  "exc_create_blog_select_info",
247  "saveBlog",
248  "createBlog"
249  );
250  }
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 404 of file class.ilExSubmissionObjectGUI.php.

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

405  {
406  global $DIC;
407 
408  $ctrl = $DIC->ctrl();
409 
410  include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
411 
413 
414  //template id is stored in the DB with the ref_id.
415  $template_id = $this->assignment->getPortfolioTemplateId();
416  //get the object id to compare with a list of template objects.
417  $template_object_id = ilObject::_lookupObjectId($template_id);
418 
419  // select a template, if available
420  if (count($templates) > 0 && $template_object_id == 0) {
422  return;
423  }
424 
425  $title = $this->exercise->getTitle() . " - " . $this->assignment->getTitle();
426  $ctrl->setParameterByClass("ilObjPortfolioGUI", "exc_id", $this->exercise->getRefId());
427  $ctrl->setParameterByClass("ilObjPortfolioGUI", "ass_id", $this->assignment->getId());
428  $ctrl->setParameterByClass("ilObjPortfolioGUI", "pt", $title);
429 
430  if ($template_object_id > 0) {
431  $ctrl->setParameterByClass("ilObjPortfolioGUI", "prtt", $template_object_id);
432  }
433  $ctrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
434  $ctrl->redirectByClass(array("ilPersonalDesktopGUI", "ilPortfolioRepositoryGUI", "ilObjPortfolioGUI"), "createPortfolioFromAssignment");
435  }
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")
Create styles array
The data for the language used.
$template_id
+ Here is the call graph for this function:

◆ createPortfolioObject()

ilExSubmissionObjectGUI::createPortfolioObject ( )
protected

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

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

Referenced by setSelectedPortfolioTemplateObject().

492  {
493  if (!$this->submission->canSubmit()) {
494  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
495  $this->returnToParentObject();
496  }
497 
498  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
499  $portfolio = new ilObjPortfolio();
500  $portfolio->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
501  $portfolio->create();
502 
503  $this->submission->deleteAllFiles();
504  $this->handleRemovedUpload();
505 
506  $this->submission->addResourceObject($portfolio->getId());
507 
508  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_created"), true);
509  $this->returnToParentObject();
510  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 437 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by createPortfolioFromAssignmentObject(), and setSelectedPortfolioTemplateObject().

438  {
439  if (!$this->submission->canSubmit()) {
440  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
441  $this->returnToParentObject();
442  }
443 
444  include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
446  if (!sizeof($templates)) {
447  $this->returnToParentObject();
448  }
449 
450  if (!$a_form) {
451  $a_form = $this->initPortfolioTemplateForm($templates);
452  }
453 
454  $this->tpl->setContent($a_form->getHTML());
455  }
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 603 of file class.ilExSubmissionObjectGUI.php.

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

604  {
605  if (!$this->submission->canSubmit()) {
606  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
607  $this->returnToParentObject();
608  }
609 
610  $success = false;
611 
612  // submit current version of blog
613  if ($_REQUEST["blog_id"]) {
614  $success = $this->submitBlog($_REQUEST["blog_id"]);
615  $this->ctrl->setParameter($this, "blog_id", "");
616  }
617  // submit current version of portfolio
618  elseif ($_REQUEST["prtf_id"]) {
619  $success = $this->submitPortfolio($_REQUEST["prtf_id"]);
620  $this->ctrl->setParameter($this, "prtf_id", "");
621  }
622 
623  if ($success) {
624  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
625  } else {
626  ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
627  }
628  $this->ctrl->redirect($this, "returnToParent");
629  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 ( )

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

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

15  {
17 
18  if (!$this->submission->canView()) {
19  $this->returnToParentObject();
20  }
21 
22  $class = $ilCtrl->getNextClass($this);
23  $cmd = $ilCtrl->getCmd();
24 
25  switch ($class) {
26  default:
27  $this->{$cmd . "Object"}();
28  break;
29  }
30  }
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 32 of file class.ilExSubmissionObjectGUI.php.

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

33  {
34  switch ($a_submission->getAssignment()->getType()) {
36  return self::getOverviewContentBlog($a_info, $a_submission);
37 
39  return self::getOverviewContentPortfolio($a_info, $a_submission);
40  }
41  }
+ Here is the call graph for this function:

◆ getOverviewContentBlog()

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

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

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

44  {
45  global $DIC;
46 
47  $lng = $DIC->language();
48  $ilCtrl = $DIC->ctrl();
49 
50  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
51  $wsp_tree = new ilWorkspaceTree($a_submission->getUserId());
52 
53  // #12939
54  if (!$wsp_tree->getRootId()) {
55  $wsp_tree->createTreeForUser($a_submission->getUserId());
56  }
57 
58  $files_str = "";
59  $valid_blog = false;
60  $selected_blog = $a_submission->getSelectedObject();
61  if ($selected_blog) {
62  $blog_id = (int) $selected_blog["filetitle"];
63  $node = $wsp_tree->getNodeData($blog_id);
64  if ($node["title"]) {
65  // #10116
66  $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
67  $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
68  $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
69  $files_str = '<a href="' . $blog_link . '">' .
70  $node["title"] . '</a>';
71  $valid_blog = true;
72  }
73  // remove invalid resource if no upload yet (see download below)
74  elseif (substr($selected_blog["filename"], -1) == "/") {
75  // #16887
76  $a_submission->deleteResourceObject($selected_blog["returned_id"]);
77  }
78  }
79  if ($a_submission->canSubmit()) {
80  if (!$valid_blog) {
81  $button = ilLinkButton::getInstance();
82  $button->setCaption("exc_create_blog");
83  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createBlog"));
84  $files_str.= $button->render();
85  }
86  // #10462
87  $blogs = sizeof($wsp_tree->getObjectsFromType("blog"));
88  if ((!$valid_blog && $blogs)
89  || ($valid_blog && $blogs > 1)) {
90  $button = ilLinkButton::getInstance();
91  $button->setCaption("exc_select_blog" . ($valid_blog ? "_change" : ""));
92  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectBlog"));
93  $files_str.= " " . $button->render();
94  }
95  }
96  if ($files_str) {
97  $a_info->addProperty($lng->txt("exc_blog_returned"), $files_str);
98  }
99  if ($a_submission->hasSubmitted()) {
100  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_blog["returned_id"]);
101  $dl_link = $ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
102  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
103 
104  $button = ilLinkButton::getInstance();
105  $button->setCaption("download");
106  $button->setUrl($dl_link);
107 
108  $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
109  }
110  }
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
Create styles array
The data for the language used.
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 112 of file class.ilExSubmissionObjectGUI.php.

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

113  {
114  global $DIC;
115 
116  $lng = $DIC->language();
117  $ilCtrl = $DIC->ctrl();
118 
119  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
120 
121  $files_str = "";
122  $valid_prtf = false;
123  $selected_prtf = $a_submission->getSelectedObject();
124  if ($selected_prtf) {
125  $portfolio_id = (int) $selected_prtf["filetitle"];
126 
127  // #11746
128  if (ilObject::_exists($portfolio_id, false, "prtf")) {
129  $portfolio = new ilObjPortfolio($portfolio_id, false);
130  if ($portfolio->getTitle()) {
131  // #10116 / #12791
132  $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
133 
134  $ref_id = $_REQUEST['ref_id'];
135  $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", $ref_id);
136 
137  $ilCtrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
138 
139  $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view");
140  $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
141  $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", "");
142 
143 
144  $files_str = '<a href="' . $prtf_link .
145  '">' . $portfolio->getTitle() . '</a>';
146  $valid_prtf = true;
147  }
148  }
149  // remove invalid resource if no upload yet (see download below)
150  elseif (substr($selected_prtf["filename"], -1) == "/") {
151  // #16887
152  $a_submission->deleteResourceObject($selected_prtf["returned_id"]);
153  }
154  }
155  if ($a_submission->canSubmit()) {
156  if (!$valid_prtf) {
157  $button = ilLinkButton::getInstance();
158  $button->setCaption("exc_create_portfolio");
159  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createPortfolioFromAssignment"));
160 
161  $files_str .= "" . $button->render();
162  }
163  // #10462
164  //selectPortfolio ( remove it? )
165  $prtfs = sizeof(ilObjPortfolio::getPortfoliosOfUser($a_submission->getUserId()));
166  if ((!$valid_prtf && $prtfs)
167  || ($valid_prtf && $prtfs > 1)) {
168  $button = ilLinkButton::getInstance();
169  $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_change" : ""));
170  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectPortfolio"));
171  $files_str.= " " . $button->render();
172  }
173  if ($valid_prtf) {
174  $button = ilLinkButton::getInstance();
175  $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_unlink" : ""));
176  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "askUnlinkPortfolio"));
177  $files_str.= " " . $button->render();
178  }
179  }
180  if ($files_str) {
181  $a_info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
182  }
183  if ($a_submission->hasSubmitted()) {
184  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_prtf["returned_id"]);
185  $dl_link =$ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
186  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
187 
188  $button = ilLinkButton::getInstance();
189  $button->setCaption("download");
190  $button->setUrl($dl_link);
191 
192  $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
193  }
194  }
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
Create styles array
The data for the language used.
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 705 of file class.ilExSubmissionObjectGUI.php.

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

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

706  {
707  global $DIC;
708 
709  $ilUser = $DIC->user();
710 
711  if (!$a_user_id) {
712  $a_user_id = $ilUser->getId();
713  }
714 
715  include_once "Modules/Exercise/classes/class.ilObjExercise.php";
716  include_once "Modules/Exercise/classes/class.ilExAssignment.php";
717  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
718 
719  $ass = new ilExAssignment($a_ass_id);
720  $sub = new ilExSubmission($ass, $a_user_id);
721  $exc_id = $ass->getExerciseId();
722 
723  // #11173 - ref_id is needed for notifications
724  $exc_ref_id = array_shift(ilObject::_getAllReferences($exc_id));
725  $exc = new ilObjExercise($exc_ref_id, true);
726 
727  return new self($exc, $sub);
728  }
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.
+ 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 382 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by createPortfolioTemplateObject(), and setSelectedPortfolioTemplateObject().

383  {
384  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
385  $form = new ilPropertyFormGUI();
386  $form->setTitle($this->lng->txt("exc_create_portfolio") . ": " . $this->assignment->getTitle());
387  $form->setFormAction($this->ctrl->getFormAction($this, "setSelectedPortfolioTemplate"));
388 
389  $prtt = new ilRadioGroupInputGUI($this->lng->txt("obj_prtt"), "prtt");
390  $prtt->setRequired(true);
391  $prtt->addOption(new ilRadioOption($this->lng->txt("exc_create_portfolio_no_template"), -1));
392  foreach ($a_templates as $id => $title) {
393  $prtt->addOption(new ilRadioOption('"' . $title . '"', $id));
394  }
395  $prtt->setValue(-1);
396  $form->addItem($prtt);
397 
398  $form->addCommandButton("setSelectedPortfolioTemplate", $this->lng->txt("save"));
399  $form->addCommandButton("returnToParent", $this->lng->txt("cancel"));
400 
401  return $form;
402  }
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 196 of file class.ilExSubmissionObjectGUI.php.

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

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

197  {
198  if (!$this->submission->canSubmit()) {
199  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
200  $this->returnToParentObject();
201  }
202 
203  $tpl = new ilTemplate("tpl.exc_select_resource.html", true, true, "Modules/Exercise");
204 
205  if (is_array($a_items)) {
206  $tpl->setCurrentBlock("item");
207  foreach ($a_items as $item_id => $item_title) {
208  $tpl->setVariable("ITEM_ID", $item_id);
209  $tpl->setVariable("ITEM_TITLE", $item_title);
210  $tpl->parseCurrentBlock();
211  }
212  $tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
213  $tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
214  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
215  $tpl->setVariable("CMD_SUBMIT", $a_cmd);
216  $tpl->setVariable("CMD_CANCEL", "returnToParent");
217  $html = $tpl->get();
218  } elseif ($a_explorer_cmd) {
219  $html = $this->renderWorkspaceExplorer($a_explorer_cmd);
220  }
221 
222 
223  ilUtil::sendInfo($this->lng->txt($a_info));
224 
225  $title = $this->lng->txt($a_title) . ": " . $this->assignment->getTitle();
226 
227  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
228  $panel = ilPanelGUI::getInstance();
229  $panel->setBody($html);
230  $panel->setHeading($title);
231 
232  $this->tpl->setContent($panel->getHTML());
233  }
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 333 of file class.ilExSubmissionObjectGUI.php.

References array, exit, and ilTreeExplorerGUI\setTypeWhiteList().

Referenced by renderResourceSelection().

334  {
335  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
336  switch ($a_cmd) {
337  case "selectBlog":
338  $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "setSelectedBlog");
339  $exp2->setTypeWhiteList(array("blog", "wsrt", "wfld"));
340  $exp2->setSelectableTypes(array("blog"));
341  break;
342 
343  case "createBlog":
344  $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "saveBlog");
345  $exp2->setTypeWhiteList(array("wsrt", "wfld"));
346  $exp2->setSelectableTypes(array("wsrt", "wfld"));
347  break;
348  }
349  if (!$exp2->handleCommand()) {
350  return $exp2->getHTML();
351  }
352  exit;
353  }
setTypeWhiteList($a_val)
Set type white list.
Explorer for selecting a personal workspace item.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveBlogObject()

ilExSubmissionObjectGUI::saveBlogObject ( )
protected

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

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

265  {
266  if (!$this->submission->canSubmit()) {
267  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
268  $this->returnToParentObject();
269  }
270 
271  if (!$_GET["sel_wsp_obj"]) {
272  ilUtil::sendFailure($this->lng->txt("select_one"));
273  return $this->createBlogObject();
274  }
275 
276  $parent_node = $_GET["sel_wsp_obj"];
277 
278  include_once "Modules/Blog/classes/class.ilObjBlog.php";
279  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
280  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
281 
282  $blog = new ilObjBlog();
283  $blog->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
284  $blog->create();
285 
286  $tree = new ilWorkspaceTree($this->submission->getUserId()); // #15993
287 
288  $node_id = $tree->insertObject($parent_node, $blog->getId());
289 
290  $access_handler = new ilWorkspaceAccessHandler($tree);
291  $access_handler->setPermissions($parent_node, $node_id);
292 
293  $this->submission->deleteAllFiles();
294  $this->handleRemovedUpload();
295 
296  $this->submission->addResourceObject($node_id);
297 
298  ilUtil::sendSuccess($this->lng->txt("exc_blog_created"), true);
299  $this->returnToParentObject();
300  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_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 252 of file class.ilExSubmissionObjectGUI.php.

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

253  {
254  $this->handleTabs();
255 
256  return $this->renderResourceSelection(
257  "exc_select_blog",
258  "exc_select_blog_info",
259  "setSelectedBlog",
260  "selectBlog"
261  );
262  }
renderResourceSelection($a_title, $a_info, $a_cmd, $a_explorer_cmd, array $a_items=null)
+ Here is the call graph for this function:

◆ selectPortfolioObject()

ilExSubmissionObjectGUI::selectPortfolioObject ( )
protected

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

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

Referenced by setSelectedBlogObject(), and setSelectedPortfolioObject().

361  {
362  $this->handleTabs();
363 
364  $items = array();
365  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
366  $portfolios = ilObjPortfolio::getPortfoliosOfUser($this->submission->getUserId());
367  if ($portfolios) {
368  foreach ($portfolios as $portfolio) {
369  $items[$portfolio["id"]]= $portfolio["title"];
370  }
371  }
372 
373  return $this->renderResourceSelection(
374  "exc_select_portfolio",
375  "exc_select_portfolio_info",
376  "setSelectedPortfolio",
377  null,
378  $items
379  );
380  }
static getPortfoliosOfUser($a_user_id)
Get views of user.
Create styles array
The data for the language used.
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 302 of file class.ilExSubmissionObjectGUI.php.

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

303  {
304  if (!$this->submission->canSubmit()) {
305  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
306  $this->returnToParentObject();
307  }
308 
309  if ($_GET["sel_wsp_obj"]) {
310  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
311  $tree = new ilWorkspaceTree($this->submission->getUserId());
312  $node = $tree->getNodeData($_GET["sel_wsp_obj"]);
313  if ($node && $node["type"] == "blog") {
314  $this->submission->deleteAllFiles();
315  $this->handleRemovedUpload();
316 
317  $this->submission->addResourceObject($node["wsp_id"]);
318 
319  ilUtil::sendSuccess($this->lng->txt("exc_blog_selected"), true);
320  $this->ctrl->setParameter($this, "blog_id", $node["wsp_id"]);
321  $this->ctrl->redirect($this, "askDirectSubmission");
322  }
323  }
324 
325  ilUtil::sendFailure($this->lng->txt("select_one"));
326  return $this->selectPortfolioObject();
327  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_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.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ setSelectedPortfolioObject()

ilExSubmissionObjectGUI::setSelectedPortfolioObject ( )
protected

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

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

513  {
514  if (!$this->submission->canSubmit()) {
515  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
516  $this->returnToParentObject();
517  }
518 
519  if ($_POST["item"]) {
520  $this->submission->deleteAllFiles();
521  $this->handleRemovedUpload();
522 
523  $this->submission->addResourceObject($_POST["item"]);
524 
525  ilUtil::sendSuccess($this->lng->txt("exc_portfolio_selected"), true);
526  $this->ctrl->setParameter($this, "prtf_id", $_POST["item"]);
527  $this->ctrl->redirect($this, "askDirectSubmission");
528  }
529 
530  ilUtil::sendFailure($this->lng->txt("select_one"));
531  return $this->selectPortfolioObject();
532  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 457 of file class.ilExSubmissionObjectGUI.php.

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

458  {
459  if (!$this->submission->canSubmit()) {
460  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
461  $this->returnToParentObject();
462  }
463 
464  include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
466  if (!sizeof($templates)) {
467  $this->ctrl->redirect($this, "returnToParent");
468  }
469 
470  $form = $this->initPortfolioTemplateForm($templates);
471  if ($form->checkInput()) {
472  $prtt = $form->getInput("prtt");
473  if ($prtt > 0 && array_key_exists($prtt, $templates)) {
474  $title = $this->exercise->getTitle() . " - " . $this->assignment->getTitle();
475  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "exc_id", $this->exercise->getRefId());
476  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "ass_id", $this->assignment->getId());
477  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "pt", $title);
478  $this->ctrl->setParameterByClass("ilObjPortfolioGUI", "prtt", $prtt);
479  $this->ctrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", (int) $_GET["ref_id"]);
480  $this->ctrl->redirectByClass(array("ilPersonalDesktopGUI", "ilPortfolioRepositoryGUI", "ilObjPortfolioGUI"), "createPortfolioFromTemplate");
481  } else {
482  // do not use template
483  return $this->createPortfolioObject();
484  }
485  }
486 
487  $form->setValuesByPost();
489  }
$_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")
Create styles array
The data for the language used.
+ 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 637 of file class.ilExSubmissionObjectGUI.php.

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

Referenced by directSubmitObject().

638  {
639  if (!$this->submission->canSubmit()) {
640  return;
641  }
642 
643  $blog_id = $a_blog_id;
644 
645  include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
646  $blog_gui = new ilObjBlogGUI($blog_id, ilObjBlogGUI::WORKSPACE_NODE_ID);
647  if ($blog_gui->object) {
648  $file = $blog_gui->buildExportFile();
649  $size = filesize($file);
650  if ($size) {
651  $this->submission->deleteAllFiles();
652 
653  $meta = array(
654  "name" => $blog_id,
655  "tmp_name" => $file,
656  "size" => $size
657  );
658  $this->submission->uploadFile($meta, true);
659 
660  $this->handleNewUpload();
661  return true;
662  }
663  }
664  return false;
665  }
$size
Definition: RandomTest.php:84
handleNewUpload($a_no_notifications=false)
Class ilObjBlogGUI.
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 673 of file class.ilExSubmissionObjectGUI.php.

References $file, $size, array, and ilExSubmissionBaseGUI\handleNewUpload().

Referenced by directSubmitObject().

674  {
675  if (!$this->submission->canSubmit()) {
676  return;
677  }
678 
679  $prtf_id = $a_portfolio_id;
680 
681  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
682  $prtf = new ilObjPortfolio($prtf_id, false);
683  if ($prtf->getTitle()) {
684  include_once "Modules/Portfolio/classes/class.ilPortfolioHTMLExport.php";
685  $export = new ilPortfolioHTMLExport(null, $prtf);
686  $file = $export->buildExportFile();
687  $size = filesize($file);
688  if ($size) {
689  $this->submission->deleteAllFiles();
690 
691  $meta = array(
692  "name" => $prtf_id,
693  "tmp_name" => $file,
694  "size" => $size
695  );
696  $this->submission->uploadFile($meta, true);
697 
698  $this->handleNewUpload();
699  return true;
700  }
701  }
702  return false;
703  }
$size
Definition: RandomTest.php:84
Portfolio HTML exporter class.
handleNewUpload($a_no_notifications=false)
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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, ilExSubmission\deleteResourceObject(), and ilUtil\sendSuccess().

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $DIC
Definition: saml.php:7
deleteResourceObject($a_returned_id)
Remove personal resource to assigment.
Exercise submission.
+ Here is the call graph for this function:

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