19 declare(strict_types=1);
42 $tpl = $this->
getTemplate(
"tpl.card.html",
true,
true);
44 $title = $component->getTitle();
45 if ($title instanceof
Shy) {
46 $image_alt = $title->getLabel();
47 $title = $default_renderer->render($title);
52 if ($component->isHighlighted()) {
53 $tpl->touchBlock(
"highlight");
55 $tpl->touchBlock(
"no_highlight");
62 if (!empty($component->getTitleAction())) {
63 if (is_string($component->getTitleAction())) {
64 $tpl->setCurrentBlock(
"title_action_begin");
65 $tpl->setVariable(
"HREF", $component->getTitleAction());
66 $tpl->setVariable(
"ID",
$id);
67 $tpl->parseCurrentBlock();
68 } elseif ($title instanceof Shy) {
69 $title = $default_renderer->render($title);
71 if (is_array($component->getTitleAction())) {
72 $tpl->setCurrentBlock(
"title_action_begin");
73 $tpl->setVariable(
"ID",
$id);
74 $tpl->parseCurrentBlock();
78 $tpl->setVariable(
"TITLE", $title);
80 if ($component->getImage()) {
81 $tpl->setVariable(
"IMAGE", $default_renderer->render(
82 $component->getImage()->withAlt($this->
txt(
"open") .
" " . strip_tags($image_alt))
86 if (!empty($component->getTitleAction())) {
87 $tpl->touchBlock(
"title_action_end");
90 if (is_array($component->getSections())) {
91 foreach ($component->getSections() as $section) {
92 $tpl->setCurrentBlock(
"section");
93 $tpl->setVariable(
"SECTION", $default_renderer->render($section));
94 $tpl->parseCurrentBlock();
99 $tpl->setCurrentBlock(
"action");
101 $obj_icon = $component->getObjectIcon();
102 if ($obj_icon !==
null) {
103 $tpl->setVariable(
"OBJECT_ICON", $default_renderer->render($obj_icon));
106 $progress = $component->getProgress();
107 if ($progress !==
null) {
108 $tpl->setVariable(
"PROGRESS_STATUS", $default_renderer->render($progress));
111 $certificate = $component->getCertificateIcon();
112 if ($certificate !==
null) {
113 $certificate_icon =
new StandardIcon(
"cert",
"Certificate",
"medium",
false);
114 $tpl->setVariable(
"PROGRESS_STATUS", $default_renderer->render($certificate_icon));
117 $dropdown = $component->getActions();
118 if ($dropdown !==
null) {
119 $tpl->setVariable(
"DROPDOWN", $default_renderer->render($dropdown));
122 $tpl->parseCurrentBlock();
render(Component\Component $component, RendererInterface $default_renderer)
txt(string $id)
Get a text from the language file.
createId()
Get a fresh unique id.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.