dokeos
[ class tree: dokeos ] [ index: dokeos ] [ all elements ]

Source for file blog_admin.php

Documentation is available at blog_admin.php

  1. <?php
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.  
  6.     Copyright (c) 2004-2008 Dokeos SPRL
  7.     Copyright (c) 2003 Ghent University (UGent)
  8.     Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9.     Copyright (c) various contributors
  10.  
  11.     For a full list of contributors, see "credits.txt".
  12.     The full license can be read in "license.txt".
  13.  
  14.     This program is free software; you can redistribute it and/or
  15.     modify it under the terms of the GNU General Public License
  16.     as published by the Free Software Foundation; either version 2
  17.     of the License, or (at your option) any later version.
  18.  
  19.     See the GNU General Public License for more details.
  20.  
  21.     Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  22.     info@dokeos.com
  23.  
  24. ==============================================================================
  25.  
  26.     BLOG HOMEPAGE
  27.  
  28.     This file takes care of all blog navigation and displaying.
  29.  
  30.     @package dokeos.blogs
  31. ==============================================================================
  32. */
  33.  
  34. // name of the language file that needs to be included
  35. $language_file "blog";
  36.  
  37. include('../inc/global.inc.php');
  38. $this_section=SECTION_COURSES;
  39.  
  40. $blog_table_attachment     Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
  41.  
  42. /* ------------    ACCESS RIGHTS ------------ */
  43. // notice for unauthorized people.
  44.  
  45. //------------ ONLY USERS REGISTERED IN THE COURSE----------------------
  46. if((!$is_allowed_in_course || !$is_courseMember&& !api_is_allowed_to_edit())
  47. {
  48.     api_not_allowed(true);//print headers/footers
  49. }
  50.  
  51.  
  52. {
  53.     
  54.     require_once(api_get_path(LIBRARY_PATH"blog.lib.php");    
  55.     $nameTools get_lang("blog_management");    
  56.     
  57.     // showing the header if we are not in the learning path, if we are in
  58.     // the learning path, we do not include the banner so we have to explicitly
  59.     // include the stylesheet, which is normally done in the header
  60.     if ($_GET['origin'!= 'learnpath')
  61.     {
  62.         Display::display_header($nameTools,'Blogs');
  63.     }
  64.     else
  65.     {
  66.         echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$clarolineRepositoryWeb."css/default.css\"/>";
  67.     }
  68.     /*
  69.     ==============================================================================
  70.         PROCESSING..
  71.     ==============================================================================
  72.     */
  73.     if ($_POST['new_blog_submit'])
  74.     {
  75.         Blog::create_blog($_POST['blog_name'],$_POST['blog_subtitle']);
  76.     }
  77.     if ($_POST['edit_blog_submit'])
  78.     {
  79.         Blog::edit_blog($_POST['blog_id'],$_POST['blog_name'],$_POST['blog_subtitle']);
  80.     }
  81.     if ($_GET['action'== 'visibility')
  82.     {
  83.         Blog::change_blog_visibility(mysql_real_escape_string((int)$_GET['blog_id']));
  84.     }
  85.     if ($_GET['action'== 'delete')
  86.     {
  87.         Blog::delete_blog(mysql_real_escape_string((int)$_GET['blog_id']));
  88.     }
  89.     
  90.     
  91.     /*
  92.     ==============================================================================
  93.         DISPLAY
  94.     ==============================================================================
  95.     */
  96.     api_display_tool_title($nameTools);
  97.     //api_introductionsection(TOOL_BLOG);
  98.     
  99.     
  100.         if ($_GET['action'== 'add')
  101.         {
  102.             Blog::display_new_blog_form();
  103.         }
  104.         if ($_GET['action'== 'edit')
  105.         {
  106.             Blog::display_edit_blog_form(mysql_real_escape_string((int)$_GET['blog_id']));
  107.         }
  108.     
  109.         echo "<a href='".api_get_self()."?action=add'>",
  110.         "<img src='../img/blog_new.gif' border=\"0\" align=\"absmiddle\" alt='".get_lang('NewBlog')."'>&nbsp;&nbsp;".get_lang('AddBlog')."</a>";
  111.         echo "<table width=\"100%\" border=\"0\" cellspacing=\"2\" class='data_table'>";
  112.         echo    "<tr>",
  113.                      "<th>",get_lang('Title'),"</th>\n",
  114.                      "<th>",get_lang('Subtitle'),"</th>\n",
  115.                      "<th>",get_lang('Modify'),"</th>\n",
  116.                 "</tr>\n";
  117.         Blog::display_blog_list();
  118.         echo "</table>";            
  119.     }
  120.     else
  121.     {
  122.         api_not_allowed(true);        
  123.     }
  124.  
  125. // Display the footer
  126. ?>

Documentation generated on Thu, 12 Jun 2008 13:01:32 -0500 by phpDocumentor 1.4.1