Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions components/ILIAS/BookingManager/Access/AccessManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace ILIAS\BookingManager\Access;

use ILIAS\BookingManager\InternalDomainService;
use ilObjBookingPool;

class AccessManager
{
Expand Down Expand Up @@ -184,4 +185,18 @@ public function validateScheduleId(int $schedule_id, int $pool_id): void
}
}

public function canRead(int $ref_id, int $current_user = 0): bool
{
return $this->access->checkAccessOfUser(
$this->getCurrentUserId($current_user),
"read",
"",
$ref_id
);
}

public function canReadPublicLog(int $ref_id, int $current_user = 0): bool
{
return $this->canRead($ref_id, $current_user) && (new ilObjBookingPool($ref_id, true))->hasPublicLog();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

namespace ILIAS\BookingManager\BookingProcess;

use ilGlobalTemplateInterface;

/**
* @author Alexander Killing <killing@leifos.de>
*/
Expand Down Expand Up @@ -51,6 +53,14 @@ public function render(): string
$tpl = new \ilTemplate("tpl.obj_selection.html", true, true, "components/ILIAS/BookingManager/BookingProcess");

$selected = $this->object_selection->getSelectedObjects();

if ($selected === []) {
$this->ui->mainTemplate()->setOnScreenMessage(
ilGlobalTemplateInterface::MESSAGE_TYPE_INFO,
$this->lng->txt("book_week_no_objects_selected")
);
}

foreach ($this->object_manager->getObjectTitles() as $id => $title) {
$tpl->setCurrentBlock("item");
if (in_array($id, $selected)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,15 @@ public function week(): void // ok
);
$tpl->setContent($week_gui->getHTML());

$bar = $this->gui->toolbar();
$list_link = $this->ctrl->getLinkTargetByClass("ilObjBookingPoolGUI", "render");
$week_link = $this->ctrl->getLinkTargetByClass("ilBookingProcessWithScheduleGUI", "week");
$mode_control = $this->gui->ui()->factory()->viewControl()->mode([
$this->lng->txt("book_list") => $list_link,
$this->lng->txt("book_week") => $week_link
], $this->lng->txt("book_view"))->withActive($this->lng->txt("book_week"));
$bar->addComponent($mode_control);
$book_week = $this->lng->txt('book_week');
$mode_control = $this->gui->ui()->factory()->viewControl()->mode(
[
$this->lng->txt('book_table') => $this->ctrl->getLinkTargetByClass(ilObjBookingPoolGUI::class, 'render'),
$book_week => $this->ctrl->getLinkTarget($this, 'week')
],
$this->lng->txt('book_view')
)->withActive($book_week);
$this->gui->toolbar()->addComponent($mode_control);

$list_gui = new \ILIAS\BookingManager\BookingProcess\ObjectSelectionListGUI(
$this->pool->getId(),
Expand Down
35 changes: 21 additions & 14 deletions components/ILIAS/BookingManager/Objects/class.ilBookingObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,29 @@ public function deleteFiles(): void

protected function read(): void
{
$ilDB = $this->db;
if (!$this->id) {
return;
}

if ($this->id) {
$set = $ilDB->query('SELECT *' .
' FROM booking_object' .
' WHERE booking_object_id = ' . $ilDB->quote($this->id, 'integer'));
$row = $ilDB->fetchAssoc($set);
$this->setTitle((string) $row['title']);
$this->setDescription((string) $row['description']);
$this->setPoolId((int) $row['pool_id']);
$this->setScheduleId($row['schedule_id']);
$this->setNrOfItems((int) $row['nr_items']);
$this->setFile((string) $row['info_file']);
$this->setPostText((string) $row['post_text']);
$this->setPostFile((string) $row['post_file']);
$set = $this->db->queryF(
'SELECT * FROM booking_object WHERE booking_object_id = %s',
[ilDBConstants::T_INTEGER],
[$this->id]
);
$row = $this->db->fetchAssoc($set);

if ($row === null || $row === []) {
return;
}

$this->setTitle((string) $row['title']);
$this->setDescription((string) $row['description']);
$this->setPoolId((int) $row['pool_id']);
$this->setScheduleId($row['schedule_id']);
$this->setNrOfItems((int) $row['nr_items']);
$this->setFile((string) $row['info_file']);
$this->setPostText((string) $row['post_text']);
$this->setPostFile((string) $row['post_file']);
}

/**
Expand Down
Loading
Loading