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

Source for file 3column.php

Documentation is available at 3column.php

  1. <?php
  2.  
  3. // $Id: 3column.php,v 1.2 2006/08/10 14:26:12 pcool Exp $
  4. /*
  5. ==============================================================================
  6.     Dokeos - elearning and course management software
  7.  
  8.     Copyright (c) 2004-2005 Dokeos S.A.
  9.     Copyright (c) 2003 Ghent University
  10.     Copyright (c) 2001 Universite Catholique de Louvain
  11.     Copyright (c) various contributors
  12.     Copyright (c) Bart Mollet, Hogeschool Gent
  13.  
  14.     For a full list of contributors, see "credits.txt".
  15.     The full license can be read in "license.txt".
  16.  
  17.     This program is free software; you can redistribute it and/or
  18.     modify it under the terms of the GNU General Public License
  19.     as published by the Free Software Foundation; either version 2
  20.     of the License, or (at your option) any later version.
  21.  
  22.     See the GNU General Public License for more details.
  23.  
  24.     Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  25.     Mail: info@dokeos.com
  26. ==============================================================================
  27. */
  28. /**
  29. ============================================================================== 
  30. *                  HOME PAGE FOR EACH COURSE (BASIC TOOLS FIXED)
  31. *
  32. *    This page, included in every course's index.php is the home
  33. *    page.To make administration simple, the professor edits his
  34. *    course from it's home page. Only the login detects that the
  35. *    visitor is allowed to activate, deactivate home page links,
  36. *    access to Professor's tools (statistics, edit forums...).
  37. *
  38. *    @package dokeos.course_home
  39. ============================================================================== 
  40. */
  41. $hide = isset($_GET['hide']&& $_GET['hide'== 'yes' 'yes' null;
  42. $restore = isset($_GET['restore']&& $_GET['restore'== 'yes' 'yes' null;
  43. $id  = isset($_GET['id']intval($_GET['id']null;
  44.  
  45. include('../../main/course_home/btf_functions.php');  // RH: extra ../
  46. $is_AllowedToEdit is_allowed_to_edit();  // RH: Allowed is not allowed...
  47.  
  48.  
  49.  
  50. // WORK with data post askable by admin of  course
  51. {
  52. /*  Work request */
  53.  
  54. /*> > > > > > > > > > > > MODIFY HOME PAGE < < < < < < < < < < < <*/
  55.  
  56. /*
  57.  * Edit visibility of tools
  58.  *
  59.  *     visibility = 1 - everybody
  60.  *     visibility = 0 - prof and admin
  61.  *     visibility = 2 - admin
  62.  *
  63.  * Who can change visibility ?
  64.  * 
  65.  *     admin = 0 - prof and admin
  66.  *     admin = 1 - admin
  67.  *
  68.  * Show message to confirm that a tools must be hide from aivailable tools
  69.  *
  70.  *     visibility 0,1->2 - $remove
  71.  * 
  72.  * Process hiding a tools from aivailable tools.
  73.  *
  74.  *     visibility=2                         are only view  by Dokeos
  75.  * Administrator visibility 0,1->2 - $destroy
  76.  *
  77.  *     visibility 1 -> 0 - $hide / $restore
  78.  */
  79.  
  80.     /*
  81.      * diplay message to confirm that a tools must be hide from aivailable tools
  82.      * (visibility 0,1->2)
  83.      */
  84.  
  85.     if($remove)
  86.     {
  87.         $sql "SELECT * FROM $TBL_ACCUEIL WHERE id=$id";
  88.         $result api_sql_query($sql,__FILE__,__LINE__);
  89.         $toolsRow mysql_fetch_array($result);
  90.         $tool_name htmlspecialchars($toolsRow['name'!= "" $toolsRow['name'$toolsRow['link'],ENT_QUOTES,$charset);
  91.         if($toolsRow['img'!= "external.gif")
  92.         {
  93.             $toolsRow['link']=$clarolineRepositoryWeb.$toolsRow['link'];
  94.         }
  95.         $toolsRow['image']=$clarolineRepositoryWeb."img/".$toolsRow['image'];
  96.         
  97.         echo     "<br><br><br>\n";
  98.         echo    "<table class=\"message\" width=\"70%\" align=\"center\">\n",
  99.                 "<tr><td width=\"7%\" align=\"center\">\n",
  100.                    "<a href=\"".$toolsRow['link']."\"><img src=\"",$toolsRow['image'],"\" alt=\"\" align=\"absmiddle\" border=\"0\">","</a></td>\n",
  101.                 "<td width=\"28%\" height=\"45\"><small>\n",
  102.                 "<a href=\"".$toolsRow['link']."\">".$tool_name."</a></small></td>\n";
  103.         echo    "<td align=\"center\">\n",
  104.                 "<font color=\"#ff0000\">",
  105.                 "&nbsp;&nbsp;&nbsp;",
  106.                 "<strong>",get_lang('DelLk'),"</strong>",
  107.                 "<br>&nbsp;&nbsp;&nbsp;\n",
  108.                 "<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
  109.                 "&nbsp;|&nbsp;\n",
  110.                 "<a href=\"".api_get_self()."?destroy=yes&amp;id=$id\">",get_lang('Yes'),"</a>\n",
  111.                 "</font></td></tr>\n",
  112.                 "</table>\n";
  113.         echo     "<br><br><br>\n";
  114.  
  115.     // if remove
  116.  
  117.     /*
  118.      * Process hiding a tools from aivailable tools.
  119.      * visibility=2 are only view  by Dokeos Administrator (visibility 0,1->2)
  120.      */
  121.  
  122.     elseif ($destroy)
  123.     {
  124.         api_sql_query("UPDATE $TBL_ACCUEIL SET visibility='2' WHERE id=$id");
  125.     }
  126.  
  127. /*--------------------------------------
  128.                 HIDE
  129.   --------------------------------------*/
  130.  
  131.     elseif ($hide// visibility 1 -> 0
  132.     {
  133.         api_sql_query("UPDATE $TBL_ACCUEIL SET visibility=0 WHERE id=$id");
  134.         Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
  135.     }
  136.  
  137. /*--------------------------------------
  138.               REACTIVATE
  139.   --------------------------------------*/
  140.  
  141.     elseif ($restore// visibility 0,2 -> 1
  142.     {
  143.         api_sql_query("UPDATE $TBL_ACCUEIL SET visibility=1  WHERE id=$id");
  144.         Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
  145.     }
  146.  
  147.     /*
  148.      * editing "apparance" of  a tools  on the course Home Page.
  149.      */
  150.  
  151.     elseif (isset ($update&& $update)
  152.     {
  153.         $result     api_sql_query("SELECT * FROM $TBL_ACCUEIL WHERE id=$id");
  154.         $toolsRow     mysql_fetch_array($result);
  155.         $racine        $_configuration['root_sys']."/".$currentCourseID."/images/";
  156.         $chemin        $racine;
  157.         $name    $toolsRow[1];
  158.         $image        $toolsRow[3];
  159.  
  160.         echo    "<tr>\n",
  161.  
  162.                 "<td colspan=\"4\">\n",
  163.  
  164.                 "<table>\n",
  165.  
  166.                 "<tr>\n",
  167.                 "<td>\n",
  168.  
  169.                 "<form method=\"post\" action=\"".api_get_self()."\">\n",
  170.                 "<input type=\"hidden\" name=\"id\" value=\"$id\">\n",
  171.                 "Image : <img alt=\"\" src=\"".$image."\" border=\"0\" align=\"absmiddle\">\n",
  172.                 "</td>\n",
  173.  
  174.                 "<td>\n",
  175.                 "<select name=\"image\">\n",
  176.                 "<option selected>",$image,"</option>\n";
  177.  
  178.         if ($dir @opendir($chemin))
  179.         {
  180.             while($file readdir($dir))
  181.             {
  182.                 if($file==".." OR $file==".")
  183.                 {
  184.                     unset($file);
  185.                 }
  186.  
  187.                 echo "<option>",$file,"</option>\n";
  188.  
  189.             }
  190.  
  191.             closedir($dir);
  192.         }
  193.  
  194.         echo    "</select>\n",
  195.  
  196.                 "</td>\n",
  197.                 "</tr>\n",
  198.  
  199.                 "<tr>\n",
  200.                 "<td>",get_lang('NameOfTheLink')," : </td>\n",
  201.                 "<td><input type=\"text\" name=\"name\" value=\"",$name,"\"></td>\n",
  202.                 "</tr>\n",
  203.  
  204.                 "<tr>\n",
  205.                 "<td>Lien :</td>\n",
  206.                 "<td><input type=\"text\" name=\"link\" value=\"",$link,"\"></td>\n",
  207.                 "</tr>\n",
  208.  
  209.                 "<tr>\n",
  210.                 "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"",get_lang('Ok'),"\"></td>\n",
  211.                 "</tr>\n",
  212.  
  213.                 "</form>\n",
  214.  
  215.                 "</table>\n",
  216.  
  217.                 "</td>\n",
  218.                 "</tr>\n";
  219.     }
  220. }
  221.  
  222.  
  223. // work with data post askable by admin of  course
  224.  
  225. if ($is_platformAdmin and is_allowed_to_edit())
  226. {
  227.     // Show message to confirm that a tools must be hide  from aivailable tools
  228.     // visibility 0,1->2
  229.     if($askDelete)
  230.     {
  231.         echo    "<table align=\"center\"><tr>\n",
  232.  
  233.                 "<td colspan=\"4\">\n",
  234.                 "<br><br>\n",
  235.                 "<font color=\"#ff0000\">",
  236.                 "&nbsp;&nbsp;&nbsp;",
  237.                 "<strong>",get_lang('DelLk'),"</strong>",
  238.                 "<br>&nbsp;&nbsp;&nbsp;\n",
  239.                 "<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
  240.                 "&nbsp;|&nbsp;\n",
  241.                 "<a href=\"".api_get_self()."?delete=yes&amp;id=$id\">",get_lang('Yes'),"</a>\n",
  242.                 "</font>\n",
  243.                 "<br><br><br>\n",
  244.                 "</td>\n",
  245.  
  246.                 "</tr>",
  247.                 "</table>\n";
  248.     // if remove
  249.  
  250.     /*
  251.      * Process hiding a tools from aivailable tools.
  252.      * visibility=2 are only viewed by Dokeos Administrator visibility 0,1->2
  253.      */
  254.  
  255.     elseif (isset($delete&& $delete)
  256.     {
  257.         api_sql_query("DELETE FROM $TBL_ACCUEIL WHERE id=$id AND added_tool=1");
  258.     }
  259. }
  260.  
  261.  
  262. echo "<table class=\"item\" align=\"center\" border=\"0\" width=\"95%\">\n";
  263.  
  264. /*==========================
  265.      TOOLS  FOR  EVERYBODY
  266.   ==========================*/
  267.  
  268. echo    "<tr>\n<td colspan=\"6\">&nbsp;</td>\n</tr>\n";
  269. echo    "<tr>\n<td colspan=\"6\">";
  270. showtools2('Basic');
  271. showtools2('External');
  272. echo     "</td>\n</tr>\n";
  273.  
  274.  
  275. /*==========================
  276.        PROF ONLY VIEW
  277.   ==========================*/
  278.  
  279. {
  280.     echo    "<tr><td colspan=\"6\"><hr noshade size=\"1\" /></td></tr>\n",
  281.             "<tr>\n","<td colspan=\"6\">\n",
  282.             "<font color=\"#F66105\">\n",get_lang('CourseAdminOnly'),"</font>\n",
  283.             "</td>\n","</tr>\n";
  284.     echo    "<tr>\n<td colspan=\"6\">";
  285.     showtools2('courseAdmin');
  286.     echo     "</td>\n</tr>\n";
  287. }
  288.  
  289.  
  290. /*--------------------------------------
  291.        TOOLS FOR PLATFORM ADMIN ONLY
  292.   --------------------------------------*/
  293.  
  294. if ($is_platformAdmin and is_allowed_to_edit())
  295. {
  296.     echo    "<tr>","<td colspan=\"6\">",
  297.             "<hr noshade size=\"1\" />",
  298.             "</td>","</tr>\n",
  299.             "<tr>\n","<td colspan=\"6\">\n",
  300.             "<font color=\"#F66105\" >",get_lang('PlatformAdminOnly'),"</font>\n",
  301.             "</td>\n","</tr>\n";
  302.     echo    "<tr>\n<td colspan=\"6\">";
  303.     showtools2('claroAdmin');
  304.     echo     "</td>\n</tr>\n";
  305. }
  306.  
  307. echo    "</table>\n";
  308. ?>

Documentation generated on Thu, 12 Jun 2008 12:53:11 -0500 by phpDocumentor 1.4.1