ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.ilObjCourseVerificationGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
20
22
29{
30 private Container $dic;
32
33 protected ilTabsGUI $tabs;
34
35 public function __construct(int $a_id = 0, int $a_id_type = self::REPOSITORY_NODE_ID, int $a_parent_node_id = 0)
36 {
37 global $DIC;
38 $this->dic = $DIC;
39 $this->error = $DIC->error();
40 $this->tabs = $DIC->tabs();
41
42 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
43 }
44
45 public function getType(): string
46 {
47 return "crsv";
48 }
49
50 public function create(): void
51 {
52 // new verification objects can't be created anymore, https://docu.ilias.de/go/wiki/wpage_6361_1357
53 }
54
55 public function save(): void
56 {
57 // new verification objects can't be created anymore, https://docu.ilias.de/go/wiki/wpage_6361_1357
58 }
59
60 public function deliver(): void
61 {
62 $file = $this->object->getFilePath();
63 if ($file) {
64 ilFileDelivery::deliverFileLegacy($file, $this->object->getTitle() . ".pdf");
65 }
66 }
67
68 public function render(bool $a_return = false, string $a_url = ''): string
69 {
70 $ilUser = $this->dic->user();
71 $lng = $this->dic->language();
72
73 if (!$a_return) {
74 $this->deliver();
75 } else {
76 $tree = new ilWorkspaceTree($ilUser->getId());
77 $wsp_id = $tree->lookupNodeId($this->object->getId());
78
79 $caption = $lng->txt("wsp_type_crsv") . ' "' . $this->object->getTitle() . '"';
80
81 $valid = true;
82 $message = '';
83 if (!file_exists($this->object->getFilePath())) {
84 $valid = false;
85 $message = $lng->txt("url_not_found");
86 } elseif (!$a_url) {
88 if (!$access_handler->checkAccess("read", "", $wsp_id)) {
89 $valid = false;
90 $message = $lng->txt("permission_denied");
91 }
92 }
93
94 if ($valid) {
95 if (!$a_url) {
96 $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
97 }
98 return '<div><a href="' . $a_url . '">' . $caption . '</a></div>';
99 }
100
101 return '<div>' . $caption . ' (' . $message . ')</div>';
102 }
103
104 return "";
105 }
106
107 public function downloadFromPortfolioPage(ilPortfolioPage $a_page): void
108 {
109 if (ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId())) {
110 $this->deliver();
111 }
112 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
113 }
114
115 public static function _goto(string $a_target): void
116 {
117 global $DIC;
118
119 $ctrl = $DIC->ctrl();
120
121 $id = explode("_", $a_target);
122
124 ilSharedResourceGUI::class,
125 'wsp_id',
126 $id[0]
127 );
128 $ctrl->redirectByClass(ilSharedResourceGUI::class);
129 }
130
135 protected function getRequestValue(string $key, $default = null)
136 {
137 if (isset($this->request->getQueryParams()[$key])) {
138 return $this->request->getQueryParams()[$key];
139 }
140
141 if (isset($this->request->getParsedBody()[$key])) {
142 return $this->request->getParsedBody()[$key];
143 }
144
145 return $default ?? null;
146 }
147}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:38
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
Error Handling & global info handling.
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
GUI class for course verification.
getRequestValue(string $key, $default=null)
downloadFromPortfolioPage(ilPortfolioPage $a_page)
getType()
Functions that must be overwritten.
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
render(bool $a_return=false, string $a_url='')
New implementation of ilObjectGUI.
static isInPortfolioPage(ilPortfolioPage $a_page, string $a_type, int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26