Hi. I need help on showing more detail, ie: Who booked and how description, at the viewing booking at the caleendar on the day.php/week.php/month.php pages. Need your guide on this. Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2019-05-31
If its for mrbs version 1.4.8?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2019-05-31
Where do I add in the line you mention in this function? Sorry, still kinda new to programming.
function map_add_booking ($row, &$column, $am7, $pm7, $format){ // Enters the contents of the booking found in $row into $column, which is // a column of the map of the bookings being prepared ready for display. // // $column the column of the map that is being prepared (see below) // $row a booking from the database // $am7 the start of the first slot of the booking day (Unix timestamp) // $pm7 the start of the last slot of the booking day (Unix timestamp) // $format time format used for indexing the $map array // $row is expected to have the following field names, when present: // room_id // start_time // end_time // name // repeat_id // entry_id // type // entry_description // entry_create_by // status // $column is a column of the map of the screen that will be displayed // It looks like: // $column[Time][n][id] // [is_repeat] // [is_multiday_start] a boolean indicating if the booking stretches // beyond the day start // [is_multiday_end] a boolean indicating if the booking stretches // beyond the day end // [color] // [data] // [long_descr] // [create_by] // [room_id] // [start_time] // [slots] // [status] // slots records the duration of the booking in number of time slots. // Used to calculate how high to make the block used for clipping // overflow descriptions. // Fill in the map for this meeting. Start at the meeting start time, // or the day start time, whichever is later. End one slot before the // meeting end time (since the next slot is for meetings which start then), // or at the last slot in the day, whichever is earlier. // Time is of the format HHMM without leading zeros. // // [n] exists because it's possible that there may be multiple bookings // in the same time slot. Normally this won't be the case. However it // can arise legitimately if you increase the resolution, or shift the // displayed day. For example if you previously had a resolution of 1800 // seconds you might have a booking (A) for 1000-1130 and another (B) for 1130-1230. // If you then increase the resolution to 3600 seconds, these two bookings // will both occupy the 1100-1200 time slot. [n] starts at 0. For // the example above the map for the room would look like this // // 0 1 // 1000 A // 1100 A B // 1200 B // // Note: int casts on database rows for max may be needed for PHP3. // Adjust the starting and ending times so that bookings which don't // start or end at a recognized time still appear. global $resolution; global $is_private_field; $user = getUserName(); if (is_private_event($row['status'] & STATUS_PRIVATE) && !getWritable($row['entry_create_by'], $user, $row['room_id'])) { $row['status'] |= STATUS_PRIVATE; // Set the private bit if ($is_private_field['entry.name']) { $row['name']= "[".get_vocab('unavailable')."]"; } if ($is_private_field['entry.description']) { $row['entry_description']= "[".get_vocab('unavailable')."]"; } } else { $row['status'] &= ~STATUS_PRIVATE; // Clear the private bit } $is_multiday_start = ($row['start_time'] < $am7); $is_multiday_end = ($row['end_time'] > ($pm7 + $resolution)); $start_t = max(round_t_down($row['start_time'], $resolution, $am7), $am7); $end_t = min(round_t_up($row['end_time'], $resolution, $am7) - $resolution, $pm7); // calculate the times used for indexing $time_start_t = date($format,$start_t); $time_end_t = date($format,$end_t); for ($t = $start_t; $t <= $end_t; $t += $resolution) { $time_t = date($format,$t); // find the first free index (in case there are multiple bookings in a timeslot) $n = 0; while (!empty($column[$time_t][$n]["id"])) { $n++; } // fill in the id, type and start time $column[$time_t][$n]["id"] = $row['entry_id']; $column[$time_t][$n]["is_repeat"] = !empty($row['repeat_id']); $column[$time_t][$n]["is_multiday_start"] = $is_multiday_start; $column[$time_t][$n]["is_multiday_end"] = $is_multiday_end; $column[$time_t][$n]["status"] = $row['status']; $column[$time_t][$n]["color"] = $row['type']; $column[$time_t][$n]["start_time"] = utf8_strftime(hour_min_format(), $row['start_time']); $column[$time_t][$n]["slots"] = null; // to avoid undefined index NOTICE errors // if it's a multiple booking also fill in the name and description if ($n > 0) { $column[$time_t][$n]["data"] = $row['name']; $column[$time_t][$n]["long_descr"] = $row['entry_description']; $column[$time_t][$n]["create_by"] = $row['entry_create_by']; $column[$time_t][$n]["room_id"] = $row['room_id']; } // otherwise just leave them blank (we'll fill in the first whole slot later) else { $column[$time_t][$n]["data"] = ""; $column[$time_t][$n]["long_descr"] = ""; $column[$time_t][$n]["create_by"] = ""; $column[$time_t][$n]["room_id"] = ""; } } // end for // Show the name of the booker, the description and the number of complete // slots in the first complete slot that the booking happens in, or at the // start of the day if it started before today. // Find the number of time slots that the booking occupies, and the index // of the first slot that this booking has entirely to itself $n_slots = intval(($end_t - $start_t)/$resolution) + 1; $first_slot = $start_t; // If the last time slot is already occupied, we have a multiple // booking in the last slot, so decrement the number of slots that // we will display for this booking if (isset($column[$time_end_t][1]["id"])) { $n_slots--; // If we're only the second booking to land on this time slot // then we'll have to adjust the information held for the first booking // (unless it's just one slot long in the first place, when it // doesn't matter as it will now be part of a multiple booking). // If we are the third booking or more, then it will have already // been adjusted. if (!isset($column[$time_end_t][2]["id"])) { if ($column[$time_end_t][0]["slots"] > 1) { // Move the name and description into the new first slot and decrement the number of slots $column[date($format, $end_t + $resolution)][0]["data"] = $column[$time_end_t][0]["data"]; $column[date($format, $end_t + $resolution)][0]["long_descr"] = $column[$time_end_t][0]["long_descr"]; $column[date($format, $end_t + $resolution)][0]["create_by"] = $column[$time_end_t][0]["create_by"]; $column[date($format, $end_t + $resolution)][0]["room_id"] = $column[$time_end_t][0]["room_id"]; $column[date($format, $end_t + $resolution)][0]["slots"] = $column[$time_end_t][0]["slots"] - 1; } } } // and if the first time slot is already occupied, decrement // again, adjust the first slot for this booking if (isset($column[$time_start_t][1]["id"])) { $n_slots--; $first_slot += $resolution; // If we're only the second booking to land on this time slot // then we'll have to adjust the information held for the first booking if (!isset($column[$time_start_t][2]["id"])) { // Find the first slot ($s) of the first booking $first_booking_id = $column[$time_start_t][0]["id"]; $s = $start_t; // If you've got to the first slot of the day then that must be the // first slot of the first booking while ($s > $am7) { // Otherwise, step back one slot. $s -= $resolution; // If that slot contains the first booking, then step back again if (isset($column[date($format,$s)])) { foreach ($column[date($format,$s)] as $booking) { if ($booking["id"] == $first_booking_id) { continue 2; // next iteration of the while loop } } } // If not, then we've stepped back one slot past the start of // the first booking, so step forward again and finish $s += $resolution; break; } // end while // Now we've found the time ($s) of the first slot of the first booking // we need to find its index ($i) foreach ($column[date($format,$s)] as $i => $booking) { if ($booking["id"] == $first_booking_id) { break; } } // Finally decrement the slot count for the first booking // no need to worry about count going < 1: the multiple booking display // does not use the slot count. $column[date($format,$s)][$i]["slots"]--; // and put the name and description in the multiply booked slot $column[$time_start_t][0]["data"] = $column[date($format,$s)][$i]["data"]; $column[$time_start_t][0]["long_descr"] = $column[date($format,$s)][$i]["long_descr"]; $column[$time_start_t][0]["create_by"] = $column[date($format,$s)][$i]["create_by"]; $column[$time_start_t][0]["room_id"] = $column[date($format,$s)][$i]["room_id"]; } } // now we've got all the information we can enter it in the first complete // slot for the booking (provided it's not a multiple booking slot) if (!isset($column[date($format,$first_slot)][1]["id"])) { $column[date($format,$first_slot)][0]["data"] = $row['name']; $column[date($format,$first_slot)][0]["long_descr"] = $row['entry_description']; $column[date($format,$first_slot)][0]["create_by"] = $row['entry_create_by']; $column[date($format,$first_slot)][0]["room_id"] = $row['room_id']; $column[date($format,$first_slot)][0]["slots"] = $n_slots; }} // end function map_add_booking()
Last edit: Campbell Morrison 2019-05-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
function map_add_booking ($row, &$column, $am7, $pm7, $format){ $row['name'] = $row['name'] . ' (' . $row['create_by'] . ')'; $row['description'] = $row['description'] . ' (' . $row['create_by'] . ')'; // Enters the contents of the booking found in $row into $column, which is
Note that in 1.4.8 $entry was called $row, so I have renamed it in the example above.
However, I'd recommend that you upgrade to the latest release of MRBS before making any changes.
Last edit: Campbell Morrison 2019-05-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2019-06-19
I tried adding the line. However still does not show the details.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
See https://sourceforge.net/p/mrbs/support-requests/1741/.
If its for mrbs version 1.4.8?
Where do I add in the line you mention in this function? Sorry, still kinda new to programming.
Last edit: Campbell Morrison 2019-05-31
At the beginning, eg
Note that in 1.4.8 $entry was called $row, so I have renamed it in the example above.
However, I'd recommend that you upgrade to the latest release of MRBS before making any changes.
Last edit: Campbell Morrison 2019-05-31
I tried adding the line. However still does not show the details.
And what do the first 10 lines of your function now look like (including the first line
function map_add_booking
)?