Skip to content

Commit 753ae4b

Browse files
committed
Object: Improve Presentation of Creation Form
See: https://mantis.ilias.de/view.php?id=43244
1 parent cc87025 commit 753ae4b

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

components/ILIAS/ILIASObject/classes/class.ilObject.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,19 +1846,17 @@ public static function getIconForReference(
18461846
bool $offline = false
18471847
): string {
18481848
global $DIC;
1849-
18501849
$ilSetting = $DIC->settings();
1851-
$objDefinition = $DIC["objDefinition"];
18521850

18531851
if ($obj_id == "" && $type == "") {
18541852
return "";
18551853
}
18561854

1857-
if ($type == "") {
1855+
if ($type === "") {
18581856
$type = ilObject::_lookupType($obj_id);
18591857
}
18601858

1861-
if ($size == "") {
1859+
if ($size === "") {
18621860
$size = "big";
18631861
}
18641862

@@ -1884,21 +1882,27 @@ public static function getIconForReference(
18841882
}
18851883

18861884
if (!$offline) {
1887-
if ($objDefinition->isPluginTypeName($type)) {
1888-
if ($objDefinition->getClassName($type) != "") {
1889-
$class_name = "il" . $objDefinition->getClassName($type) . 'Plugin';
1890-
$location = $objDefinition->getLocation($type);
1891-
if (is_file($location . "/class." . $class_name . ".php")) {
1892-
return call_user_func([$class_name, "_getIcon"], $type, $size, $obj_id);
1893-
}
1894-
}
1895-
return ilUtil::getImagePath("standard/icon_cmps.svg");
1896-
}
1885+
return self::getIconForType($type);
1886+
}
1887+
return "./images/standard/icon_{$type}.svg";
1888+
}
18971889

1898-
return ilUtil::getImagePath("standard/icon_" . $type . ".svg");
1899-
} else {
1900-
return "./images/standard/icon_" . $type . ".svg";
1890+
public static function getIconForType(string $type): string
1891+
{
1892+
global $DIC;
1893+
$objDefinition = $DIC['objDefinition'];
1894+
if (!$objDefinition->isPluginTypeName($type)) {
1895+
return ilUtil::getImagePath("standard/icon_{$type}.svg");
1896+
}
1897+
1898+
if ($objDefinition->getClassName($type) !== '') {
1899+
$class_name = "il{$objDefinition->getClassName($type)}Plugin";
1900+
$location = $objDefinition->getLocation($type);
1901+
if (is_file($location . "/class.{$class_name}.php")) {
1902+
return call_user_func([$class_name, '_getIcon'], $type);
1903+
}
19011904
}
1905+
return ilUtil::getImagePath('standard/icon_cmps.svg');
19021906
}
19031907

19041908
/**

components/ILIAS/ILIASObject/classes/class.ilObjectGUI.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,10 @@ public function createObject(): void
648648
$this->lng->loadLanguageModule($new_type);
649649
$this->ctrl->setParameter($this, 'new_type', $new_type);
650650

651+
$this->tpl->setTitleIcon(ilObject::getIconForType($this->requested_new_type));
652+
$this->tpl->setTitle($this->lng->txt('obj_' . $this->requested_new_type));
651653
$create_form = $this->initCreateForm($new_type);
654+
$this->tabs_gui->setBackTarget($this->lng->txt('cancel'), $this->ctrl->getLinkTargetByClass(static::class, 'cancel'));
652655
$this->tpl->setContent($this->getCreationFormsHTML($create_form));
653656
}
654657

0 commit comments

Comments
 (0)