Menu

#59 Have different 'resolution' for different areas

None
closed
nobody
None
5
2018-11-19
2004-09-21
No

MRBS currently has one global 'resolution' value which
is the minimum amount of booking slot time and also
controls how the day and week views are shown (i.e. the
duration the table elements represent).

In our usage of MRBS we need to vary the resolution
value and the easiest way to do this is by area.
(Varying the resolution by room would require changing
the day and week views as multiple rooms are displayed
in one table on these pages).

Discussion

  • Leon Stringer

    Leon Stringer - 2004-09-21

    Logged In: YES
    user_id=718847

    I've made the following changes (to my test system) and they
    seem to work:

    1. Alter the table. We need a default so there's no NULL for
      the
      existing records. The default should match the current
      resolution value:

    ALTER TABLE mrbs_area ADD COLUMN resolution INT NOT NULL
    DEFAULT 1800;

    1. Alter the "day" view (day.php) to get the resolution from
      the
      mrbs_area table:

    if( $enable_periods ) {
    :
    :

    } else {
    $sql = "SELECT resolution FROM $tbl_area WHERE id =
    $area";
    $res = sql_query($sql);
    $row = sql_row($res, 0);
    $resolution = $row[0];
    }

    1. Make the corresponding change to the "week" view (week.php):

    if( $enable_periods ) {
    :
    :
    } else {
    $sql = "SELECT resolution FROM $tbl_area WHERE id =
    $area";
    $res = sql_query($sql);
    $row = sql_row($res, 0);
    $resolution = $row[0];
    }

    1. Add the resource string for "Add Area" (lang.en):

    $vocab["resolution"] = "Booking Length (mins)";

    1. Change "Add Area" so the resolution can be specified
      (admin.php):
    <TABLE> <TR><TD>: </TD><TD><input type="text" name="name"></TD></TR> <TR><TD>: </TD><TD><input type="text" name="area_resolution"></TD></TR> </TABLE>
    1. Add the SQL statement to handle the resolution specified
      (add.php):

    $sql = "insert into $tbl_area (area_name, resolution) values
    ('$area_name_q', $area_resolution * 60)";

    1. Set the default booking duration to match this resolution
      for new
      entries in rooms for the area (edit_entry.php):

    $duration = ($enable_periods ? 60 : 60 * 60);

        $type        = "I";
        $room_id     = $room;
        // Get default duration from room's area
        $sql = "SELECT resolution FROM $tbl_room, $tbl_area
    

    WHERE
    $tbl_room.area_id = $tbl_area.id AND $tbl_room.id =
    $room_id";
    $res = sql_query($sql);
    $row = sql_row($res, 0);
    $duration = ($enable_periods ? 60 : $row[0]);

    1. When rounding the entry up to the new resolution, get
      this from the
      database (edit_entry_handler.php):

    if( $enable_periods ) {
    :
    :

    } else {
    $sql = "SELECT resolution FROM $tbl_area WHERE id =
    $areas";
    $res = sql_query($sql);
    $row = sql_row($res, 0);
    $resolution = $row[0];
    }

     
  • Campbell Morrison

    This has now been implemented in MRBS

    • status: open --> closed
    • milestone: -->