[ Index ] |
|
Code source de Claroline 188 |
1 <?php // $Id: profileToolRight.class.php,v 1.5 2006/10/16 07:55:02 moosh Exp $ 2 if ( count( get_included_files() ) == 1 ) die( '---' ); 3 /** 4 * CLAROLINE 5 * 6 * Class to manage profile and tool right (none, user, manager) 7 * 8 * @version 1.8 $Revision: 1.5 $ 9 * 10 * @copyright (c) 2001-2006 Universite catholique de Louvain (UCL) 11 * 12 * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE 13 * 14 * @package CLMAIN 15 * 16 * @author Claro Team <cvs@claroline.net> 17 */ 18 19 require_once dirname(__FILE__) . '/constants.inc.php'; 20 require_once dirname(__FILE__) . '/profileToolAction.class.php'; 21 22 class RightProfileToolRight extends RightProfileToolAction 23 { 24 25 /** 26 * Set the tool right (none, user, manager) 27 * 28 * @param integer $toolId tool identifier 29 * @param string $right the right value 30 */ 31 32 function setToolRight($toolId,$right) 33 { 34 if ( $right == 'none' ) 35 { 36 $this->setAction($toolId,'read',false); 37 $this->setAction($toolId,'edit',false); 38 } 39 elseif ( $right == 'user' ) 40 { 41 $this->setAction($toolId,'read',true); 42 $this->setAction($toolId,'edit',false); 43 } 44 elseif ( $right == 'manager' ) 45 { 46 $this->setAction($toolId,'read',true); 47 $this->setAction($toolId,'edit',true); 48 } 49 } 50 51 /** 52 * Get the tool right (none, user, manager) 53 * 54 * @param integer $toolId tool identifier 55 */ 56 57 function getToolRight($toolId) 58 { 59 $readAction = (bool) $this->getAction($toolId,'read'); 60 $manageAction = (bool) $this->getAction($toolId,'edit'); 61 62 if ( $readAction == false && $manageAction == false ) 63 { 64 return 'none'; 65 } 66 elseif ( $readAction == true && $manageAction == false ) 67 { 68 return 'user'; 69 } 70 else 71 { 72 return 'manager'; 73 } 74 } 75 76 /** 77 * Set right of the tool list 78 */ 79 80 function setToolListRight($toolList,$right) 81 { 82 foreach ( $toolList as $toolId ) 83 { 84 $this->setToolRight($toolId,$right); 85 } 86 } 87 } 88 89 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 14:38:42 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |