You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.3KB

  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. if(count($featuresArray) > 0 || count($featuresAdminArray) > 0) {
  19. $html = '<div class="block block-features">';
  20. $html .= '<h4><span class="glyphicon glyphicon-flash"></span> Évolutions</h4>';
  21. $html .= '<ul>';
  22. foreach($featuresArray as $feature) {
  23. $html .= '<li>'.$feature.'</li>';
  24. }
  25. if($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)) {
  26. foreach($featuresAdminArray as $feature) {
  27. $html .= '<li class="admin">'.$feature.'</li>';
  28. }
  29. }
  30. $html .= '</ul>';
  31. $html .= '</div>';
  32. echo $html;
  33. }
  34. }
  35. function maintenance(array $maintenanceArray, array $maintenanceAdminArray, User $userCurrent) {
  36. $userModule = UserModule::getInstance();
  37. if(count($maintenanceArray) > 0 || count($maintenanceAdminArray) > 0) {
  38. $html = '<div class="block block-maintenance">';
  39. $html .= '<h4><span class="glyphicon glyphicon-wrench"></span> Maintenance</h4>';
  40. $html .= '<ul>';
  41. foreach($maintenanceArray as $maintenance) {
  42. $html .= '<li>'.$maintenance.'</li>';
  43. }
  44. if($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)) {
  45. foreach ($maintenanceAdminArray as $maintenance) {
  46. $html .= '<li class="admin">' . $maintenance . '</li>';
  47. }
  48. }
  49. $html .= '</ul>';
  50. $html .= '</div>';
  51. echo $html;
  52. }
  53. }