41 $this->
lng = $DIC->language();
42 $this->
help = $DIC[
"ilHelp"];
44 $this->
access = $DIC->access();
45 $this->
user = $DIC->user();
46 $this->
ctrl = $DIC->ctrl();
47 $this->
ui = $DIC->ui();
49 $this->tool_context =
$DIC->globalScreen()->tool()->context();
54 $this->
ctrl->saveParameter($this,
"exc_back_ref_id");
55 $this->notes_gui =
$DIC->notes()->gui();
56 $this->skill_personal_service =
$DIC->skills()->personal();
70 if ($perm ===
"create") {
76 return $this->access_handler->checkAccess($perm,
"",
$node_id);
81 $this->checkPermission(
"read");
82 $this->setTitleAndDescription();
84 $next_class = $this->
ctrl->getNextClass($this);
85 $cmd = $this->
ctrl->getCmd(
"view");
88 $this->triggerAssignmentTool();
89 switch ($next_class) {
90 case "ilworkspaceaccessgui":
91 if ($this->checkPermissionBool(
"write")) {
93 $this->tabs_gui->activateTab(
"share");
95 $this->tpl->setPermanentLink(
"prtf", $this->
object->getId());
98 $wspacc->setBlockingMessage($this->getOfflineMessage());
99 $this->
ctrl->forwardCommand($wspacc);
103 case 'ilportfoliopagegui':
104 if ($this->determinePageCall()) {
108 $this->handlePageCall($cmd);
115 case "ilcommonactiondispatchergui":
118 $this->
ctrl->forwardCommand($gui);
121 case "ilobjectcontentstylesettingsgui":
122 $this->checkPermission(
"write");
125 $this->tabs_gui->activateTab(
"settings");
126 $this->setSettingsSubTabs(
"style");
127 $settings_gui = $this->content_style_gui
128 ->objectSettingsGUIForObjId(
132 $this->
ctrl->forwardCommand($settings_gui);
135 case "ilportfolioexercisegui":
136 $this->
ctrl->setReturn($this,
"view");
138 $this->
ctrl->forwardCommand($gui);
141 case strtolower(SettingsGUI::class):
142 $this->checkPermission(
"write");
145 $this->tabs_gui->activateTab(
"settings");
146 $this->setSettingsSubTabs(
"properties");
147 $gui = $this->gui->settings()->settingsGUI(
151 $this->
ctrl->forwardCommand($gui);
156 if ($cmd !==
"preview") {
167 $this->
ctrl->redirectByClass(SettingsGUI::class);
172 if (!is_object($this->
object) || $this->
object->getId() <= 0) {
177 $assignments = $pe->getAssignmentsOfPortfolio();
178 if (count($assignments) > 0) {
179 $ass_ids = array_map(
static function ($i) {
190 $ilHelp = $this->help;
192 $ilHelp->setScreenIdComponent(
"prtf");
194 if ($this->checkPermissionBool(
"write")) {
195 $this->tabs_gui->addTab(
197 $this->
lng->txt(
"content"),
198 $this->ctrl->getLinkTarget($this,
"view")
201 $this->tabs_gui->addTab(
203 $this->
lng->txt(
"settings"),
204 $this->ctrl->getLinkTargetByClass(SettingsGUI::class)
207 $this->tabs_gui->addNonTabbedLink(
209 $this->
lng->txt(
"preview"),
210 $this->ctrl->getLinkTarget($this,
"preview")
213 $this->
lng->loadLanguageModule(
"wsp");
214 $this->tabs_gui->addTab(
216 $this->
lng->txt(
"wsp_permissions"),
217 $this->ctrl->getLinkTargetByClass(
"ilworkspaceaccessgui",
"share")
224 if (!$this->creation_mode) {
225 $this->
ctrl->setParameter($this,
"prt_id", $this->
object->getId());
228 $this->addLocatorItems();
230 $this->tpl->setLocator();
237 $title = $this->
lng->txt(
"portfolio");
239 $title .=
": " . $this->
object->getTitle();
241 $this->tpl->setTitle($title);
242 $this->tpl->setTitleIcon(
244 $this->
lng->txt(
"portfolio")
248 $this->
object->getOfflineStatus()) {
249 $this->tpl->setAlertProperties(array(
250 array(
"alert" =>
true,
251 "property" => $this->
lng->txt(
"status"),
252 "value" => $this->lng->txt(
"offline"))
267 $new_type = $this->port_request->getNewType();
270 $this->
ctrl->saveParameter($this,
"crtptrefid");
272 $this->
ctrl->saveParameter($this,
"crtcb");
274 if (!$this->checkPermissionBool(
"create",
"", $new_type)) {
275 $ilErr->raiseError($this->
lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
277 $this->
lng->loadLanguageModule($new_type);
278 $this->
ctrl->setParameter($this,
"new_type", $new_type);
280 $form = $this->getCreationForm();
282 $tpl->setContent($form->render());
291 $new_type = $this->port_request->getNewType();
294 $this->
ctrl->saveParameter($this,
"crtptrefid");
296 $this->
ctrl->saveParameter($this,
"crtcb");
298 if (!$this->checkPermissionBool(
"create",
"", $new_type)) {
299 $ilErr->raiseError($this->
lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
301 $this->
lng->loadLanguageModule($new_type);
302 $this->
ctrl->setParameter($this,
"new_type", $new_type);
303 $form = $this->initCreateFromTemplateForm();
304 $tpl->setContent($form->getHTML());
322 $this->
ctrl->setParameter($this,
"new_type", $this->getType());
324 return $this->gui->form([static::class],
"save")
325 ->section(
"prop", $this->
lng->txt(
"prtf_create_portfolio"))
336 $this->
ctrl->setParameter($this,
"new_type", $this->getType());
339 $form->setFormAction($this->
ctrl->getFormAction($this));
345 $ti->setRequired(
true);
350 if (count($templates)) {
352 $tmpl->setRequired(
true);
353 $tmpl->setOptions(array(
"" => $this->
lng->txt(
"please_select")) + $templates);
354 $form->addItem($tmpl);
357 $template_id = $this->port_request->getPortfolioTemplateId();
358 if ($template_id > 0) {
359 $tmpl->setValue($template_id);
363 $form->setTitle($this->
lng->txt(
"prtf_add_portfolio_from_template"));
364 $form->addCommandButton(
"saveFromTemplate", $this->
lng->txt(
"create"));
365 $form->addCommandButton(
"toRepository", $this->
lng->txt(
"cancel"));
372 $form = $this->getCreationForm();
373 if ($form->isValid()) {
375 $port->setTitle($form->getData(
"title"));
377 $this->
ctrl->setParameter($this,
"prt_id", $port->getId());
378 $this->
ctrl->redirect($this,
"view");
380 $this->tpl->setContent($form->render());
385 $form = $this->initCreateFromTemplateForm();
387 if ($form->checkInput()) {
388 $this->createFromTemplateDirect(
389 $form->getInput(
"title"),
390 $this->port_request->getPortfolioTemplate()
394 $form->setValuesByPost();
395 $this->tpl->setContent($form->getHTML());
401 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created"),
true);
402 $this->
ctrl->setParameter($this,
"prt_id", $new_object->
getId());
403 $this->
ctrl->redirect($this,
"view");
408 $ilAccess = $this->access;
411 $exc_ref_id = $this->port_request->getExerciseRefId();
413 $ilAccess->checkAccess(
"read",
"", $exc_ref_id)) {
417 $this->
ctrl->redirectByClass(
"ilportfoliorepositorygui",
"show");
429 ?
int $a_page_id =
null,
430 ?
int $a_portfolio_id =
null
433 if (!$a_portfolio_id && $this->
object) {
434 $a_portfolio_id = $this->
object->getId();
437 $page->setPortfolioId($a_portfolio_id);
451 $this->
object->hasPublicComments()
453 $page_gui->
setStyleId($this->content_style_domain->getEffectiveStyleId());
454 $page_gui->setAdditional($this->getAdditional());
460 return "ilportfoliopagegui";
466 $a_tgt->setRequired(
true);
469 $old =
new ilRadioOption($this->
lng->txt(
"prtf_existing_portfolio"),
"old");
470 $a_tgt->addOption($old);
474 foreach ($all as $item) {
475 $options[$item[
"id"]] = $item[
"title"];
478 $prtf->setRequired(
true);
480 $old->addSubItem($prtf);
483 $a_tgt->addOption($new);
486 $tf->setMaxLength(128);
488 $tf->setRequired(
true);
489 $new->addSubItem($tf);
500 $title = $this->port_request->getPortfolioTitle();
501 $prtt_id = $this->port_request->getPortfolioTemplate();
505 if (!count($templates) || !in_array($prtt_id, $templates)) {
506 $this->toRepository();
510 $this->
ctrl->setParameter($this,
"prtt", $prtt_id);
513 $a_form = $this->initCreatePortfolioFromTemplateForm($prtt_id, $title);
516 $this->tpl->setContent($a_form->getHTML());
518 $this->createPortfolioFromTemplateProcess(
false);
527 $ilUser = $this->user;
529 $exc_id = $this->port_request->getExerciseRefId();
530 $ass_id = $this->port_request->getExcAssId();
532 $this->
ctrl->setParameter($this,
"exc_id", $exc_id);
533 $this->
ctrl->setParameter($this,
"ass_id",
$ass_id);
537 $form->setFormAction($this->
ctrl->getFormAction($this));
541 $form->addItem($tmpl);
544 $title->setValue($a_title);
545 $form->addItem($title);
547 $has_form_content =
false;
549 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
550 $skill_ids = array();
553 switch ($page[
"type"]) {
557 $source_page->buildDom(
true);
558 $skill_ids = $this->getSkillsToPortfolioAssignment($pskills, $skill_ids, $source_page);
560 if (count($skill_ids)) {
561 $has_form_content =
true;
569 $skills->setInfo($this->
lng->txt(
"prtf_template_import_new_skills"));
570 $skills->setValue($skill_ids);
571 foreach ($skill_ids as $skill_id) {
574 $form->addItem($skills);
577 if (!$has_form_content) {
581 $form->setTitle($this->
lng->txt(
"prtf_creation_mode") .
": " . $this->lng->txt(
"prtf_creation_mode_template"));
582 $form->addCommandButton(
"createPortfolioFromTemplateProcess", $this->
lng->txt(
"continue"));
583 $form->addCommandButton(
"toRepository", $this->
lng->txt(
"cancel"));
589 bool $a_process_form =
true
593 $title = $this->port_request->getPortfolioTitle();
594 $prtt_id = $this->port_request->getPortfolioTemplate();
598 if (!count($templates) || !in_array($prtt_id, $templates)) {
599 $this->toRepository();
605 if ($a_process_form) {
606 $this->
ctrl->setParameter($this,
"prtt", $prtt_id);
608 $form = $this->initCreatePortfolioFromTemplateForm($prtt_id, $title);
609 if ($form->checkInput()) {
611 $recipe[
"skills"] = (array) $form->getInput(
"skill_ids");
613 $form->setValuesByPost();
614 $this->createPortfolioFromTemplate($form);
623 $target->setTitle($title);
625 $target_id = $target->getId();
630 $this->linkPortfolioToAssignment($target_id);
632 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
633 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
634 $this->
ctrl->redirect($this,
"preview");
644 if ($prtt_id === 0) {
645 $prtt_id = $this->port_request->getPortfolioTemplateId();
653 if (!count($templates) || !in_array($prtt_id, $templates)) {
654 $this->toRepository();
662 $target->setTitle($title);
664 $target_id = $target->getId();
671 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
672 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
673 $this->
ctrl->redirect($this,
"preview");
677 public static function _goto(
string $a_target): void
681 $ctrl =
$DIC->ctrl();
683 $id = explode(
"_", $a_target);
685 $ctrl->setParameterByClass(self::class,
'prt_id',
$id[0]);
686 if (count(
$id) === 2 && is_numeric(
$id[1])) {
687 $ctrl->setParameterByClass(self::class,
'user_page',
$id[1]);
689 $ctrl->redirectByClass([ilSharedResourceGUI::class, self::class],
'preview');
694 $ilUser = $this->user;
699 $title = $this->port_request->getPortfolioTitle();
700 $prtt_id = $this->port_request->getPortfolioTemplate();
703 $ass_template_id = 0;
704 $ass_id = $this->port_request->getExcAssId();
712 if (!count($templates) || !in_array($prtt_id, $templates)) {
713 if ($ass_template_id !== $prtt_id) {
714 $this->toRepository();
719 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
720 $skill_ids = array();
724 switch ($page[
"type"]) {
727 $source_page->buildDom(
true);
728 $skill_ids = $this->getSkillsToPortfolioAssignment($pskills, $skill_ids, $source_page);
734 $recipe[
"skills"] = $skill_ids;
740 $target->setTitle($title);
742 $target_id = $target->getId();
750 $this->linkPortfolioToAssignment($target_id);
752 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
754 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
755 $this->
ctrl->redirect($this,
"preview");
757 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created"),
true);
758 $this->
ctrl->redirect($this,
"view");
764 $ilAccess = $this->access;
765 $ilUser = $this->user;
767 $exc_ref_id = $this->port_request->getExerciseRefId();
768 $ass_id = $this->port_request->getExcAssId();
772 $ilAccess->checkAccess(
"read",
"", $exc_ref_id)) {
775 if ($ass->getExerciseId() === $exc->getId() &&
779 $sub->addResourceObject($a_target_id);
789 $dom = $a_source_page->getDomDoc();
790 $xpath =
new DOMXPath($dom);
791 $nodes = $xpath->query(
"//PageContent/Skills");
792 foreach ($nodes as $node) {
793 $skill_id = $node->getAttribute(
"Id");
794 if (!in_array($skill_id, $a_pskills)) {
795 $a_skill_ids[] = $skill_id;
798 unset($nodes, $xpath, $dom);
808 $view = $this->getPrintView();
818 $printview = $this->getPrintView();
819 $printview->sendPrintView();
831 if ($this->
object->getOfflineStatus()) {
835 $buttons = [
$f->button()->standard(
836 $lng->txt(
"prtf_set_online"),
837 $ctrl->getLinkTarget($this,
"setOnlineAndShare")
840 return $renderer->render(
$f->messageBox()->info(
$lng->txt(
"prtf_no_offline_share_info"))
841 ->withButtons($buttons));
851 $ilCtrl = $this->ctrl;
855 $this->
object->setOfflineStatus(
false);
856 $this->
object->update();
857 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"prtf_has_been_set_online"),
true);
859 $ilCtrl->redirectByClass(
"ilworkspaceaccessgui",
"");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This class represents an option in a checkbox group.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Exercise submission //TODO: This class has many static methods related to delivered "files".
This class represents a non editable value in a property form.
Portfolio view gui base class.
static clonePagesAndSettings(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target, ?array $a_recipe=null, bool $copy_all=false)
Build template from portfolio and vice versa.
@ilCtrl_Calls ilObjPortfolioGUI: ilPortfolioPageGUI, ilPageObjectGUI @ilCtrl_Calls ilObjPortfolioGUI:...
getPageInstance(?int $a_page_id=null, ?int $a_portfolio_id=null)
Get portfolio template page instance.
setOnlineAndShare()
Set online and switch to share screen.
linkPortfolioToAssignment(int $a_target_id)
getType()
Functions that must be overwritten.
initCreatePortfolioFromTemplateForm(int $a_prtt_id, string $a_title)
getOfflineMessage()
Get offline message for sharing tab.
getPageGUIInstance(int $a_page_id)
Get portfolio template page gui instance.
executeCommand()
execute command
ilPortfolioDeclarationOfAuthorship $declaration_authorship
createPortfolioFromAssignment()
ILIAS Notes GUIService $notes_gui
getSkillsToPortfolioAssignment(array $a_pskills, array $a_skill_ids, ilPortfolioTemplatePage $a_source_page)
ILIAS Skill Service SkillPersonalService $skill_personal_service
ContextServices $tool_context
afterSave(ilObject $new_object)
Post (successful) object creation hook.
createPortfolioFromTemplateProcess(bool $a_process_form=true)
static _goto(string $a_target)
createPortfolioFromTemplate(?ilPropertyFormGUI $a_form=null)
initCopyPageFormOptions(ilPropertyFormGUI $a_form)
createFromTemplateDirect(string $title="", int $prtt_id=0)
Create portfolio template direct.
setTabs()
create tabs (repository/workspace switch)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
initCreateFromTemplateForm()
ilWorkspaceAccessHandler $ws_access
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAvailablePortfolioTemplates(string $a_permission="read")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPortfoliosOfUser(int $a_user_id)
Get portfolios of user.
Class ilObject Basic functions for all objects.
static _lookupObjectId(int $ref_id)
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _lookupTitle(int $obj_id)
setStyleId(int $a_styleid)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPortfolioExerciseGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Portfolio page gui class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents an option in a radio group.
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
This class represents a text property in a property form.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))