19declare(strict_types=1);
45 public function init(): void
47 $this->static_link_enabled =
true;
48 $this->delete_enabled =
true;
49 $this->cut_enabled =
true;
50 $this->copy_enabled =
true;
51 $this->subscribe_enabled =
true;
52 $this->link_enabled =
true;
53 $this->info_screen_enabled =
true;
55 $this->gui_class_name =
"ilobjtestgui";
71 ->getAdditionalSettings()->getHideInfoTab()) {
74 }
catch (Exception
$e) {
75 $this->disableTitleLink(
true);
76 $this->enableInfoScreen(
false);
77 $this->enableLearningProgress(
false);
78 $this->enableLPSettingsCommand(
false);
79 $this->enableTimings(
false);
80 $this->enableLink(
false);
81 $this->enableCut(
false);
82 $this->enableCopy(
false);
83 $this->enableComments(
false);
84 $this->enableNotes(
false);
85 $this->enableTags(
false);
86 $this->enableSubscribe(
false);
87 $this->enableMultiDownload(
false);
90 parent::initItem(
$ref_id, $obj_id, $type, $title, $description);
103 $props = parent::getProperties();
105 $participant_access = $this->test_access->isParticipantAllowed(
110 if ($participant_access !== ParticipantAccess::ALLOWED) {
111 $props[] = [
'alert' =>
true,
'property' => $this->
lng->txt(
'status'),
112 'value' => $participant_access->getAccessForbiddenMessage($this->
lng)];
116 if ($this->obj_test_access->showCertificateFor($this->user->getId(), $this->obj_id)) {
117 $this->
lng->loadLanguageModule(
'certificate');
118 $this->
ctrl->setParameterByClass(ilTestEvaluationGUI::class,
'ref_id', $this->ref_id);
121 'property' => $this->
lng->txt(
'certificate'),
122 'value' => $this->
ui->renderer()->render(
123 $this->
ui->factory()->link()->standard(
124 $this->lng->txt(
'download_certificate'),
125 $this->ctrl->getLinkTargetByClass(
128 ilTestEvaluationGUI::class
135 $this->
ctrl->setParameterByClass(ilTestEvaluationGUI::class,
'ref_id',
null);
143 $cmd = explode(
'::', $cmd);
145 if (count($cmd) === 2) {
146 $cmd_link = $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, ilObjTestGUI::class, $cmd[0]], $cmd[1]);
148 $cmd_link = $this->
ctrl->getLinkTargetByClass(
'ilObjTestGUI', $cmd[0]);
151 $params = array_merge([
'ref_id' => $this->ref_id], $this->command_link_params);
162 if ($this->test_access->isParticipantAllowed($this->obj_id, $this->user->getId())
163 === ParticipantAccess::BROKEN_TEST) {
166 $commands = parent::getCommands();
167 if ($this->
access->checkAccess(
'read',
'', $this->ref_id)) {
168 $this->insertCommand($this->getCommandLink(
'ILIAS\Test\Presentation\TestScreenGUI::testScreen'), $this->
lng->txt(
'tst_start_test'));
194 $this->command_link_params = $a_param;
197 public function getAsCard(
203 ): ?RepositoryObjectCard {
205 $card = parent::getAsCard(
$ref_id, $obj_id, $type, $title, $description);
206 if ($this->obj_test_access->showCertificateFor($this->user->getId(), $obj_id)) {
207 $card = $card->withCertificateIcon(
true);
216 return parent::modifyTitleLink($default_link);
219 $path = $this->tree->getPathFull($this->ref_id);
221 while ($parent = array_pop(
$path)) {
222 if ($parent[
'type'] ===
'crs') {
223 $parent_crs_ref_id = $parent[
'ref_id'];
228 $this->
ctrl->setParameterByClass(ilObjCourseGUI::class,
'ref_id', $parent_crs_ref_id);
229 $this->
ctrl->setParameterByClass(ilObjCourseGUI::class,
'tid', $this->ref_id);
230 $cmd_link = $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, ilObjCourseGUI::class],
'redirectLocToTest');
231 $this->
ctrl->clearParametersByClass(
'ilrepositorygui');
233 return parent::modifyTitleLink($cmd_link);
static isObjectiveTest(int $a_trst_ref_id)
Check if test ref_id is used in an objective course.
static _getCommands()
get commands
addCommandLinkParameter($a_param)
add command link parameters
initItem(int $ref_id, int $obj_id, string $type, string $title='', string $description='')
initialize new item (is called by getItemHTML())
getProperties()
Get item properties.
getCommandLink(string $cmd)
Get command link url.
ilTestAccess $test_access
createDefaultCommand(array $command)
overwritten from base class for course objectives
modifyTitleLink(string $default_link)
ilObjTestAccess $obj_test_access
getCommands()
get all current commands for a specific ref id (in the permission context of the current user)
enableInfoScreen(bool $info_screen)
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
if(!file_exists('../ilias.ini.php'))