setting.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. require_once(dirname(__FILE__).'/header.php');
  3. if(isset($myUser) && $myUser!=false && $myUser->can('configuration', 'r')){
  4. switch(@$_['section']){
  5. case 'plugin':
  6. $plugins = Plugin::getAll();
  7. $tpl->assign('plugins',$plugins);
  8. break;
  9. case 'user':
  10. //Gestion de la modification des utilisateurs
  11. if (isset($_['id_user'])){
  12. $usersManager = new User();
  13. $id_modusers = $_['id_user'];
  14. $selected = $usersManager->getById($id_modusers);
  15. $description = $selected->GetFirstName()." ".$selected->GetName();
  16. $button = "Modifier";
  17. $tpl->assign('id_modusers',$id_modusers);
  18. $tpl->assign('login',$selected->getLogin());
  19. $tpl->assign('firstname',$selected->getFirstName());
  20. $tpl->assign('lastname',$selected->getName());
  21. $tpl->assign('email',$selected->getMail());
  22. $tpl->assign('userrank',$selected->getRank());
  23. }
  24. else
  25. {
  26. $description = "Ajout d'un utilisateur";
  27. $button = "Ajouter";
  28. $tpl->assign('userrank','');
  29. }
  30. $tpl->assign('button',$button);
  31. $tpl->assign('description',$description);
  32. $users = User::getAllUsers();
  33. $ranks = new Rank();
  34. $ranks = $ranks->populate();
  35. $ranksLabel = array();
  36. foreach($ranks as $rank){
  37. $ranksLabel[$rank->getId()]= $rank->getLabel();
  38. }
  39. $tpl->assign('ranksLabel',$ranksLabel);
  40. $tpl->assign('users',$users);
  41. $tpl->assign('ranks',$ranks);
  42. break;
  43. case 'access':
  44. $rankManager = new Rank();
  45. $ranks = $rankManager->populate();
  46. //Gestion de la modification des rank
  47. if (isset($_['id_rank'])){
  48. $id_modrank = $_['id_rank'];
  49. $selected = $rankManager->getById($id_modrank);
  50. $description = $selected->getLabel();
  51. $button = "Modifier";
  52. $tpl->assign('id_modrank',$id_modrank);
  53. $tpl->assign('label_rank',$selected->getLabel());
  54. $tpl->assign('description_rank',$selected->getDescription());
  55. }
  56. else
  57. {
  58. $description = "Ajout d'un rang";
  59. $button = "Ajouter";
  60. }
  61. $tpl->assign('description',$description);
  62. $tpl->assign('button',$button);
  63. $tpl->assign('ranks',$ranks);
  64. break;
  65. case 'right':
  66. $rightManager = new Right();
  67. $sectionManager = new Section();
  68. $rank = new Rank();
  69. $rank = $rank->getById($_['id']);
  70. $rights = $rightManager->loadAll(array('rank'=>$_['id']));
  71. $rightsDictionnary = array();
  72. foreach ($rights as $value) {
  73. $rightsDictionnary[$value->getSection()]['c'] = $value->getCreate();
  74. $rightsDictionnary[$value->getSection()]['r'] = $value->getRead();
  75. $rightsDictionnary[$value->getSection()]['u'] = $value->getUpdate();
  76. $rightsDictionnary[$value->getSection()]['d'] = $value->getDelete();
  77. }
  78. $tpl->assign('rights',$rightsDictionnary);
  79. $tpl->assign('sections',$sectionManager->populate('label'));
  80. $tpl->assign('rank',$rank);
  81. break;
  82. }
  83. $view = 'setting';
  84. }else{
  85. exit('Vous devez être connecté');
  86. }
  87. require_once(dirname(__FILE__).'/footer.php');
  88. ?>