[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/database/dbobject.class.php" ); 4 5 /** 6 * \ingroup DAO 7 * 8 * Object that maps a row of the permissions table 9 */ 10 class Permission extends DbObject 11 { 12 var $_id; 13 var $_name; 14 var $_description; 15 var $_corePerm; 16 var $_adminOnly; 17 18 /** 19 * Constructor 20 * 21 * @param name Name of the permission 22 * @param description Description of the permission. Please use a locale id/key 23 * instead of a text string. Translation will be provided later on in the user interface 24 * based on this key 25 * @param id of the permission 26 */ 27 function Permission( $name, $description, $id = -1 ) 28 { 29 $this->DbObject(); 30 31 $this->pk = "id"; 32 33 $this->_name = $name; 34 $this->_description = $description; 35 $this->_id = $id; 36 $this->_adminOnly = false; 37 $this->_corePerm = false; 38 39 $this->_fields = Array( 40 "permission" => "getName", 41 "description" => "getDescription", 42 "core_perm" => "isCorePermission", 43 "admin_only" => "isAdminOnlyPermission", 44 "id" => "getId" 45 ); 46 } 47 48 function getId() 49 { 50 return( $this->_id ); 51 } 52 53 function setId( $id ) 54 { 55 $this->_id = $id; 56 } 57 58 function getName() 59 { 60 return( $this->_name ); 61 } 62 63 function setName( $name ) 64 { 65 $this->_name = $name; 66 } 67 68 function getDescription() 69 { 70 return( $this->_description ); 71 } 72 73 function setDescription( $desc ) 74 { 75 $this->_description = $desc; 76 } 77 78 function isCorePermission() 79 { 80 return( $this->_corePerm ); 81 } 82 83 function setCorePermission( $corePerm ) 84 { 85 $this->_corePerm = $corePerm; 86 } 87 88 function isAdminOnlyPermission() 89 { 90 return( $this->_adminOnly ); 91 } 92 93 function setAdminOnlyPermission( $adminOnly ) 94 { 95 $this->_adminOnly = $adminOnly; 96 } 97 98 /** 99 * Returns the number of users who have been granted this permission 100 * 101 * @return An integer 102 */ 103 function getNumUsersWithPermission() 104 { 105 lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" ); 106 $perms = new UserPermissions(); 107 return( $perms->getNumUsersWithPermission( $this->getId())); 108 } 109 } 110 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |