phpScheduleIt
May 24, 2013, 11:56:26 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: Hide Non-permitted resources  (Read 3499 times)
suzu
Newbie
*

Karma: 0
Posts: 1


« on: September 14, 2006, 04:13:58 AM »

In bookings page, the resources that are not permitted shows on the page in the faded, gray color. Is there any way to not show the entire row for that resource? I don't want a user to be able to even see the schedule for the resource if not given a permission for it. Is there a quick way to get around this?
Logged
mudpit
Newbie
*

Karma: 0
Posts: 6


« Reply #1 on: October 18, 2006, 10:27:57 PM »

Hi all,

Has anyone found a fix for this? I've been looking at schedule.class.php and schedule.template.php but can't figure it out. I can make it so the name doesn't appear but the row does so the resource can still be booked. Anyone have any clues?

cheers,
Andy
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #2 on: October 19, 2006, 09:52:47 AM »

A pretty simple hack for this would be to change lines 81-87 in Schedule.class.php to:

Code:

$this->machids = $this->db->get_mach_ids($this->scheduleid);    // Get all resource info
$machids = array();
if($this->machids !== false) {
  foreach($this->machids as $mach) {
    if ($this->user->has_perm($mach['machid'])) {
      $machids[] = $mach['machid'];
    }
  }
}


Sorry for the formatting...
Logged
cypherpunks
Newbie
*

Karma: 0
Posts: 4


« Reply #3 on: November 08, 2006, 05:33:00 PM »

Unfortunately, the code posted above has no effect on displayed rows. So, after looking closer, I came up with my version.

Open the file lib/Schedule.class.php

In the function

Code:

    function Schedule($scheduleid, $scheduleType = ALL) {


replace the line

Code:

            $this->machids = $this->db->get_mach_ids($this->scheduleid);    // Get all resource info


with this code:

Code:

            $temp_machids = $this->db->get_mach_ids($this->scheduleid);    // Get all resource info
            if($temp_machids !== false) {
              foreach($temp_machids as $mach) {
                if ($this->user->has_perm($mach['machid'])) {
                  $this->machids[] = $mach;
                }
              }
            }
Logged
malibu1320
Newbie
*

Karma: 0
Posts: 6


« Reply #4 on: April 30, 2010, 10:44:51 AM »

This is an awesome mod that makes PHPScheduleIt perfect for my needs.  However, I cannot seem to get the ReadOnly version of the schedule to work with this mod in place.  Is there an easy change that I am missing?
Logged
malibu1320
Newbie
*

Karma: 0
Posts: 6


« Reply #5 on: October 14, 2010, 02:30:43 PM »

I got it, simple fix after a little thinking.

This will hide non-permitted resources for users, but allow everything to show on the read-only schedule.

lib/schedule.class.php

Quote
         //Modification below that only allows resources which user has permission to schedule to be viewable...
         if ($scheduleType != READ_ONLY) {
            $temp_machids = $this->db->get_mach_ids($this->scheduleid);    // Get all resource info
               if($temp_machids !== false) {
                 foreach($temp_machids as $mach) {
                   if ($this->user->has_perm($mach['machid'])) {
                     $this->machids[] = $mach;
                   }
                 }
               }
         }
         else {
            //This clause allows all resources to be displayed on the read_only page...
            $this->machids = $this->db->get_mach_ids($this->scheduleid);    // Get all resource info
         }
         //end of custom modification
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!