blog_admin.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  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: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. BLOG HOMEPAGE
  19. This file takes care of all blog navigation and displaying.
  20. @package dokeos.blogs
  21. ==============================================================================
  22. */
  23. // name of the language file that needs to be included
  24. $language_file = "blog";
  25. include('../inc/global.inc.php');
  26. require_once(api_get_path(LIBRARY_PATH) . "blog.lib.php");
  27. $nameTools = get_lang("blog_management");
  28. // showing the header if we are not in the learning path, if we are in
  29. // the learning path, we do not include the banner so we have to explicitly
  30. // include the stylesheet, which is normally done in the header
  31. if ($_GET['origin'] != 'learnpath')
  32. {
  33. Display::display_header($nameTools,'Blogs');
  34. }
  35. else
  36. {
  37. echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$clarolineRepositoryWeb."css/default.css\"/>";
  38. }
  39. /*
  40. ==============================================================================
  41. PROCESSING..
  42. ==============================================================================
  43. */
  44. if ($_POST['new_blog_submit'])
  45. {
  46. Blog::create_blog($_POST['blog_name'],$_POST['blog_subtitle']);
  47. }
  48. if ($_POST['edit_blog_submit'])
  49. {
  50. Blog::edit_blog($_POST['blog_id'],$_POST['blog_name'],$_POST['blog_subtitle']);
  51. }
  52. if ($_GET['action'] == 'visibility')
  53. {
  54. Blog::change_blog_visibility(mysql_real_escape_string((int)$_GET['blog_id']));
  55. }
  56. if ($_GET['action'] == 'delete')
  57. {
  58. Blog::delete_blog(mysql_real_escape_string((int)$_GET['blog_id']));
  59. }
  60. /*
  61. ==============================================================================
  62. DISPLAY
  63. ==============================================================================
  64. */
  65. api_display_tool_title($nameTools);
  66. //api_introductionsection(TOOL_BLOG);
  67. if ($_GET['action'] == 'add')
  68. {
  69. Blog::display_new_blog_form();
  70. }
  71. if ($_GET['action'] == 'edit')
  72. {
  73. Blog::display_edit_blog_form(mysql_real_escape_string((int)$_GET['blog_id']));
  74. }
  75. echo "<a href='".api_get_self()."?action=add'>",
  76. "<img src='../img/blog_new.gif' border=\"0\" align=\"absmiddle\" alt='".get_lang('NewBlog')."'>&nbsp;&nbsp;".get_lang('AddBlog')."</a>";
  77. echo "<table width=\"100%\" border=\"0\" cellspacing=\"2\" class='data_table'>";
  78. echo "<tr>",
  79. "<th>",get_lang('Title'),"</th>\n",
  80. "<th>",get_lang('Subtitle'),"</th>\n",
  81. "<th>",get_lang('Modify'),"</th>\n",
  82. "</tr>\n";
  83. Blog::display_blog_list();
  84. echo "</table>";
  85. // Display the footer
  86. Display::display_footer();
  87. ?>