faq.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003-2005 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Sally "Example" Programmer (sally@somewhere.net)
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * This script displays a help window.
  23. *
  24. * @package dokeos.help
  25. ==============================================================================
  26. */
  27. // name of the language file that needs to be included
  28. $language_file='help';
  29. $helpName=$_GET['open'];
  30. include('../inc/global.inc.php');
  31. include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  32. $language_code = Database::get_language_isocode($language_interface);
  33. header('Content-Type: text/html; charset='. $charset);
  34. ?>
  35. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  36. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language_code; ?>" lang="<?php echo $language_code; ?>">
  37. <head>
  38. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
  39. <title>
  40. <?php echo get_lang('H'.$helpName); ?>
  41. </title>
  42. <style type="text/css" media="screen, projection">
  43. /*<![CDATA[*/
  44. @import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/public_admin/default.css";
  45. /*]]>*/
  46. </style>
  47. <?php
  48. if(api_get_setting('stylesheets')<>'')
  49. {
  50. ?>
  51. <style type="text/css" media="screen, projection">
  52. /*<![CDATA[*/
  53. @import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
  54. /*]]>*/
  55. </style>
  56. <?php
  57. }
  58. ?>
  59. </head>
  60. <body>
  61. <div style="margin:10px;">
  62. <div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
  63. <h4>
  64. <?php
  65. echo get_lang('Faq');
  66. if(api_is_platform_admin())
  67. {
  68. echo '&nbsp;<a href="faq.php?edit=true"><img src="'.api_get_path(WEB_IMG_PATH).'edit.gif" /></a>';
  69. }
  70. ?>
  71. </h4>
  72. <?php
  73. $faq_file = 'faq.html';
  74. if(!empty($_GET['edit']) && $_GET['edit']=='true' && api_is_platform_admin())
  75. {
  76. $form = new FormValidator('set_faq','post','faq.php?edit=true');
  77. $form -> add_html_editor('faq_content', null, false, false, array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300'));
  78. $form -> addElement('submit','faq_submit', get_lang('Ok'));
  79. $form -> setDefaults(array('faq_content'=>file_get_contents(api_get_path(SYS_PATH).'home/faq.html')));
  80. if($form -> validate())
  81. {
  82. $content = $form -> getSubmitValue('faq_content');
  83. $fpath = api_get_path(SYS_PATH).'home/'.$faq_file;
  84. if(is_file($fpath) && is_writeable($fpath))
  85. {
  86. $fp = fopen(api_get_path(SYS_PATH).'home/'.$faq_file,'w');
  87. fwrite($fp, $content);
  88. fclose($fp);
  89. }
  90. else
  91. {
  92. echo get_lang('WarningFaqFileNonWriteable').'<br />';
  93. }
  94. echo $content;
  95. }
  96. else
  97. {
  98. $form -> display();
  99. }
  100. }
  101. else
  102. {
  103. echo file_get_contents(api_get_path(SYS_PATH).'home/'.$faq_file);
  104. }
  105. ?>
  106. <div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
  107. </div>
  108. </body>
  109. </html>