diff --git a/Modules/Glossary/Definition/class.ilGlossaryDefPage.php b/Modules/Glossary/Definition/class.ilGlossaryDefPage.php index 7856a869b302..e795ee71b7a9 100755 --- a/Modules/Glossary/Definition/class.ilGlossaryDefPage.php +++ b/Modules/Glossary/Definition/class.ilGlossaryDefPage.php @@ -31,13 +31,4 @@ public function beforePageContentUpdate(ilPageContent $a_page_content) : void $a_page_content->autoLinkGlossaries($glos); } } - - /** - * Get object id of repository object that contains this page, - * return 0 if page does not belong to a repo object - */ - public function getRepoObjId() : ?int - { - return $this->getParentId(); - } } diff --git a/Modules/Glossary/Export/class.ilGlossaryDataSet.php b/Modules/Glossary/Export/class.ilGlossaryDataSet.php index 6fa8d7d95cbb..c6c4826949fb 100644 --- a/Modules/Glossary/Export/class.ilGlossaryDataSet.php +++ b/Modules/Glossary/Export/class.ilGlossaryDataSet.php @@ -43,8 +43,8 @@ public function getSupportedVersions() : array { return array("5.1.0", "5.4.0"); } - - public function getXmlNamespace(string $a_entity, string $a_schema_version) : string + + protected function getXmlNamespace(string $a_entity, string $a_schema_version) : string { return "https://www.ilias.de/xml/Modules/Glossary/" . $a_entity; } diff --git a/Modules/Glossary/Export/class.ilGlossaryExporter.php b/Modules/Glossary/Export/class.ilGlossaryExporter.php index 1d4e30ae12ad..33bb38181f8d 100644 --- a/Modules/Glossary/Export/class.ilGlossaryExporter.php +++ b/Modules/Glossary/Export/class.ilGlossaryExporter.php @@ -89,7 +89,7 @@ public function getXmlExportTailDependencies( $tax_ids[$t_ids[0]] = $t_ids[0]; } } - if (sizeof($tax_ids)) { + if (count($tax_ids)) { $deps[] = array( "component" => "Services/Taxonomy", "entity" => "tax", @@ -101,13 +101,13 @@ public function getXmlExportTailDependencies( $advmd_ids = array(); foreach ($a_ids as $id) { $rec_ids = $this->getActiveAdvMDRecords($id); - if (sizeof($rec_ids)) { + if (count($rec_ids)) { foreach ($rec_ids as $rec_id) { $advmd_ids[] = $id . ":" . $rec_id; } } } - if (sizeof($advmd_ids)) { + if (count($advmd_ids)) { $deps[] = array( "component" => "Services/AdvancedMetaData", "entity" => "advmd", diff --git a/Modules/Glossary/Presentation/class.ilGlossaryPresentationGUI.php b/Modules/Glossary/Presentation/class.ilGlossaryPresentationGUI.php index 03476a4cca97..c2dabc094b14 100755 --- a/Modules/Glossary/Presentation/class.ilGlossaryPresentationGUI.php +++ b/Modules/Glossary/Presentation/class.ilGlossaryPresentationGUI.php @@ -452,7 +452,7 @@ public function listDefinitions( // toc if (count($defs) > 1 && $a_page_mode == ilPageObjectGUI::PRESENTATION) { $def_tpl->setCurrentBlock("toc"); - for ($j = 1; $j <= count($defs); $j++) { + for ($j = 1, $jMax = count($defs); $j <= $jMax; $j++) { $def_tpl->setCurrentBlock("toc_item"); $def_tpl->setVariable("TOC_DEF_NR", $j); $def_tpl->setVariable("TOC_DEF", $lng->txt("cont_definition")); @@ -462,7 +462,7 @@ public function listDefinitions( $def_tpl->parseCurrentBlock(); } - for ($j = 0; $j < count($defs); $j++) { + for ($j = 0, $jMax = count($defs); $j < $jMax; $j++) { $def = $defs[$j]; $page_gui = new ilGlossaryDefPageGUI($def["id"]); $this->basicPageGuiInit($page_gui); @@ -511,27 +511,25 @@ public function listDefinitions( foreach ($sources as $src) { $type = explode(':', $src['type']); - if ($type[0] == 'lm') { - if ($type[1] == 'pg') { - $title = ilLMPageObject::_getPresentationTitle($src['id']); - $lm_id = ilLMObject::_lookupContObjID($src['id']); - $lm_title = ilObject::_lookupTitle($lm_id); - $def_tpl->setCurrentBlock('backlink_item'); - $ref_ids = ilObject::_getAllReferences($lm_id); - $access = false; - foreach ($ref_ids as $rid) { - if ($ilAccess->checkAccess("read", "", $rid)) { - $access = true; - } - } - if ($access) { - $def_tpl->setCurrentBlock("backlink_item"); - $def_tpl->setVariable("BACKLINK_LINK", ILIAS_HTTP_PATH . "/goto.php?target=" . $type[1] . "_" . $src['id']); - $def_tpl->setVariable("BACKLINK_ITEM", $lm_title . ": " . $title); - $def_tpl->parseCurrentBlock(); - $backlist_shown = true; + if ($type[0] == 'lm' && $type[1] == 'pg') { + $title = ilLMPageObject::_getPresentationTitle($src['id']); + $lm_id = ilLMObject::_lookupContObjID($src['id']); + $lm_title = ilObject::_lookupTitle($lm_id); + $def_tpl->setCurrentBlock('backlink_item'); + $ref_ids = ilObject::_getAllReferences($lm_id); + $access = false; + foreach ($ref_ids as $rid) { + if ($ilAccess->checkAccess("read", "", $rid)) { + $access = true; } } + if ($access) { + $def_tpl->setCurrentBlock("backlink_item"); + $def_tpl->setVariable("BACKLINK_LINK", ILIAS_HTTP_PATH . "/goto.php?target=" . $type[1] . "_" . $src['id']); + $def_tpl->setVariable("BACKLINK_ITEM", $lm_title . ": " . $title); + $def_tpl->parseCurrentBlock(); + $backlist_shown = true; + } } } if ($backlist_shown) { diff --git a/Modules/Glossary/Presentation/class.ilPresentationListTableGUI.php b/Modules/Glossary/Presentation/class.ilPresentationListTableGUI.php index 42de904475a0..0bbf6fd506e1 100644 --- a/Modules/Glossary/Presentation/class.ilPresentationListTableGUI.php +++ b/Modules/Glossary/Presentation/class.ilPresentationListTableGUI.php @@ -161,7 +161,7 @@ public function initFilter() : void public function numericOrdering(string $a_field) : bool { - if (substr($a_field, 0, 3) == "md_") { + if (strpos($a_field, "md_") === 0) { $md_id = (int) substr($a_field, 3); if ($this->adv_fields[$md_id]["type"] == ilAdvancedMDFieldDefinition::TYPE_DATE) { return true; @@ -187,14 +187,11 @@ protected function fillRow(array $a_set) : void ); $this->tpl->parseCurrentBlock(); } else { - if (sizeof($defs)) { - for ($j = 0; $j < count($defs); $j++) { + if (count($defs)) { + for ($j = 0, $jMax = count($defs); $j < $jMax; $j++) { $def = $defs[$j]; if (count($defs) > 1) { if (!$this->offline) { - if (!empty($filter)) { - $this->ctrl->setParameter($this->parent_obj, "term", $filter); - } $this->ctrl->setParameter($this->parent_obj, "term_id", $a_set["id"]); $def_href = $this->ctrl->getLinkTarget($this->parent_obj, "listDefinitions"); $this->ctrl->clearParameters($this->parent_obj); @@ -221,8 +218,7 @@ protected function fillRow(array $a_set) : void } if (!$this->page_config->getPreventHTMLUnmasking()) { - $short_str = str_replace("<", "<", $short_str); - $short_str = str_replace(">", ">", $short_str); + $short_str = str_replace(["<", ">"], ["<", ">"], $short_str); } // replace tex @@ -244,9 +240,7 @@ protected function fillRow(array $a_set) : void $short_str = ilMathJax::getInstance()->insertLatexImages( $short_str, '[tex]', - '[/tex]', - $this->parent_obj->getOfflineDirectory() . '/teximg', - './teximg' + '[/tex]' ); } @@ -278,9 +272,6 @@ protected function fillRow(array $a_set) : void if ($c["id"] == 0) { $this->tpl->setCurrentBlock("link_start"); if (!$this->offline) { - if (!empty($filter)) { - $this->ctrl->setParameter($this->parent_obj, "term", $filter); - } $this->ctrl->setParameter($this->parent_obj, "term_id", $a_set["id"]); $this->tpl->setVariable( "LINK_VIEW_TERM", diff --git a/Modules/Glossary/Term/class.ilGlossaryTerm.php b/Modules/Glossary/Term/class.ilGlossaryTerm.php index a962346e3633..cade44622e6b 100755 --- a/Modules/Glossary/Term/class.ilGlossaryTerm.php +++ b/Modules/Glossary/Term/class.ilGlossaryTerm.php @@ -79,7 +79,7 @@ public static function _getIdForImportId( " ORDER BY create_date DESC"; $term_set = $ilDB->query($q); while ($term_rec = $ilDB->fetchAssoc($term_set)) { - $glo_id = ilGlossaryTerm::_lookGlossaryID($term_rec["id"]); + $glo_id = self::_lookGlossaryID($term_rec["id"]); $ref_ids = ilObject::_getAllReferences($glo_id); // will be 0 if import of lm is in progress (new import) if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($glo_id)) { @@ -294,7 +294,7 @@ public static function getTermList( global $DIC; if (count($a_glo_ref_id) > 1) { - $a_glo_id = array_map(function ($id) { + $a_glo_id = array_map(static function ($id) : int { return ilObject::_lookupObjectId($id); }, $a_glo_ref_id); } else { @@ -449,7 +449,7 @@ public function exportXML( public static function getNumberOfUsages(int $a_term_id) : int { - return count(ilGlossaryTerm::getUsages($a_term_id)); + return count(self::getUsages($a_term_id)); } public static function getUsages(int $a_term_id) : array diff --git a/Modules/Glossary/Term/class.ilGlossaryTermGUI.php b/Modules/Glossary/Term/class.ilGlossaryTermGUI.php index 6915589b4238..085e9faa1d3e 100755 --- a/Modules/Glossary/Term/class.ilGlossaryTermGUI.php +++ b/Modules/Glossary/Term/class.ilGlossaryTermGUI.php @@ -294,7 +294,7 @@ public function output( $tpl->setVariable("TXT_TERM", $this->term->getTerm()); - for ($j = 0; $j < count($defs); $j++) { + for ($j = 0, $jMax = count($defs); $j < $jMax; $j++) { $def = $defs[$j]; $page_gui = new ilGlossaryDefPageGUI($def["id"]); $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&ref_id=" . $this->ref_id); @@ -338,7 +338,7 @@ public function getInternalLinks() : array $defs = ilGlossaryDefinition::getDefinitionList($this->term->getId()); $term_links = array(); - for ($j = 0; $j < count($defs); $j++) { + for ($j = 0, $jMax = count($defs); $j < $jMax; $j++) { $def = $defs[$j]; $page = new ilGlossaryDefPage($def["id"]); $page->buildDom(); @@ -394,7 +394,7 @@ public function listDefinitions() : void $tpl->setVariable("TXT_TERM", $this->term->getTerm()); - for ($j = 0; $j < count($defs); $j++) { + for ($j = 0, $jMax = count($defs); $j < $jMax; $j++) { $def = $defs[$j]; $page_gui = new ilGlossaryDefPageGUI($def["id"]); $page_gui->setStyleId( diff --git a/Modules/Glossary/Term/class.ilTermListTableGUI.php b/Modules/Glossary/Term/class.ilTermListTableGUI.php index f6139b38fbf0..411c3d322e80 100644 --- a/Modules/Glossary/Term/class.ilTermListTableGUI.php +++ b/Modules/Glossary/Term/class.ilTermListTableGUI.php @@ -78,10 +78,8 @@ public function __construct( foreach ($this->adv_cols_order as $c) { if ($c["id"] == 0) { $this->addColumn($this->lng->txt("cont_term"), "term"); - } else { - if (in_array("md_" . $c["id"], $this->selected_cols)) { - $this->addColumn($c["text"], "md_" . $c["id"]); - } + } elseif (in_array("md_" . $c["id"], $this->selected_cols)) { + $this->addColumn($c["text"], "md_" . $c["id"]); } } @@ -143,7 +141,7 @@ public function getSelectableColumns() : array public function numericOrdering(string $a_field) : bool { - if (substr($a_field, 0, 3) == "md_") { + if (strpos($a_field, "md_") === 0) { $md_id = (int) substr($a_field, 3); if ($this->adv_fields[$md_id]["type"] == ilAdvancedMDFieldDefinition::TYPE_DATE) { return true; @@ -209,7 +207,7 @@ protected function fillRow(array $a_set) : void } - for ($j = 0; $j < count($defs); $j++) { + for ($j = 0, $jMax = count($defs); $j < $jMax; $j++) { $def = $defs[$j]; @@ -295,22 +293,20 @@ protected function fillRow(array $a_set) : void $this->tpl->setCurrentBlock("td"); $this->tpl->setVariable("TD_VAL", $a_set["term"]); $this->tpl->parseCurrentBlock(); - } else { - if (in_array("md_" . $c["id"], $this->selected_cols)) { - $id = (int) $c["id"]; - - $val = " "; - if (isset($a_set["md_" . $id . "_presentation"])) { - $pb = $a_set["md_" . $id . "_presentation"]->getHTML(); - if ($pb) { - $val = $pb; - } + } elseif (in_array("md_" . $c["id"], $this->selected_cols)) { + $id = (int) $c["id"]; + + $val = " "; + if (isset($a_set["md_" . $id . "_presentation"])) { + $pb = $a_set["md_" . $id . "_presentation"]->getHTML(); + if ($pb) { + $val = $pb; } - - $this->tpl->setCurrentBlock("td"); - $this->tpl->setVariable("TD_VAL", $val); - $this->tpl->parseCurrentBlock(); } + + $this->tpl->setCurrentBlock("td"); + $this->tpl->setVariable("TD_VAL", $val); + $this->tpl->parseCurrentBlock(); } } } diff --git a/Modules/Glossary/Term/class.ilTermQuickListTableGUI.php b/Modules/Glossary/Term/class.ilTermQuickListTableGUI.php index fb2f52eef3c5..3e8615136b0c 100644 --- a/Modules/Glossary/Term/class.ilTermQuickListTableGUI.php +++ b/Modules/Glossary/Term/class.ilTermQuickListTableGUI.php @@ -62,7 +62,7 @@ protected function fillRow(array $a_set) : void $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $a_set["id"]); $sep = ": "; - for ($j = 0; $j < count($defs); $j++) { + for ($j = 0, $jMax = count($defs); $j < $jMax; $j++) { $def = $defs[$j]; $this->tpl->setCurrentBlock("definition"); diff --git a/Modules/Glossary/Term/class.ilTermUsagesTableGUI.php b/Modules/Glossary/Term/class.ilTermUsagesTableGUI.php index cb21292f04b1..5091a6001c38 100644 --- a/Modules/Glossary/Term/class.ilTermUsagesTableGUI.php +++ b/Modules/Glossary/Term/class.ilTermUsagesTableGUI.php @@ -81,12 +81,12 @@ protected function fillRow(array $a_set) : void //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]); switch ($cont_type) { case "sahs": - $page_obj = new ilSCORM2004Page($usage["id"]); + $page_obj = new ilSCORM2004Page($usage["id"]); // This class does not exist (anymore?) $lm_obj = new ilObjSAHSLearningModule($page_obj->getParentId(), false); $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type); $item["obj_title"] = $lm_obj->getTitle(); $item["sub_txt"] = $this->lng->txt("pg"); - $item["sub_title"] = ilSCORM2004PageNode::_lookupTitle($page_obj->getId()); + $item["sub_title"] = ilSCORM2004PageNode::_lookupTitle($page_obj->getId()); // This class does not exist (anymore?) $ref_id = $this->getFirstWritableRefId($lm_obj->getId()); if ($ref_id > 0) { $item["obj_link"] = ilLink::_getStaticLink($ref_id, "sahs"); diff --git a/Modules/Glossary/classes/class.ilECSGlossarySettings.php b/Modules/Glossary/classes/class.ilECSGlossarySettings.php index f22624143088..23d5f235078b 100644 --- a/Modules/Glossary/classes/class.ilECSGlossarySettings.php +++ b/Modules/Glossary/classes/class.ilECSGlossarySettings.php @@ -20,12 +20,12 @@ */ class ilECSGlossarySettings extends ilECSObjectSettings { - protected function getECSObjectType() + protected function getECSObjectType() : string { return '/campusconnect/glossaries'; } - protected function buildJson(ilECSSetting $a_server) + protected function buildJson(ilECSSetting $a_server) : stdClass { $json = $this->getJsonCore('application/ecs-glossary'); diff --git a/Modules/Glossary/classes/class.ilObjGlossary.php b/Modules/Glossary/classes/class.ilObjGlossary.php index 431920bf8fab..a0145ddcff08 100755 --- a/Modules/Glossary/classes/class.ilObjGlossary.php +++ b/Modules/Glossary/classes/class.ilObjGlossary.php @@ -51,7 +51,7 @@ public function __construct( $this->content_style_service = $DIC ->contentStyle() ->domain() - ->styleForRefId((int) $this->getRefId()); + ->styleForRefId($this->getRefId()); } public function create($a_upload = false) : int @@ -212,7 +212,7 @@ protected static function lookup( public static function lookupSnippetLength(int $a_id) : int { - return (int) ilObjGlossary::lookup($a_id, "snippet_length"); + return (int) self::lookup($a_id, "snippet_length"); } @@ -431,7 +431,7 @@ public function getAllGlossaryIds( break; } if (!$a_include_offline_childs) { - $glo_ids = ilObjGlossary::removeOfflineGlossaries($glo_ids, $ids_are_ref_ids); + $glo_ids = $this->removeOfflineGlossaries($glo_ids, $ids_are_ref_ids); } // always show entries of current glossary (if no permission is given, user will not come to the presentation screen) // see bug #14477 @@ -439,17 +439,13 @@ public function getAllGlossaryIds( if (!in_array($this->getRefId(), $glo_ids)) { $glo_ids[] = $this->getRefId(); } - } else { - if (!in_array($this->getId(), $glo_ids)) { - $glo_ids[] = $this->getId(); - } + } elseif (!in_array($this->getId(), $glo_ids)) { + $glo_ids[] = $this->getId(); } + } elseif ($ids_are_ref_ids) { + $glo_ids = [$this->getRefId()]; } else { - if ($ids_are_ref_ids) { - $glo_ids = [$this->getRefId()]; - } else { - $glo_ids = [$this->getId()]; - } + $glo_ids = [$this->getId()]; } return $glo_ids; @@ -694,14 +690,14 @@ public function getXMLZip() : string return $glo_exp->buildExportFile(); } - public static function getDeletionDependencies(int $a_obj_id) : array + public static function getDeletionDependencies(int $obj_id) : array { global $DIC; $lng = $DIC->language(); $dep = array(); - $sms = ilObjSAHSLearningModule::getScormModulesForGlossary($a_obj_id); + $sms = ilObjSAHSLearningModule::getScormModulesForGlossary($obj_id); foreach ($sms as $sm) { $lng->loadLanguageModule("content"); $dep[$sm] = $lng->txt("glo_used_in_scorm"); @@ -720,9 +716,9 @@ public function getTaxonomyId() : int } - public function cloneObject(int $a_target_id, int $a_copy_id = 0, bool $a_omit_tree = false) : ?ilObject + public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false) : ?ilObject { - $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree); + $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree); $this->cloneMetaData($new_obj); $tax_ass = null; @@ -730,7 +726,7 @@ public function cloneObject(int $a_target_id, int $a_copy_id = 0, bool $a_omit_t $map = []; //copy online status if object is not the root copy object - $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id); + $cp_options = ilCopyWizardOptions::_getInstance($copy_id); if (!$cp_options->isRootNode($this->getRefId())) { $new_obj->setOnline($this->getOnline()); @@ -796,7 +792,7 @@ public function removeOfflineGlossaries( ) : array { $glo_ids = $a_glo_ids; if ($ids_are_ref_ids) { - $glo_ids = array_map(function ($id) { + $glo_ids = array_map(static function ($id) : int { return ilObject::_lookupObjectId($id); }, $a_glo_ids); } @@ -815,7 +811,7 @@ public function removeOfflineGlossaries( return $online_glo_ids; } - $online_ref_ids = array_filter($a_glo_ids, function ($ref_id) use ($online_glo_ids) { + $online_ref_ids = array_filter($a_glo_ids, static function ($ref_id) use ($online_glo_ids) : bool { return in_array(ilObject::_lookupObjectId($ref_id), $online_glo_ids); }); @@ -823,7 +819,7 @@ public function removeOfflineGlossaries( return $online_ref_ids; } - public static function getAdvMDSubItemTitle($a_obj_id, $a_sub_type, $a_sub_id) + public static function getAdvMDSubItemTitle($a_obj_id, $a_sub_type, $a_sub_id) : string { global $DIC; @@ -852,7 +848,7 @@ public function autoLinkGlossaryTerms( foreach ($source_terms as $source_term) { $source_defs = ilGlossaryDefinition::getDefinitionList($source_term["id"]); - for ($j = 0; $j < count($source_defs); $j++) { + for ($j = 0, $jMax = count($source_defs); $j < $jMax; $j++) { $def = $source_defs[$j]; $pg = new ilGlossaryDefPage($def["id"]); diff --git a/Modules/Glossary/classes/class.ilObjGlossaryAccess.php b/Modules/Glossary/classes/class.ilObjGlossaryAccess.php index c4dd4f7179fe..2324db1356c8 100644 --- a/Modules/Glossary/classes/class.ilObjGlossaryAccess.php +++ b/Modules/Glossary/classes/class.ilObjGlossaryAccess.php @@ -48,7 +48,7 @@ public function _checkAccess(string $cmd, string $permission, int $ref_id, int $ switch ($permission) { case "read": - if (!ilObjGlossaryAccess::_lookupOnline($obj_id) + if (!self::_lookupOnline($obj_id) && !$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)) { $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline")); return false; @@ -56,7 +56,7 @@ public function _checkAccess(string $cmd, string $permission, int $ref_id, int $ break; case "visible": - if (!ilObjGlossaryAccess::_lookupOnline($obj_id) && + if (!self::_lookupOnline($obj_id) && (!$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id))) { $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline")); return false; diff --git a/Modules/Glossary/classes/class.ilObjGlossaryGUI.php b/Modules/Glossary/classes/class.ilObjGlossaryGUI.php index 7e6697256ef5..2b5e86a15208 100755 --- a/Modules/Glossary/classes/class.ilObjGlossaryGUI.php +++ b/Modules/Glossary/classes/class.ilObjGlossaryGUI.php @@ -55,7 +55,7 @@ public function __construct( $this->tabs = $DIC->tabs(); $this->setting = $DIC["ilSetting"]; $this->access = $DIC->access(); - $this->rbacsystem = $DIC->rbac()->system(); + $this->rbacsystem = $DIC->rbac()->system(); // This property is dynamically declared: Should be fixed or discussed $this->help = $DIC["ilHelp"]; $this->edit_request = $DIC->glossary() @@ -110,7 +110,7 @@ public function __construct( $cs = $DIC->contentStyle(); $this->content_style_gui = $cs->gui(); if (is_object($this->object)) { - $this->content_style_domain = $cs->domain()->styleForRefId((int) $this->object->getRefId()); + $this->content_style_domain = $cs->domain()->styleForRefId($this->object->getRefId()); } } @@ -272,10 +272,8 @@ public function executeCommand() : void } if ($cmd != "quickList") { - if (!$this->in_administration) { - if (!$this->getCreationMode()) { - $this->tpl->printToStdout(); - } + if (!$this->in_administration && !$this->getCreationMode()) { + $this->tpl->printToStdout(); } } else { $this->tpl->printToStdout(false); @@ -398,7 +396,7 @@ public function showInfoScreen() : void } $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType()); - ilObjGlossaryGUI::addUsagesToInfo($info, $this->object->getId()); + self::addUsagesToInfo($info, $this->object->getId()); $this->ctrl->forwardCommand($info); } @@ -421,10 +419,8 @@ public static function addUsagesToInfo( $link = false; $refs = ilObject::_getAllReferences($sm); foreach ($refs as $ref) { - if ($link === false) { - if ($ilAccess->checkAccess("write", "", $ref)) { - $link = ilLink::_getLink($ref, 'sahs'); - } + if ($link === false && $ilAccess->checkAccess("write", "", $ref)) { + $link = ilLink::_getLink($ref, 'sahs'); } } @@ -973,15 +969,13 @@ protected function setLocator() : void { if (strtolower($this->edit_request->getBaseClass()) != "ilglossaryeditorgui") { parent::setLocator(); - } else { - if (is_object($this->object)) { - $gloss_loc = new ilGlossaryLocatorGUI(); - if (is_object($this->term)) { - $gloss_loc->setTerm($this->term); - } - $gloss_loc->setGlossary($this->getGlossary()); - $gloss_loc->display(); + } elseif (is_object($this->object)) { + $gloss_loc = new ilGlossaryLocatorGUI(); + if (is_object($this->term)) { + $gloss_loc->setTerm($this->term); } + $gloss_loc->setGlossary($this->getGlossary()); + $gloss_loc->display(); } } @@ -1032,11 +1026,6 @@ public function getTemplate() : void } } - protected function setTabs() : void - { - $this->getTabs(); - } - protected function getTabs() : void { $this->help->setScreenIdComponent("glo"); @@ -1398,7 +1387,7 @@ public function copyTerms() : void $this->user->clipboardDeleteObjectsOfType("term"); // put them into the clipboard - $time = date("Y-m-d H:i:s", time()); + $time = date("Y-m-d H:i:s"); $order = 0; foreach ($items as $id) { $this->user->addObjectToClipboard( @@ -1430,7 +1419,7 @@ public function referenceTerms() : void $this->user->clipboardDeleteObjectsOfType("term"); // put them into the clipboard - $time = date("Y-m-d H:i:s", time()); + $time = date("Y-m-d H:i:s"); $order = 0; foreach ($items as $id) { $this->user->addObjectToClipboard( diff --git a/Modules/Glossary/classes/class.ilObjGlossarySubItemListGUI.php b/Modules/Glossary/classes/class.ilObjGlossarySubItemListGUI.php index de1daefa81be..9a738dcc4f3e 100644 --- a/Modules/Glossary/classes/class.ilObjGlossarySubItemListGUI.php +++ b/Modules/Glossary/classes/class.ilObjGlossarySubItemListGUI.php @@ -37,7 +37,7 @@ public function getHTML() : string $lng->loadLanguageModule('content'); foreach ($this->getSubItemIds(true) as $sub_item) { - if (is_object($this->getHighlighter()) and strlen($this->getHighlighter()->getContent($this->getObjId(), $sub_item))) { + if (is_object($this->getHighlighter()) && $this->getHighlighter()->getContent($this->getObjId(), $sub_item) !== '') { $this->tpl->setCurrentBlock('sea_fragment'); $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item)); $this->tpl->parseCurrentBlock(); diff --git a/Modules/Glossary/test/GloPresentationGUIRequestTest.php b/Modules/Glossary/test/GloPresentationGUIRequestTest.php index 3024362e3d4a..bc683a2edfee 100644 --- a/Modules/Glossary/test/GloPresentationGUIRequestTest.php +++ b/Modules/Glossary/test/GloPresentationGUIRequestTest.php @@ -9,17 +9,6 @@ */ class GloPresentationGUIRequestTest extends TestCase { - //protected $backupGlobals = false; - - protected function setUp() : void - { - parent::setUp(); - } - - protected function tearDown() : void - { - } - protected function getRequest(array $get, array $post) : \ILIAS\Glossary\Presentation\PresentationGUIRequest { $http_mock = $this->createMock(ILIAS\HTTP\Services::class); @@ -34,7 +23,7 @@ protected function getRequest(array $get, array $post) : \ILIAS\Glossary\Present ); } - public function testRefId() + public function testRefId() : void { $request = $this->getRequest( [ @@ -49,7 +38,7 @@ public function testRefId() ); } - public function testDefinitionId() + public function testDefinitionId() : void { $request = $this->getRequest( [ @@ -64,7 +53,7 @@ public function testDefinitionId() ); } - public function testLetter() + public function testLetter() : void { $request = $this->getRequest( [ @@ -79,7 +68,7 @@ public function testLetter() ); } - public function testTermId() + public function testTermId() : void { $request = $this->getRequest( [ @@ -94,7 +83,7 @@ public function testTermId() ); } - public function test() + public function test() : void { $request = $this->getRequest( [ diff --git a/Modules/Glossary/test/ilModulesGlossarySuite.php b/Modules/Glossary/test/ilModulesGlossarySuite.php index 4d11045fff95..2d949c073e2e 100644 --- a/Modules/Glossary/test/ilModulesGlossarySuite.php +++ b/Modules/Glossary/test/ilModulesGlossarySuite.php @@ -22,7 +22,7 @@ */ class ilModulesGlossarySuite extends TestSuite { - public static function suite() + public static function suite() : self { $suite = new self();