Help_Page.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. require_once(PATH::PAGE . "Page.php");
  3. /**
  4. * Help page model.
  5. */
  6. class Help_Page extends Page{
  7. private $help = [
  8. "info" => [
  9. "title" => "",
  10. "text" => "",
  11. ],
  12. "license" => [
  13. "title" => "",
  14. "text" => "",
  15. ],
  16. "privacy" => [
  17. "title" => "",
  18. "text" => "",
  19. ],
  20. "cookies" => [
  21. "title" => "",
  22. "text" => "",
  23. ]
  24. ];
  25. /**
  26. * Constructor.
  27. *
  28. * Retrieves the data and initializes the variables.
  29. */
  30. public function __construct(){
  31. parent::__construct();
  32. $this->set_view("help.php");
  33. $this->help["info"]["title"] = Text::get("HELP_INFO_TITLE");
  34. $this->help["info"]["text"] = get_context()->get_user()->get_text("HELP");
  35. $this->help["license"]["title"] = Text::get("HELP_LICENSE_TITLE");
  36. $this->help["license"]["text"] = get_context()->get_user()->get_text("LICENSE");
  37. $this->help["privacy"]["title"] = Text::get("HELP_PRIVACY_TITLE");
  38. $this->help["privacy"]["text"] = get_context()->get_user()->get_text("PRIVACY");
  39. $this->help["cookies"]["title"] = Text::get("HELP_COOKIES_TITLE");
  40. $this->help["cookies"]["text"] = get_context()->get_user()->get_text("COOKIES");
  41. $this->set_title(Text::get("HELP_TITLE"));
  42. $this->set_description(Text::get("HELP_DESCRIPTION") . " - " . Text::get("USER_TAGLINE"));
  43. $this->set_canonical(URL::HELP);
  44. $this->add_css("help.css");
  45. $this->add_js("help.js");
  46. }
  47. /**
  48. * Retrives the text body for a section.
  49. *
  50. * Available sections are "info", "license", "privacy" and "cookies".
  51. *
  52. * @param string $section Section for which to retrieve the text, case insensitive.
  53. * @return The text for the requested section, or an empty string if an invalid section is
  54. * provided or the text is not defined.
  55. */
  56. public function get_section_text($section){
  57. if (isSet($this->help[$section]))
  58. if (isSet($this->help[$section]["text"])) return $this->help[$section]["text"];
  59. return "";
  60. }
  61. /**
  62. * Retrives the title of a section.
  63. *
  64. * Available sections are "info", "license", "privacy" and "cookies".
  65. *
  66. * @param string $section Section for which to retrieve the title, case insensitive.
  67. * @return The title for the requested section, or an empty string if an invalid section
  68. * is provided or the title is not defined.
  69. */
  70. public function get_section_title($section){
  71. if (isSet($this->help[$section]))
  72. if (isSet($this->help[$section]["title"])) return $this->help[$section]["title"];
  73. return "";
  74. }
  75. }
  76. ?>