Skip to content

Commit

Permalink
Merge pull request #3 from ILIAS-eLearning/release_8
Browse files Browse the repository at this point in the history
merge 8.9
  • Loading branch information
utesche authored Feb 20, 2024
2 parents 270c741 + a8d90b0 commit db2ec97
Show file tree
Hide file tree
Showing 2,009 changed files with 42,316 additions and 60,795 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/legacy-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
type: choice
options:
- trunk
- release_8
permissions:
contents: read
pull-requests: read
Expand All @@ -37,7 +36,7 @@ jobs:
args: --no-interaction --no-progress --ignore-platform-reqs --no-scripts

- name: 'PHStan Custom Rules'
run: CI/PHPStan/run_legacy_ui_report.sh
run: scripts/PHPStan/run_legacy_ui_report.sh

- name: 'Store Report'
uses: actions/upload-artifact@v3
Expand Down
8 changes: 5 additions & 3 deletions CI/PHPStan/constants.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php

/**
* This file is part of ILIAS, a powerful learning management system
Expand All @@ -16,15 +16,17 @@
*
*********************************************************************/

declare(strict_types=1);

/**
* This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants
*/

// User an role specific constants
const SYSTEM_USER_ID = 6;
const ANONYMOUS_USER_ID = 13;
const ANONYMOUS_ROLE_ID = 2;
const SYSTEM_ROLE_ID = 14;
const ANONYMOUS_ROLE_ID = 14;
const SYSTEM_ROLE_ID = 2;

// Folder specific constants
const ROOT_FOLDER_ID = 1;
Expand Down
3 changes: 1 addition & 2 deletions Modules/Blog/Posting/class.ilBlogPostingGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ilBlogPostingGUI extends ilPageObjectGUI
protected bool $enable_public_notes = false;
protected bool $may_contribute = false;
protected bool $fetchall = false;
protected bool $blpg = false;
protected int $blpg = 0;
protected string $term = "";
public bool $add_date = false;

Expand Down Expand Up @@ -212,7 +212,6 @@ public function preview(
$callback
));
}

