Person.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. /*
  3. * Copyright (C) 2021 Echedey López Romero <elr@disroot.org>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. class Person {
  19. private $Id;
  20. private $Name;
  21. private $Profile;
  22. private $Gender;
  23. private $Birthday;
  24. private $Origin;
  25. private $Biography;
  26. private $ImageURL;
  27. private $DefaultImage;
  28. public function __construct($Id, $Name, $Profile, $Gender, $Birthday,
  29. $Origin, $Biography, $ImageURL, $DefaultImage) {
  30. $this->Id = $Id;
  31. $this->Name = $Name;
  32. $this->Profile = $Profile;
  33. $this->Gender = $Gender;
  34. $this->Birthday = $Birthday;
  35. $this->Origin = $Origin;
  36. $this->Biography = $Biography;
  37. $this->ImageURL = $ImageURL;
  38. $this->DefaultImage = $DefaultImage;
  39. }
  40. public function RenderContent() {
  41. $HTML = '';
  42. $HTML .= '<div class="col-lg-10 col-12 mx-auto px-0">' . PHP_EOL;
  43. $HTML .= '<div class="container-fluid border border-primary rounded">'
  44. . PHP_EOL;
  45. $HTML .= '<div class="row my-3">' . PHP_EOL;
  46. $HTML .= '<div class="col"></div>' . PHP_EOL;
  47. $HTML .= '<h2 class="col-xl-6 col-lg-4 col-md-5 col-12 mb-lg-0 mb-2 '
  48. . 'text-center">Person</h2>' . PHP_EOL;
  49. $HTML .= '<div class="col text-center">' . PHP_EOL;
  50. $HTML .= '<a class="h-100 btn btn-block btn-secondary t-large" '
  51. . 'href=".">Return</a>' . PHP_EOL;
  52. $HTML .= '</div>' . PHP_EOL;
  53. $HTML .= '</div>' . PHP_EOL;
  54. $HTML .= '<div class="row">' . PHP_EOL;
  55. $HTML .= '<div class="col-lg-4 col-md-6 col-12 mx-auto mb-3">'
  56. . PHP_EOL;
  57. if ($this->Profile !== null && $this->Profile !== '') {
  58. $HTML .= '<img src="' . $this->ImageURL . $this->Profile . '" '
  59. . 'class="d-block w-100 mx-auto" alt="' . $this->Name
  60. . '"/>' . PHP_EOL;
  61. } else {
  62. $HTML .= '<img src="' . $this->DefaultImage . '" class="d-block '
  63. . 'w-100 mx-auto" alt="Not specified"/>' . PHP_EOL;
  64. }
  65. $HTML .= '</div>' . PHP_EOL;
  66. $HTML .= '<div class="col-lg-8 col-12 mb-3">' . PHP_EOL;
  67. $HTML .= '<div class="container-fluid border border-secondary '
  68. . 'rounded">' . PHP_EOL;
  69. $HTML .= '<div class="row my-3">' . PHP_EOL;
  70. $HTML .= '<h3 class="col-12 mb-0">' . PHP_EOL;
  71. $HTML .= $this->Name . PHP_EOL;
  72. $HTML .= '</h3>' . PHP_EOL;
  73. $HTML .= '</div>' . PHP_EOL;
  74. $HTML .= '<div class="row mb-3">' . PHP_EOL;
  75. $HTML .= '<span class="col-sm-6 col-12 mb-sm-0 mb-3"><span '
  76. . 'class="t-large">Gender:</span> ' . PHP_EOL;
  77. $HTML .= $this->Gender . PHP_EOL;
  78. $HTML .= '</span>' . PHP_EOL;
  79. $HTML .= '<span class="col-sm-6 col-12"><span class="t-large">'
  80. . 'Birthday:</span> ' . PHP_EOL;
  81. if ($this->Birthday !== null && $this->Birthday !== '') {
  82. $HTML .= date("d/m/Y",
  83. strtotime(str_replace('-"', '/', $this->Birthday)))
  84. . PHP_EOL;
  85. } else {
  86. $HTML .= 'Not specified' . PHP_EOL;
  87. }
  88. $HTML .= '</span>' . PHP_EOL;
  89. $HTML .= '</div>' . PHP_EOL;
  90. $HTML .= '<div class="row mb-3">' . PHP_EOL;
  91. $HTML .= '<span class="col-12"><span class="t-large">Origin:</span> '
  92. . PHP_EOL;
  93. if ($this->Origin !== null && $this->Origin !== '') {
  94. $HTML .= $this->Origin . PHP_EOL;
  95. } else {
  96. $HTML .= 'Not specified' . PHP_EOL;
  97. }
  98. $HTML .= '</span>' . PHP_EOL;
  99. $HTML .= '</div>' . PHP_EOL;
  100. $HTML .= '<div class="row mb-3">' . PHP_EOL;
  101. $HTML .= '<div class="col-12">' . PHP_EOL;
  102. $HTML .= '<div class="container">' . PHP_EOL;
  103. $HTML .= '<div class="row mb-2">' . PHP_EOL;
  104. $HTML .= '<h4 class="col-12 mb-0 px-0">Biography</h4>' . PHP_EOL;
  105. $HTML .= '</div>' . PHP_EOL;
  106. $HTML .= '<div class="row">' . PHP_EOL;
  107. $HTML .= '<p class="col-12 mb-0 px-0">' . PHP_EOL;
  108. if ($this->Biography !== null && $this->Biography !== '') {
  109. $HTML .= $this->Biography . PHP_EOL;
  110. } else {
  111. $HTML .= 'Not specified' . PHP_EOL;
  112. }
  113. $HTML .= '</p>' . PHP_EOL;
  114. $HTML .= '</div>' . PHP_EOL;
  115. $HTML .= '</div>' . PHP_EOL;
  116. $HTML .= '</div>' . PHP_EOL;
  117. $HTML .= '</div>' . PHP_EOL;
  118. $HTML .= '</div>' . PHP_EOL;
  119. $HTML .= '</div>' . PHP_EOL;
  120. $HTML .= '</div>' . PHP_EOL;
  121. $HTML .= '</div>' . PHP_EOL;
  122. $HTML .= '</div>' . PHP_EOL;
  123. $HTML .= '</div>' . PHP_EOL;
  124. return $HTML;
  125. }
  126. }