Skip to content

Commit

Permalink
Merge remote-tracking branch 'ilias/release_8' into 8_veda
Browse files Browse the repository at this point in the history
  • Loading branch information
Foreman committed Dec 13, 2024
2 parents 5cfcfb5 + 24e1b5d commit 1aee0f9
Show file tree
Hide file tree
Showing 713 changed files with 60,348 additions and 46,355 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/legacy-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
type: choice
options:
- trunk
- release_9
permissions:
contents: read
pull-requests: read
Expand All @@ -29,11 +30,19 @@ jobs:
fetch-depth: 1
ref: trunk

- name: 'Install Dependencies'
uses: php-actions/composer@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php_version: 8.0
args: --no-interaction --no-progress --ignore-platform-reqs --no-scripts
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, gd, json, readline, xsl, xml, mysql
tools: composer:v2
coverage: none

- name: Install Node dependencies
run: npm clean-install --omit-dev --ignore-scripts

- name: Install Composer dependencies
run: composer install --no-interaction --no-progress --ignore-platform-reqs

- name: 'PHStan Custom Rules'
run: scripts/PHPStan/run_legacy_ui_report.sh
Expand Down
2 changes: 1 addition & 1 deletion CI/PHP-CS-Fixer/code-format.php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ return (new PhpCsFixer\Config())
'strict_param' => false,
'cast_spaces' => true,
'concat_space' => ['spacing' => 'one'],
'function_typehint_space' => true
'type_declaration_spaces' => true
])
->setFinder($finder);
6 changes: 4 additions & 2 deletions Modules/Bibliographic/classes/class.ilObjBibliographic.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public function __construct(int $existant_bibl_id = 0)
*/
private function handleUpload(): ?\ILIAS\ResourceStorage\Identification\ResourceIdentification
{
$this->upload_service->process();
if (!$this->upload_service->hasBeenProcessed()) {
$this->upload_service->process();
}
$array_result = $this->upload_service->getResults();
$result = reset($array_result); // FileUpload is the first element
if (!$result->isOK()) {
Expand All @@ -115,7 +117,7 @@ private function handleUpload(): ?\ILIAS\ResourceStorage\Identification\Resource
* @param bool $clone_mode*/
protected function doCreate(bool $clone_mode = false): void
{
if ($this->upload_service->hasUploads() && !$this->upload_service->hasBeenProcessed()) {
if ($this->upload_service->hasUploads()) {
$this->setResourceId($this->handleUpload());
}

Expand Down
14 changes: 7 additions & 7 deletions Modules/Blog/classes/class.ilObjBlogGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,12 @@ public function executeCommand(): void
$ilCtrl->setParameter($this, "prvm", "fsc");
break;

// blog in portfolio
// blog in portfolio
case "previewEmbedded":
$ilCtrl->setParameter($this, "prvm", "emb");
break;

// edit
// edit
default:
$this->setContentStyleSheet();

Expand Down Expand Up @@ -688,7 +688,7 @@ public function executeCommand(): void
$this->renderFullScreen($ret, $nav);
break;

// blog in portfolio
// blog in portfolio
case "previewEmbedded":
$this->addHeaderActionForCommand($cmd);
$this->filterInactivePostings();
Expand All @@ -697,7 +697,7 @@ public function executeCommand(): void
$this->rendered_content = $this->buildEmbedded($ret, $nav);
return;

// ilias/editor
// ilias/editor
default:
// infos about draft status / snippet
$info = array();
Expand Down Expand Up @@ -1347,7 +1347,7 @@ protected function buildPostingList(
foreach (ilBlogPosting::getAllPostings($a_obj_id) as $posting) {
if ($this->author &&
($posting["author"] == $this->author ||
(is_array($posting["editors"]) && in_array($this->author, $posting["editors"])))) {
(is_array($posting["editors"] ?? false) && in_array($this->author, $posting["editors"])))) {
$author_found = true;
}

Expand Down Expand Up @@ -1921,7 +1921,7 @@ protected function renderNavigationByKeywords(
$wtpl->setCurrentBlock("keyword");
foreach ($keywords as $keyword => $counter) {
if (!$a_link_template) {
$ilCtrl->setParameter($this, "kwd", urlencode($keyword)); // #15885
$ilCtrl->setParameter($this, "kwd", urlencode((string) $keyword)); // #15885
$url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
$ilCtrl->setParameter($this, "kwd", "");
} else {
Expand Down Expand Up @@ -2399,7 +2399,7 @@ public function getKeywords(

$keywords = array();
foreach ($tmp as $item) {
$keywords[$item["keyword"]] = $item["counter"];
$keywords[(string) $item["keyword"]] = $item["counter"];
}
return $keywords;
}
Expand Down
4 changes: 4 additions & 0 deletions Modules/BookingManager/Objects/class.ilBookingObjectGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public function __construct(
$this->ref_id = $this->book_request->getRefId();
$this->ctrl->saveParameter($this, "object_id");

if ($this->object_id > 0 && ilBookingObject::lookupPoolId($this->object_id) !== $this->pool_gui->getObject()->getId()) {
throw new ilPermissionException("Booking object pool id does not match pool id.");
}

$this->rsv_ids = array_map('intval', $this->book_request->getReservationIdsFromString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ protected function fillRow(array $a_set): void
}

if ($has_booking || $this->may_edit) {
if (trim($a_set['post_text']) || $a_set['post_file']) {
if (trim($a_set['post_text'] ?? "") || $a_set['post_file']) {
$items[] = $this->ui_factory->button()->shy(
$lng->txt('book_post_booking_information'),
$ilCtrl->getLinkTargetByClass("ilbookingprocessgui", 'displayPostInfo')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public function __construct(
$this->addColumn("", "", 1);
$this->addColumn($this->lng->txt("title"), "title");

$this->lng->loadLanguageModule("crs");

$selected = $this->getSelectedColumns();
$cols = $this->getSelectableColumns();

Expand Down Expand Up @@ -539,10 +541,11 @@ public function getItems(array $filter): void
$user_ids = array_diff($user_ids, ilMemberAgreement::lookupAcceptedAgreements($parent_obj_id));
}
$odf_data = ilCourseUserData::_getValuesByObjId($parent_obj_id);

$usr_data = [];
foreach ($odf_data as $usr_id => $fields) {
if (in_array($usr_id, $user_ids, true)) {
// this currently does not with strict mode, since
// $user_ids holds strings
if (in_array($usr_id, $user_ids)) {
foreach ($fields as $field_id => $value) {
if (in_array($field_id, $odf_ids, true)) {
$usr_data[$usr_id]['odf_' . $field_id] = $value;
Expand Down Expand Up @@ -667,7 +670,7 @@ protected function fillRow(array $a_set): void
foreach ($this->getSelectedColumns() as $col) {
if (isset($user_cols[$col])) {
$this->tpl->setCurrentBlock("user_col");
$this->tpl->setVariable("VALUE_USER_COL", $a_set[$col] . " ");
$this->tpl->setVariable("VALUE_USER_COL", ($a_set[$col] ?? "") . " ");
$this->tpl->parseCurrentBlock();
}
}
Expand Down
21 changes: 18 additions & 3 deletions Modules/BookingManager/Schedule/class.ilBookingSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ protected function read(): void
}
}

public function save(): bool
public function save(): ?int
{
$ilDB = $this->db;

if ($this->id) {
return false;
return null;
}

$this->id = $ilDB->nextId('booking_schedule');
Expand Down Expand Up @@ -264,7 +264,7 @@ public function update(): bool
return true;
}

public function doClone(int $a_pool_id): bool
public function doClone(int $a_pool_id): int
{
$new_obj = new self();
$new_obj->setPoolId($a_pool_id);
Expand Down Expand Up @@ -311,6 +311,21 @@ protected function saveDefinition(): bool
return true;
}

public static function lookupPoolId(int $schedule_id): int
{
global $DIC;

$ilDB = $DIC->database();

$set = $ilDB->query("SELECT pool_id " .
" FROM booking_schedule" .
" WHERE booking_schedule_id = " . $ilDB->quote($schedule_id, 'integer'));
if ($rec = $ilDB->fetchAssoc($set)) {
return (int) $rec['pool_id'];
}
return 0;
}

/**
* Check if given pool has any defined schedules
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public function __construct(
->gui()
->standardRequest();
$this->schedule_id = $this->book_request->getScheduleId();

if ($this->schedule_id > 0 && ilBookingSchedule::lookupPoolId($this->schedule_id) !== ilObject::_lookupObjId($this->ref_id)) {
throw new ilPermissionException("Schedule pool id does not match pool id.");
}

}

public function executeCommand(): void
Expand Down
7 changes: 6 additions & 1 deletion Modules/BookingManager/classes/Setup/class.Agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class Agent extends Setup\Agent\NullAgent
{
public function getUpdateObjective(Setup\Config $config = null): Setup\Objective
{
return new \ilDatabaseUpdateStepsExecutedObjective(new ilBookingManagerDBUpdateSteps());
return new Setup\ObjectiveCollection(
'Booking Manager Update',
true,
new \ilDatabaseUpdateStepsExecutedObjective(new ilBookingManagerDBUpdateSteps()),
new \ilDatabaseUpdateStepsExecutedObjective(new ilBookingManager8HotfixDBUpdateSteps())
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\BookingManager\Setup;

class ilBookingManager8HotfixDBUpdateSteps implements \ilDatabaseUpdateSteps
{
protected \ilDBInterface $db;

public function prepare(\ilDBInterface $db): void
{
$this->db = $db;
}

public function step_1(): void
{
$db = $this->db;
$set1 = $db->queryF("SELECT * FROM booking_object " .
" WHERE schedule_id = %s ",
["integer"],
[1]
);
while ($rec1 = $db->fetchAssoc($set1)) {
$set2 = $db->queryF("SELECT * FROM booking_schedule " .
" WHERE pool_id = %s ORDER BY booking_schedule_id ASC LIMIT 1",
["integer"],
[$rec1["pool_id"]]
);
if ($rec2 = $db->fetchAssoc($set2)) {
if ((int) $rec2["booking_schedule_id"] !== 1) {
$db->update("booking_object", [
"schedule_id" => ["intger", $rec2["booking_schedule_id"]]
], [ // where
"booking_object_id" => ["integer", $rec1["booking_object_id"]]
]
);
}
}
}
}
}
10 changes: 10 additions & 0 deletions Modules/BookingManager/classes/class.ilObjBookingPoolGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
class ilObjBookingPoolGUI extends ilObjectGUI
{
protected \ILIAS\BookingManager\InternalDomainService $domain;
protected ilCronManager $cron_manager;
protected \ILIAS\BookingManager\StandardGUIRequest $book_request;
protected \ILIAS\BookingManager\InternalService $service;
Expand Down Expand Up @@ -91,6 +92,7 @@ public function __construct(
throw new ilException("Booking Object ID does not match Booking Pool.");
}
$this->cron_manager = $DIC->cron()->manager();
$this->domain = $DIC->bookingManager()->internal()->domain();
}

/**
Expand Down Expand Up @@ -372,20 +374,28 @@ protected function initEditCustomForm(ilPropertyFormGUI $form): void
$pref->setInfo($this->lng->txt("book_schedule_type_none_preference_info"));
$type->addOption($pref);

$pref_options_disabled = false;
if ($this->object->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
$pref_manager = $this->domain->preferences($this->object);
$pref_options_disabled = $pref_manager->hasRun();
}

// number of preferences
$pref_nr = new ilNumberInputGUI($this->lng->txt("book_nr_of_preferences"), "preference_nr");
$pref_nr->setSize(4);
$pref_nr->setMinValue(1);
$pref_nr->setInfo($this->lng->txt("book_nr_of_preferences_info"));
$pref_nr->setSuffix($this->lng->txt("book_nr_preferences"));
$pref_nr->setRequired(true);
$pref_nr->setDisabled($pref_options_disabled);
$pref->addSubItem($pref_nr);

// preference deadline
$pref_deadline = new ilDateTimeInputGUI($this->lng->txt("book_pref_deadline"), "pref_deadline");
$pref_deadline->setInfo($this->lng->txt("book_pref_deadline_info"));
$pref_deadline->setShowTime(true);
$pref_deadline->setRequired(true);
$pref_deadline->setDisabled($pref_options_disabled);
$pref->addSubItem($pref_deadline);

$public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(

parent::__construct($a_parent_obj, $a_parent_cmd);

$this->addColumn("", "", "", true, "4%");
$this->addColumn("", "", "4%", true);
$this->addColumn($lng->txt("title"), "title", "35%");
$this->addColumn($lng->txt("description"), "desc", "45%");
$this->addColumn($lng->txt("type"), "type", "16%");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

/**
* @author Stefan Meyer <[email protected]>
* @ilCtrl_Calls ilObjCategoryReferenceGUI: ilPermissionGUI, ilInfoScreenGUI, ilPropertyFormGUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public function initItem(
$target_title = ilContainerReference::_lookupTitle($obj_id);
$target_description = ilObject::_lookupDescription($target_obj_id);

$this->deleted = $tree->isDeleted($target_ref_id);
$this->deleted = !$target_ref_id || $tree->isDeleted($target_ref_id);

parent::initItem($target_ref_id, $target_obj_id, $type, $target_title, $target_description);
parent::initItem((int) $target_ref_id, $target_obj_id, $type, $target_title, $target_description);

// general commands array
$this->commands = ilObjCategoryReferenceAccess::_getCommands($this->reference_ref_id);
Expand Down
Loading

0 comments on commit 1aee0f9

Please sign in to comment.