45 "SELECT booking_pool_id FROM booking_settings " .
46 " WHERE schedule_type = %s " .
47 " AND pref_deadline < %s " .
48 " AND pref_booking_hash = %s ",
49 array(
"integer",
"integer",
"text"),
53 $pool_ids[] = $rec[
"booking_pool_id"];
67 $hash = uniqid(
"",
true);
69 $db->
update(
"booking_settings", array(
70 "pref_booking_hash" => array(
"text", $hash)
72 "booking_pool_id" => array(
"integer", $pool_id),
73 "pref_booking_hash" => array(
"text",
"0"),
77 "SELECT pref_booking_hash FROM booking_settings " .
78 " WHERE booking_pool_id = %s ",
84 return $rec[
"pref_booking_hash"] === $hash;
87 public function hasRun($pool_id) : bool
91 "SELECT pref_booking_hash FROM booking_settings " .
92 " WHERE booking_pool_id = %s ",
98 if ($rec[
"pref_booking_hash"] !==
"0") {
107 $db->
update(
"booking_settings", array(
108 "pref_booking_hash" => array(
"text",
"0")
110 "booking_pool_id" => array(
"integer", $pool_id)
125 foreach ($bookings as $user_id => $obj_ids) {
126 foreach ($obj_ids as $obj_id) {
130 $reservation->setObjectId($obj_id);
131 $reservation->setUserId($user_id);
132 $reservation->setAssignerId($user_id);
133 $reservation->setFrom(0);
134 $reservation->setTo(0);
135 $reservation->save();
151 )[
"data"] as $book) {
152 $bookings[$book[
"user_id"]][] = $book[
"object_id"];
fetchAssoc(ilDBStatement $statement)
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
update(string $table_name, array $values, array $where)
$where MUST contain existing columns only.
checkProcessHash(int $pool_id)
Semaphore like hash setting/checking to ensure that no other process is doing the same...
static getList(array $a_object_ids, int $a_limit=10, int $a_offset=0, array $filter=[])
List all reservations.
getBookings(array $obj_ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
queryF(string $query, array $types, array $values)
static isObjectAvailableNoSchedule(int $a_obj_id)
getPoolsWithOverdueBooking()
Get pools with overdue preference booking.
const TYPE_NO_SCHEDULE_PREFERENCES
__construct(ilDBInterface $db=null)
storeBookings(int $pool_id, array $bookings)
Store bookings see similar code in ilObjBookingPoolGUI::confirmedBookingObject this should got to a r...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...