Cheers, just added the code by Minkus and its working a treat.
Many thanks
Ste.
Cheers, just added the code by Minkus and its working a treat.
Many thanks
Ste.
I'm still having difficulties with this. Are we talking of altering the 3 files in the MRBS\web folder? When I've applied the changes the room booking system page fails to load, I just get a blank.
Thanks for the post on how to add this feature it was just what we needed at the school I work at.
I've added a comment to a feature request for this feature on the MRBS website notifying that the feature has been written by an edugeek member.
https://sourceforge.net/tracker/inde...13&atid=355113
So I'm hoping one of the MRBS developers will follow the link here and add the feature into the next version either inspired from the code here or if theres no objections copied from here so next time someone needs this feature or I do an upgrade I won't have to cut and paste code from here.
Thanks,
Daniel
Hi Chris,
Did you ever manage to create the bulk upload page for timetabled lessons? I have been looking at MRBS for some time trying to do this but have been unsuccessful so far...
MTIA
AdamM (4th March 2009)
Thanks looks like I'll just have to keep plodding on with it![]()
Have some Thanks!!
Have added minkus code and go the mrbs working to allow booking 5 days in advance. However am getting an error message display above the company title when I try to book more than 5 days in advance
Warning: Missing argument 5 for check_allowed(), called in C:\wamp\www\edit_entry_handler.php on line 345 and defined in C:\wamp\www\functions.inc on line 781
Can anyone help solve this problem
Hi all,
Have just upgraded to MRBS 1.4.2, and some of the code in the posts above needs updating. Unfortunately I don't seem to be able to edit the originals, so here's an up-to-date version with the latest code:
To make it so that any logged-in user can edit an existing booking, not just the owner and administrators:
Edit mrbs_auth.inc
Inside function getWritable, change
toPHP Code:if(authGetUserLevel($user) >= 2)
To create a maximum and minimum book-ahead time, which can be bypassed by administrators:PHP Code:if(authGetUserLevel($user) >= 1)
Add the following settings to config.inc.php:
Add the following to functions.inc before the final '?>':PHP Code:$max_days_ahead = 14;
$min_days_ahead = 1;
Add the following to edit_entry_handler.php just after '$rules_broken = array();'PHP Code:#Function to determine the amount of days between 2 dates
function check_allowed($month1, $day1, $year1, $max_days_ahead, $min_days_ahead)
{
$daysbetween = check_days($month1, $day1, $year1);
if ($daysbetween > $max_days_ahead or $daysbetween < $min_days_ahead)
{
return(0);
}
Else
{
return(1);
}
}
function check_days($month1, $day1, $year1)
{
# Get Current Date
$month2 = date('m');
$day2 = date('d');
$year2 = date('y');
# Turn the dates into a timestamp and subtract the current date from the date supplied.
$dateDiff = mktime(0,0,0,$month1, $day1, $year1) - mktime(0,0,0,$month2, $day2, $year2);
#Round the date down
$dateDiff = floor($dateDiff/60/60/24);
return($dateDiff);
}
Add the following to del_entry.php just before 'if (MAIL_ADMIN_ON_DELETE)':PHP Code:$required_level = (isset($max_level) ? $max_level : 2);
If (check_allowed($_GET["month"], $_GET["day"], $_GET["year"], $max_days_ahead, $min_days_ahead) or getAuthorised($required_level)){
}
else{
$valid_booking = FALSE;
$rules_broken[] = "You cannot book more than ".$max_days_ahead." or less than ".$min_days_ahead." day(s) ahead";
}
To prevent non-administrators from creating or deleting a series of repeating entries:PHP Code:$required_level = (isset($max_level) ? $max_level : 2);
if (check_allowed($month, $day, $year, $max_days_ahead, $min_days_ahead) or getAuthorised($required_level)){
}
else{
showAccessDenied($day, $month, $year, $area, "");
exit();
}
Edit edit_entry_handler.php
Change
toPHP Code:if(count($reps) < $max_rep_entrys)
Edit del_entry.phpPHP Code:$required_level = (isset($max_level) ? $max_level : 2);
if(count($reps) < $max_rep_entrys and getAuthorised($required_level))
Change
toPHP Code:if (getAuthorised(1) && ($info = mrbsGetEntryInfo($id)))
Hope this helps!PHP Code:$required_level = (isset($max_level) ? $max_level : 2);
if (getAuthorised(1) && ($info = mrbsGetEntryInfo($id)) && ($series != 1 || getAuthorised($required_level)))
Last edited by Minkus; 25th September 2009 at 03:46 PM. Reason: Updated to use MRBS 1.4.2 $max_level config value
I think this is the stand alone version of MRBS not the version which integrates with Moodle?
I have entered the excellent code from Minkus to prevent booking more than 5 days in advance. Works perfectly on a wamp virtual server. However when I upload this I am getting a error message for non admin users 'Scheduling Conflict Cannot book more than days in advance' This happens even it if try to book on today's date.
Anyone any ideas please
Outlaw27,
Try setting $min_days_ahead to 0.
Kind regards,
Chris
Updated to MRBS 1.4.3 - the only change to the post above is that in the 'To create a maximum and minimum book-ahead time, which can be bypassed by administrators:' section, where it says
it should now sayAdd the following to del_entry.php just before 'if (MAIL_ADMIN_ON_DELETE)':
Hope this helps!Add the following to del_entry.php just before 'if ($mail_settings['admin_on_delete'])':
Have added the files with the Minkus code to prevent non administrators creating a series of repeating entries.
However when I tried to delete a entry I got an error message, so I changed the code back to what it was orginally. However now when I try to delete an entry I get the following error message.
Parse error: syntax error, unexpected '{' in /home7/cshsvleo/public_html/mrbs/web/del_entry.php on line 37
Where have I went wrong. I have Minkus code installed to pervent booking a single entry no future than 7 days in advance. All help gratefully received.
I use MRBS in an office/conference environment, I was wondering is there a way of putting in a button which says request a booking comes up with a form which will have for example, Contact Name, Email, Company name, Department, Telephone number, Requirements etc. which is then sent to the girls in the office who can then make the booking, trying to save the phone going all the time.
Would this be done through editing the code or is it just not worth it? any ideas?
Hi all,
As of MRBS 1.4.4, most of the above code has been implemented into MRBS itself, with a few small exceptions. You can now set a minimum and maximum book ahead time using $min_book_ahead_enabled, $max_book_ahead_enabled, $min_book_ahead_days and $max_book_ahead_days, and you can specify that only admins should be able to create repeat bookings using $auth['only_admin_can_book_repeat']. Thanks to the MRBS team for making these changes!
The only ones which some people may still want to make in schools are as follows:
To make it so that any logged-in user can edit an existing booking, not just the owner and administrators:
Edit mrbs_auth.inc
Inside function getWritable, just before '// Otherwise you have to be a (booking) admin for this room', add:
PHP Code:if(authGetUserLevel($user) >= 1)
{
return 1;
}
To prevent non-administrators from deleting a repeat booking, or deleting any booking outside the minimum / maximum book ahead times:
NB This is only necessary if you make the change above - normally you can only delete an item if you created it in the first place, in which case the repeat / book ahead restrictions will have been applied at that point
Edit del_entry.php
Find '$authorised = auth_book_admin($user, $info['room_id']);'
Just after the closing } for the above statement, add:
If anyone from the MRBS team would like to add these as an option in the next version, it would be much appreciated!PHP Code:elseif ($series && !empty($auth['only_admin_can_book_repeat']))
{
$authorised = (authGetUserLevel($user) >= 2);
}
elseif (mrbsCheckPolicy($info['start_time']))
{
$authorised = auth_book_admin($user, $info['room_id']);
}
Kind regards,
Last edited by Minkus; 21st May 2010 at 04:00 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)