phpScheduleIt
May 26, 2013, 01:32:06 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: restrict booking time span but not for admin  (Read 7033 times)
arlington82
Newbie
*

Karma: 0
Posts: 6


« on: October 08, 2006, 03:08:37 AM »

Hi all,

Need help... I'm using v1.1.2 and I got a few things I wanted to do to customize phpscheduleit.

First of all, I wanted to make a restriction for users to book in a 1 week timespan, but I didn't want the admin to be restricted as well.

Previously, I added this code at the print_reservations function on fiile "lib\schedule.class.php"

   line : 141
   add : $one_week = mktime(0,0,0, date('m'), date('d') + 7, date('y'));
   
   line : 162
   add : if ($current_date >= $one_week) {
         $shown = false;
         }

Now it did great to block bookings in a one week timespan, but it also restricts the admin to book outside the one week timespan.

Is there anyway so that it only blocks users and not admins?

Secondly, is there a way for to restrict the usage of resources per user in one day? I want the user to not be able to book continuously. Example : a user books resource "A" for max. 2 hrs from 10am. to 12pm., and then books resource "A" again for 2 hours from 12pm. to 2pm. I don't want them to be able to do that and restrict the booking to just once a day per resource.

Can this be done?

Thank u all before, especially to Nick for his continuous support.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #1 on: October 09, 2006, 09:42:20 AM »

The 1st problem, change line 162 to:

Code:
if (!Auth::isAdmin() && $current_date >= $one_week) {

The 2nd issue actually describes the quota feature that is planned for a future release.  There's really no easy way to get it working at this point.
Logged
arlington82
Newbie
*

Karma: 0
Posts: 6


« Reply #2 on: October 09, 2006, 05:04:15 PM »

Quote from: "Nick"
The 1st problem, change line 162 to:

Code:
if (!Auth::isAdmin() && $current_date >= $one_week) {

The 2nd issue actually describes the quota feature that is planned for a future release.  There's really no easy way to get it working at this point.


Thanks Nick!
Will try it out right away.
Logged
arlington82
Newbie
*

Karma: 0
Posts: 6


« Reply #3 on: October 14, 2006, 03:22:39 PM »

It worked like a charm.
Thanks Nick.
Logged
egos
Newbie
*

Karma: 0
Posts: 12


« Reply #4 on: November 06, 2006, 10:32:01 AM »

Hello Nick and everybody,  I'm using v1.1.3 and I'd also like to not restrict admin users for reservations out of the timespan.

Do I only have to change line 162 to

Code:
if (!Auth::isAdmin() && $current_date >= $one_week) {


??

And my other question is, can I do it with some other users that aren't admins? For example if I don't want to restrict 'director' and 'president' logins/accounts.

Thank you very much for your software and support.  Software is great!!
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #5 on: November 07, 2006, 09:38:50 AM »

I'd have to go back and look at the code, but there should be somewhere in lib/Schedule.class.php that checks the date (around that same line number).  You'll just need to add the part with !Auth::isAdmin() like the example.
Logged
egos
Newbie
*

Karma: 0
Posts: 12


« Reply #6 on: November 10, 2006, 03:19:02 PM »

Thanks Nick,  

Any idea to be able to not restrict a user (who is not admin)  in the same line?  I'd like to authorize admins and the user 'director' in order to be able to modify/create reservations in the restricted time.  Can that be possible?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #7 on: November 13, 2006, 10:41:00 AM »

That's possible, but sloppy...

You would have to get the memberid for that user, then check to see if Auth::getCurrentID() is equal to it on the same line that you check for admin.

If the user is ever deleted and recreated, you'd have to update this with the new ID.
Logged
egos
Newbie
*

Karma: 0
Posts: 12


« Reply #8 on: November 13, 2006, 10:59:20 AM »

Thank you very much Nick, that was exactly what I needed and it worked great.  I just added a conditional option like this:



Code:
|| (Auth::getCurrentID()=="plUVvEEoCBOmVLpu")
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!