// permanent link
if ($a_mode !== "embedded") {
$append = ($this->blpg > 0)
Expand Down
2 changes: 1 addition & 1 deletion Modules/Blog/classes/class.ilObjBlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public static function deliverRSS(string $a_wsp_id): void

$feed = new ilFeedWriter();

$url = ilLink::_getStaticLink($a_wsp_id, "blog", true, $is_wsp);
$url = ilLink::_getStaticLink($a_wsp_id, "blog", true, (string) $is_wsp);
$url = str_replace("&", "&amp;", $url);

// #11870
Expand Down
49 changes: 40 additions & 9 deletions Modules/Blog/classes/class.ilObjBlogGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
/**
* Class ilObjBlogGUI
* @author Jörg Lützenkirchen <[email protected]>
* @ilCtrl_Calls ilObjBlogGUI: ilBlogPostingGUI, ilWorkspaceAccessGUI, ilPortfolioPageGUI
* @ilCtrl_Calls ilObjBlogGUI: ilBlogPostingGUI, ilWorkspaceAccessGUI
* @ilCtrl_Calls ilObjBlogGUI: ilInfoScreenGUI, ilNoteGUI, ilCommonActionDispatcherGUI
* @ilCtrl_Calls ilObjBlogGUI: ilPermissionGUI, ilObjectCopyGUI, ilRepositorySearchGUI
* @ilCtrl_Calls ilObjBlogGUI: ilExportGUI, ilObjectContentStyleSettingsGUI, ilBlogExerciseGUI, ilObjNotificationSettingsGUI
*/
class ilObjBlogGUI extends ilObject2GUI implements ilDesktopItemHandling
{
protected string $rendered_content = "";
protected \ILIAS\Notes\Service $notes;
protected \ILIAS\Blog\ReadingTime\BlogSettingsGUI $reading_time_gui;
protected \ILIAS\Blog\ReadingTime\ReadingTimeManager $reading_time_manager;
Expand Down Expand Up @@ -489,6 +490,7 @@ protected function setTabs(): void
$ilHelp->setScreenIdComponent("blog");

if ($this->checkPermissionBool("read")) {
$this->ctrl->setParameterByClass(self::class, "bmn", null);
$this->tabs_gui->addTab(
"content",
$lng->txt("content"),
Expand Down Expand Up @@ -583,9 +585,9 @@ public function executeCommand(): void
$link = $ilCtrl->getLinkTargetByClass(["ilrepositorygui", "ilObjBlogGUI"], "preview");
$ilNavigationHistory->addItem($this->node_id, $link, "blog");
}

switch ($next_class) {
case 'ilblogpostinggui':
$this->ctrl->saveParameter($this, "user_page");
if (!$this->prtf_embed) {
$tpl->loadStandardTemplate();
}
Expand Down Expand Up @@ -691,7 +693,8 @@ public function executeCommand(): void
$this->addHeaderActionForCommand($cmd);
$this->filterInactivePostings();
$nav = $this->renderNavigation("gethtml", $cmd);
$this->buildEmbedded($ret, $nav);
// this is important for embedded blog pages!
$this->rendered_content = $this->buildEmbedded($ret, $nav);
return;

// ilias/editor
Expand All @@ -718,7 +721,9 @@ public function executeCommand(): void
if ($public_action) {
$this->tpl->setOnScreenMessage('success', implode("<br />", $info));
} else {
$this->tpl->setOnScreenMessage('info', implode("<br />", $info));
if (count($info) > 0) {
$this->tpl->setOnScreenMessage('info', implode("<br />", $info));
}
}

// revert to edit cmd to avoid confusion
Expand Down Expand Up @@ -805,7 +810,7 @@ public function executeCommand(): void
} else {
$settings_gui = $this->content_style_gui
->objectSettingsGUIForObjId(
0,
null,
$this->object->getId()
);
}
Expand Down Expand Up @@ -851,10 +856,15 @@ public function executeCommand(): void
if (!$cmd) {
$cmd = "render";
}
$this->$cmd();
$this->rendered_content = (string) $this->$cmd();
}
}

public function getRenderedContent(): string
{
return $this->rendered_content;
}

protected function triggerAssignmentTool(): void
{
$be = new ilBlogExercise($this->node_id);
Expand Down Expand Up @@ -1024,7 +1034,7 @@ public function render(): void
$list = $nav = "";
if ($list_items) {
$list = $this->renderList($list_items, "preview", "", $is_owner);
$nav = $this->renderNavigation("render", "preview", "", $is_owner);
$nav = $this->renderNavigation("render", "edit", "", $is_owner);
}

$this->setContentStyleSheet();
Expand Down Expand Up @@ -1793,6 +1803,22 @@ protected function renderNavigationByDate(
}
$wtpl->parseCurrentBlock();
}

if (!$a_link_template) {
$this->ctrl->setParameterByClass(self::class, "bmn", null);
$url = $this->ctrl->getLinkTargetByClass(self::class, $a_list_cmd);
} else {
$url = "index.html";
}
$wtpl->setVariable(
"STARTING_PAGE",
$this->ui->renderer()->render(
$this->ui->factory()->link()->standard(
$this->lng->txt("blog_starting_page"),
$url
)
)
);
}
// single month
else {
Expand Down Expand Up @@ -2057,9 +2083,9 @@ public function renderToolbarNavigation(


$ctrl->setParameterByClass("ilblogpostinggui", "blpg", $this->blpg);
if ($this->prtf_embed) {
/*if ($this->prtf_embed) {
$this->ctrl->setParameterByClass("ilobjportfoliogui", "ppage", $this->user_page);
}
}*/
$link = $ctrl->getLinkTargetByClass("ilblogpostinggui", "edit");
$toolbar->addComponent($f->button()->standard($lng->txt("blog_edit_posting"), $link));
}
Expand Down Expand Up @@ -2986,4 +3012,9 @@ public function printPostings(): void
$print_view = $this->getPrintView();
$print_view->sendPrintView();
}

protected function forwardExport(): void
{
$this->ctrl->redirectByClass(ilExportGUI::class);
}
}
7 changes: 7 additions & 0 deletions Modules/Blog/classes/class.ilObjBlogListGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ public function insertCommand(
): void {
$ctrl = $this->ctrl;

if ($cmd === "export"
&& ilObjBlogAccess::isCommentsExportPossible($this->obj_id)
&& (bool) $this->settings->get('item_cmd_asynch')) {
$href = $this->getCommandLink("forwardExport");
$cmd = "forwardExport";
$onclick = "";
}
if ($cmd !== "export" || !ilObjBlogAccess::isCommentsExportPossible($this->obj_id)) {
parent::insertCommand($href, $text, $frame, $img, $cmd, $onclick);
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<p>{STARTING_PAGE}</p>
<!-- BEGIN navigation_month_details -->
<div>
<!-- BEGIN navigation_year_details -->
Expand Down
14 changes: 14 additions & 0 deletions Modules/BookingManager/Objects/class.ilBookingObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,20 @@ public function delete(): int
return 0;
}

public function deleteReservationsAndCalEntries(int $object_id): void
{
$repo_fac = new ilBookingReservationDBRepositoryFactory();
$reservation_db = $repo_fac->getRepo();
$reservation_ids = $reservation_db->getReservationIdsByBookingObjectId($object_id);

foreach ($reservation_ids as $reservation_id) {
$reservation = new ilBookingReservation($reservation_id);
$entry = new ilCalendarEntry($reservation->getCalendarEntry());
$reservation_db->delete($reservation_id);
$entry->delete();
}
}

/**
* Get nr of available items for a set of object ids
* @param int[] $a_obj_ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ public function delete(): void
$lng = $this->lng;

$obj = new ilBookingObject($this->object_id);
$obj->deleteReservationsAndCalEntries($this->object_id);
$obj->delete();

$this->tpl->setOnScreenMessage('success', $lng->txt('book_object_deleted'), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ protected function read(): void
if ($this->id) {
$row = $this->repo->getForId($this->id);
$this->setUserId($row['user_id']);
$this->setAssignerId($row['assigner_id']);
$this->setAssignerId((int) $row['assigner_id']);
$this->setObjectId($row['object_id']);
$this->setFrom($row['date_from']);
$this->setTo($row['date_to']);
$this->setStatus($row['status']);
$this->setGroupId($row['group_id']);
$this->setContextObjId($row['context_obj_id']);
$this->setGroupId((int) $row['group_id']);
$this->setContextObjId((int) $row['context_obj_id']);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,20 @@ public function getCachedContextObjBookingInfo(
return ($row["context_obj_id"] == $context_obj_id);
});
}

public function getReservationIdsByBookingObjectId(int $booking_object_id): array
{
$set = $this->db->queryF(
"SELECT booking_reservation_id FROM booking_reservation " .
" WHERE object_id = %s ",
["integer"],
[$booking_object_id]
);
$ret = [];
while ($row = $this->db->fetchAssoc($set)) {
$ret[] = (int) $row['booking_reservation_id'];
}

return $ret;
}
}
4 changes: 2 additions & 2 deletions Modules/Category/classes/class.ilObjCategoryGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function executeCommand(): void
case "ilobjectcontentstylesettingsgui":
$this->checkPermission("write");
$this->setTitleAndDescription();
//$this->showContainerPageTabs();
$this->showContainerPageTabs();
$settings_gui = $this->content_style_gui
->objectSettingsGUIForRefId(
null,
Expand Down Expand Up @@ -1069,7 +1069,7 @@ public function assignRolesObject(): void
);
$f_result[$counter]['title'] = $role_obj->getTitle() ?: "";
$f_result[$counter]['desc'] = $role_obj->getDescription() ?: "";
$f_result[$counter]['type'] = $role['role_type'] === 'global' ?
$f_result[$counter]['type'] = ($role['role_type'] ?? '') === 'global' ?
$this->lng->txt('global') :
$this->lng->txt('local');

Expand Down
20 changes: 19 additions & 1 deletion Modules/Chatroom/classes/class.ilChatroomTabGUIFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class ilChatroomTabGUIFactory
private ilRbacSystem $rbacSystem;
private GlobalHttpState $http;
private Refinery $refinery;
private ?string $activated_tab = null;
private ?string $activated_sub_tab = null;

public function __construct(ilObjectGUI $gui)
{
Expand Down Expand Up @@ -132,7 +134,10 @@ public function getAdminTabsForCommand(string $command): void
];
$DIC->ctrl()->clearParametersByClass(ilPermissionGUI::class);

$is_in_permission_gui = strtolower($DIC->ctrl()->getCmdClass()) === strtolower(ilPermissionGUI::class);
$is_in_permission_gui = (
strtolower($DIC->ctrl()->getCmdClass()) === strtolower(ilPermissionGUI::class) ||
strtolower($DIC->ctrl()->getCmdClass()) === strtolower(ilObjectPermissionStatusGUI::class)
);

$commandParts = explode('_', $command, 2);
if ($command === 'ban_show') {
Expand Down Expand Up @@ -264,16 +269,29 @@ private function activateTab(array $commandParts, array $config): void
if (count($commandParts) > 1) {
if (isset($config[$commandParts[0]])) {
$DIC->tabs()->activateTab($commandParts[0]);
$this->activated_tab = $commandParts[0];

if (isset($config[$commandParts[0]]['subtabs'][$commandParts[1]])) {
$DIC->tabs()->activateSubTab($commandParts[1]);
$this->activated_sub_tab = $commandParts[1];
}
}
} elseif (count($commandParts) === 1) {
$DIC->tabs()->activateTab($commandParts[0]);
$this->activated_tab = $commandParts[0];
}
}

public function getActivatedTab(): ?string
{
return $this->activated_tab;
}

public function getActivatedSubTab(): ?string
{
return $this->activated_sub_tab;
}

/**
* Builds $config and $commandparts arrays to assign them as parameters
* when calling $this->buildTabs and $this->activateTab.
Expand Down
6 changes: 0 additions & 6 deletions Modules/Chatroom/classes/class.ilObjChatroom.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ public function update(): bool
$activation->setTimingStart($this->getAccessBegin());
$activation->setTimingEnd($this->getAccessEnd());
$activation->toggleVisible((bool) $this->getAccessVisibility());
$activation->setSuggestionStart(0);
$activation->setSuggestionStartRelative(0);
$activation->setSuggestionEnd(0);
$activation->setSuggestionEndRelative(0);
$activation->setEarliestStart(0);
$activation->setEarliestStartRelative(0);
$activation->toggleChangeable(true);
$activation->update($this->ref_id);
}
Expand Down
5 changes: 5 additions & 0 deletions Modules/Chatroom/classes/class.ilObjChatroomAdminGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public function executeCommand(): void

$this->dispatchCall($res[0], $res[1]);
}

if ($tabFactory->getActivatedTab() !== null &&
$this->tabs_gui->getActiveTab() !== $tabFactory->getActivatedTab()) {
$this->tabs_gui->activateTab($tabFactory->getActivatedTab());
}
}

public function getConnector(): ilChatroomServerConnector
Expand Down
Loading

0 comments on commit db2ec97

Please sign in to comment.