faq.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. /*
  67. -----------------------------------------------------------
  68. FAQ configuration settings
  69. -----------------------------------------------------------
  70. */
  71. $fck_attribute['Width'] = '100%';
  72. $fck_attribute['Height'] = '300';
  73. $fck_attribute['ToolbarSet'] = 'FAQ';
  74. //
  75. if(api_is_platform_admin())
  76. {
  77. echo '&nbsp;<a href="faq.php?edit=true"><img src="'.api_get_path(WEB_IMG_PATH).'edit.gif" /></a>';
  78. }
  79. ?>
  80. </h4>
  81. <?php
  82. $faq_file = 'faq.html';
  83. if(!empty($_GET['edit']) && $_GET['edit']=='true' && api_is_platform_admin())
  84. {
  85. $form = new FormValidator('set_faq','post','faq.php?edit=true');
  86. $form -> add_html_editor('faq_content',null, false);
  87. $form -> addElement('submit','faq_submit', get_lang('Ok'));
  88. $form -> setDefaults(array('faq_content'=>file_get_contents(api_get_path(SYS_PATH).'home/faq.html')));
  89. if($form -> validate())
  90. {
  91. $content = $form -> getSubmitValue('faq_content');
  92. $fpath = api_get_path(SYS_PATH).'home/'.$faq_file;
  93. if(is_file($fpath) && is_writeable($fpath))
  94. {
  95. $fp = fopen(api_get_path(SYS_PATH).'home/'.$faq_file,'w');
  96. fwrite($fp, $content);
  97. fclose($fp);
  98. }
  99. else
  100. {
  101. echo get_lang('WarningFaqFileNonWriteable').'<br />';
  102. }
  103. echo $content;
  104. }
  105. else
  106. {
  107. $form -> display();
  108. }
  109. }
  110. else
  111. {
  112. echo file_get_contents(api_get_path(SYS_PATH).'home/'.$faq_file);
  113. }
  114. ?>
  115. <div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
  116. </div>
  117. </body>
  118. </html>