Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

59 lines
2.4KB

  1. <?php
  2. use domain\User\User\User;
  3. use domain\User\User\UserModule;
  4. function version(string $date, array $featuresMaintenanceArray, array $featuresMaintenanceAdminArray, User $userCurrent) {
  5. release_date($date);
  6. features($featuresMaintenanceArray[0] ?? [], $featuresMaintenanceAdminArray[0] ?? [], $userCurrent);
  7. maintenance($featuresMaintenanceArray[1] ?? [], $featuresMaintenanceAdminArray[1] ?? [], $userCurrent);
  8. }
  9. function release_date(string $date) {
  10. $html = '<div class="block block-release-date">';
  11. $html .= '<h4><span class="glyphicon glyphicon-calendar"></span> Date de sortie</h4>';
  12. $html .= '<ul><li>'.$date.'</li></ul>';
  13. $html .= '</div>';
  14. echo $html;
  15. }
  16. function features(array $featuresArray, array $featuresAdminArray, User $userCurrent) {
  17. $userModule = UserModule::getInstance();
  18. $isGrantedAsUserCurrent = $userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent);
  19. if(count($featuresArray) > 0 || (count($featuresAdminArray) > 0 && $isGrantedAsUserCurrent)) {
  20. $html = '<div class="block block-features">';
  21. $html .= '<h4><span class="glyphicon glyphicon-flash"></span> Évolutions</h4>';
  22. $html .= '<ul>';
  23. foreach($featuresArray as $feature) {
  24. $html .= '<li>'.$feature.'</li>';
  25. }
  26. if($isGrantedAsUserCurrent) {
  27. foreach($featuresAdminArray as $feature) {
  28. $html .= '<li class="admin">'.$feature.'</li>';
  29. }
  30. }
  31. $html .= '</ul>';
  32. $html .= '</div>';
  33. echo $html;
  34. }
  35. }
  36. function maintenance(array $maintenanceArray, array $maintenanceAdminArray, User $userCurrent) {
  37. $userModule = UserModule::getInstance();
  38. if(count($maintenanceArray) > 0 || count($maintenanceAdminArray) > 0) {
  39. $html = '<div class="block block-maintenance">';
  40. $html .= '<h4><span class="glyphicon glyphicon-wrench"></span> Maintenance</h4>';
  41. $html .= '<ul>';
  42. foreach($maintenanceArray as $maintenance) {
  43. $html .= '<li>'.$maintenance.'</li>';
  44. }
  45. if($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)) {
  46. foreach ($maintenanceAdminArray as $maintenance) {
  47. $html .= '<li class="admin">' . $maintenance . '</li>';
  48. }
  49. }
  50. $html .= '</ul>';
  51. $html .= '</div>';
  52. echo $html;
  53. }
  54. }