Changeset 515 for trunk/phpbms/modules/base/include/roles.php
- Timestamp:
- 05/05/09 12:26:06 (3 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/modules/base/include/roles.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/base/include/roles.php
r485 r515 39 39 if(class_exists("phpbmsTable")){ 40 40 class roles extends phpbmsTable{ 41 42 function updateRecord($variables, $modifiedby = NULL){ 41 42 function updateRecord($variables, $modifiedby = NULL){ 43 43 parent::updateRecord($variables, $modifiedby); 44 44 … … 46 46 $this->assignUsers($variables["id"],$variables["newusers"]); 47 47 } 48 49 50 function insertRecord($variables, $createdby = NULL ){51 $theid = parent::insertRecord($variables, $createdby );52 48 49 50 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 51 $theid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 52 53 53 if(isset($variables["userschanged"])) 54 54 if($variables["userschanged"]==1) 55 55 $this->assignUsers($theid,$variables["newusers"]); 56 56 57 57 return $theid; 58 58 } 59 60 59 60 61 61 function assignUsers($id,$users){ 62 62 $querystatement="DELETE FROM rolestousers WHERE roleid=".$id; 63 63 $queryresult=$this->db->query($querystatement); 64 64 65 65 $newusers=explode(",",$users); 66 66 67 67 foreach($newusers as $theuser) 68 68 if($theuser!=""){ … … 71 71 } 72 72 } 73 74 73 74 75 75 function displayUsers($id,$type){ 76 76 $querystatement="SELECT users.id,concat(users.firstname,' ',users.lastname) as name 77 FROM users INNER JOIN rolestousers ON rolestousers.userid=users.id 77 FROM users INNER JOIN rolestousers ON rolestousers.userid=users.id 78 78 WHERE rolestousers.roleid=".((int) $id); 79 79 $assignedquery=$this->db->query($querystatement); 80 80 81 81 $thelist=array(); 82 82 83 83 if($type=="available"){ 84 84 $excludelist=array(); 85 85 while($therecord=$this->db->fetchArray($assignedquery)) 86 86 $excludelist[]=$therecord["id"]; 87 87 88 88 $querystatement="SELECT id,concat(users.firstname,' ',users.lastname) as name FROM users WHERE revoked=0 AND portalaccess=0"; 89 89 $availablequery=$this->db->query($querystatement); 90 90 91 91 while($therecord=$this->db->fetchArray($availablequery)) 92 92 if(!in_array($therecord["id"],$excludelist)) 93 $thelist[]=$therecord; 94 } else 93 $thelist[]=$therecord; 94 } else 95 95 while($therecord=$this->db->fetchArray($assignedquery)) 96 96 $thelist[]=$therecord; 97 97 98 98 foreach($thelist as $theoption){ 99 99 ?> <option value="<?php echo $theoption["id"]?>"><?php echo htmlQuotes($theoption["name"])?></option> 100 <?php 100 <?php 101 101 } 102 102 }//end function 103 103 104 104 }//end class 105 105 }//end if