Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Course: switch to LOM API #7916

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion components/ILIAS/Course/classes/class.ilCourseContentGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use ILIAS\Refinery\Factory;
use ILIAS\UI\Factory as UIFactory;
use ILIAS\UI\Renderer as UIRenderer;
use ILIAS\MetaData\Services\ServicesInterface as LOMServices;

/**
* Class ilCourseContentGUI
Expand Down Expand Up @@ -50,6 +51,7 @@ class ilCourseContentGUI
protected Factory $refinery;
protected UIFactory $ui_factory;
protected UIRenderer $ui_renderer;
protected LOMServices $lom_services;

public function __construct(ilContainerGUI $container_gui_obj)
{
Expand All @@ -70,6 +72,7 @@ public function __construct(ilContainerGUI $container_gui_obj)
$this->refinery = $DIC->refinery();
$this->ui_factory = $DIC->ui()->factory();
$this->ui_renderer = $DIC->ui()->renderer();
$this->lom_services = $DIC->learningObjectMetadata();

$this->container_gui = $container_gui_obj;
$this->container_obj = $this->container_gui->getObject();
Expand Down Expand Up @@ -411,7 +414,15 @@ public function __renderUserItem(array $item, int $level): void
$this->tpl->setVariable("DESC", $item['description']);
$this->tpl->parseCurrentBlock();
}
if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {

$tlt_data = $this->lom_services->read(
ilObject::_lookupObjId($item['ref_id']),
0,
$item['type'],
$this->lom_services->paths()->firstTypicalLearningTime()
)->firstData($this->lom_services->paths()->firstTypicalLearningTime());

if ($tlt = $this->lom_services->dataHelper()->durationToSeconds($tlt_data->value())) {
$this->tpl->setCurrentBlock("tlt");
$this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
$this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
Expand Down
15 changes: 10 additions & 5 deletions components/ILIAS/Course/classes/class.ilECSCourseSettings.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=0);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,10 @@
*
*********************************************************************/

declare(strict_types=0);

use ILIAS\MetaData\Services\ServicesInterface as LOMServices;

/**
* Class ilECSCourseSettings
* @author Stefan Meyer <[email protected]>
Expand All @@ -26,6 +28,7 @@
class ilECSCourseSettings extends ilECSObjectSettings
{
protected ilLogger $logger;
protected LOMServices $lom_services;

public function __construct(ilObject $a_content_object)
{
Expand All @@ -45,11 +48,13 @@ protected function buildJson(ilECSSetting $a_server)
$json = $this->getJsonCore('application/ecs-course');

// meta language
$lang = ilMDLanguage::_lookupFirstLanguage(
$lang = $this->lom_services->read(
$this->content_obj->getId(),
$this->content_obj->getId(),
$this->content_obj->getType()
);
$this->content_obj->getType(),
$this->lom_services->paths()->languages()
)->firstData($this->lom_services->paths()->languages())->value();

if (strlen($lang) !== 0) {
$json->lang = $lang . '_' . strtoupper($lang);
}
Expand Down
6 changes: 0 additions & 6 deletions components/ILIAS/Course/classes/class.ilObjCourseGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ public function viewObject(): void
return;
}

// Fill meta header tags
ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');

// Trac access
if ($this->ctrl->getNextClass() != "ilcolumngui") {
ilLearningProgress::_tracProgress(
Expand Down Expand Up @@ -203,9 +200,6 @@ public function infoScreen(): void
$this->checkPermission('visible');
}

// Fill meta header tags
ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');

$this->tabs_gui->setTabActive('info_short');
$files = ilCourseFile::_readFilesByCourse($this->object->getId());

Expand Down
Loading