19declare(strict_types=1);
45 public const HEADLINE =
'lso_choice_page_headline';
53 protected string $goto_command
62 return $this->lang->txt(self::HEADLINE);
72 public function build(array $successors): array
77 $this->ui_factory->deck(array_map(
80 ))->withSmallCardsSize()
91 return $this->ui_factory->card()->repositoryObject(
93 $this->getTileImage($item)
105 return $this->url_builder->getHref(
107 $this->obj_data_cache->lookupObjId($item->
getRefId())
118 if ($description !==
'') {
119 $sections[] = $this->ui_factory->listing()->property()
120 ->withProperty($this->lang->txt(
'description'), $description,
false);
122 $sections[] = $this->ui_factory->button()->standard($this->lang->txt(self::START_LABEL), $start_url);
129 $label = $this->lang->txt(
'obj_' . $item->
getType());
134 return $this->ui_factory->symbol()->icon()->standard($item->
getType(), $label,
Icon::MEDIUM);
142 $this->obj_data_cache->preloadReferenceCache(
154 if ($tile_image !==
null) {
155 return $tile_image->getImage($this->ui_factory->image())->withAlt($item->
getTitle());
159 if (!is_file($path)) {
163 return $this->ui_factory->image()->responsive($path, $item->
getTitle());
168 $obj_id = $this->obj_data_cache->lookupObjId($item->
getRefId());
171 return $object?->getObjectProperties()->getPropertyTileImage()->getTileImage();
Builds a Color from either hex- or rgb values.
Reusable "template" for the adaptive branch-selection page.
buildCard(\LSLearnerItem $item)
Builds the card for one selectable object.
preloadObjects(array $successors)
build(array $successors)
Builds the choice page content: a deck with one card per selectable successor.
getSections(\LSLearnerItem $item, string $start_url)
__construct(protected Factory $ui_factory, protected ilLanguage $lang, protected \ilObjectDataCache $obj_data_cache, protected \LSUrlBuilder $url_builder, protected string $goto_command)
getObjectIcon(\LSLearnerItem $item)
getStartUrl(\LSLearnerItem $item)
getHeadline()
The friendly statement shown above the cards; usable as page title.
getTileImage(\LSLearnerItem $item)
The object's tile image, or the default tile of the object type, as in the tiles of the repository.
getObjectTileImage(\LSLearnerItem $item)
Add learning progress and availability information to the LSItem.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
A component is the most general form of an entity in the UI.
This describes how an icon could be modified during construction of UI.
This is how the factory for UI elements looks.