Dokeos PHP Cross Reference Learning Management Systems

Source: /main/course_home/3column.php - 295 lines - 9147 bytes - Summary - Text - Print

Description: HOME PAGE FOR EACH COURSE

   1  <?php // $Id: 3column.php,v 1.2 2006/08/10 14:26:12 pcool Exp $
   2  /*
   3  ==============================================================================
   4      Dokeos - elearning and course management software
   5  
   6      Copyright (c) Dokeos SPRL
   7  
   8      For a full list of contributors, see "credits.txt".
   9      For licensing terms, see "dokeos_license.txt"
  10  
  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  
  16      See the GNU General Public License for more details.
  17  
  18      http://www.dokeos.com
  19  ==============================================================================
  20  */
  21  
  22  /**
  23  ==============================================================================
  24  *                  HOME PAGE FOR EACH COURSE
  25  *
  26  *    This page, included in every course's index.php is the home
  27  *    page. To make administration simple, the teacher edits his
  28  *    course from the home page. Only the login detects that the
  29  *    visitor is allowed to activate, deactivate home page links,
  30  *    access to the teachers tools (statistics, edit forums...).
  31  *
  32  *    @package dokeos.course_home
  33  ==============================================================================
  34  */
  35  
  36  // header
  37  Display::display_header($course_title, "Home");
  38  
  39  //statistics
  40  if (!isset($coursesAlreadyVisited[$_cid])) {
  41      event_access_course();
  42      $coursesAlreadyVisited[$_cid] = 1;
  43      api_session_register('coursesAlreadyVisited');
  44  }
  45  
  46  // database table definition
  47  $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  48  
  49  $temps = time();
  50  $reqdate = "&reqdate=$temps";
  51  
  52  
  53  //display course title for course home page (similar to toolname for tool pages)
  54  //echo '<h3>'.api_display_tool_title($nameTools) . '</h3>';
  55  
  56  // introduction section
  57  Display::display_introduction_section(TOOL_COURSE_HOMEPAGE, array(
  58          'CreateDocumentWebDir' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/',
  59          'CreateDocumentDir' => 'document/',
  60          'BaseHref' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/'
  61      )
  62  );
  63  
  64  $hide = isset($_GET['hide']) && $_GET['hide'] == 'yes' ? 'yes' : null;
  65  $restore = isset($_GET['restore']) && $_GET['restore'] == 'yes' ? 'yes' : null;
  66  $id  = isset($_GET['id']) ? intval($_GET['id']) : null;
  67  
  68  // Database table definitions
  69  $TABLE_TOOLS = Database::get_main_table(TABLE_MAIN_COURSE_MODULE);
  70  $TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
  71  
  72  // action handling
  73  if (api_is_allowed_to_edit(null,true))
  74  {
  75      // display message to confirm that a tool must be hidden from the list of available tools (visibility 0,1->2)
  76      if($remove)
  77      {
  78          $sql = "SELECT * FROM $TBL_ACCUEIL WHERE id='".Database::escape_string($id)."'";
  79          $result = Database::query($sql,__FILE__,__LINE__);
  80          $toolsRow = Database::fetch_array($result);
  81          $tool_name = htmlspecialchars($toolsRow['name'] != "" ? $toolsRow['name'] : $toolsRow['link'],ENT_QUOTES,$charset);
  82          if($toolsRow['img'] != "external.gif")
  83          {
  84              $toolsRow['link']=api_get_path(WEB_CODE_PATH).$toolsRow['link'];
  85          }
  86          $toolsRow['image']=api_get_path(WEB_CODE_PATH)."img/".$toolsRow['image'];
  87  
  88          echo     "<br><br><br>\n";
  89          echo    "<table class=\"message\" width=\"70%\" align=\"center\">\n",
  90                  "<tr><td width=\"7%\" align=\"center\">\n",
  91                     "<a href=\"".$toolsRow['link']."\">".Display::return_icon($toolsRow['image'], get_lang('Delete')),"</a></td>\n",
  92                  "<td width=\"28%\" height=\"45\"><small>\n",
  93                  "<a href=\"".$toolsRow['link']."\">".$tool_name."</a></small></td>\n";
  94          echo    "<td align=\"center\">\n",
  95                  "<font color=\"#ff0000\">",
  96                  "&nbsp;&nbsp;&nbsp;",
  97                  "<strong>",get_lang('DelLk'),"</strong>",
  98                  "<br>&nbsp;&nbsp;&nbsp;\n",
  99                  "<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
 100                  "&nbsp;|&nbsp;\n",
 101                  "<a href=\"".api_get_self()."?destroy=yes&amp;id=$id\">",get_lang('Yes'),"</a>\n",
 102                  "</font></td></tr>\n",
 103                  "</table>\n";
 104          echo     "<br><br><br>\n";
 105  
 106      }
 107      // remove tool (visibility 0,1->2)
 108      elseif ($destroy)
 109      {
 110          change_tool_visibility($id,0);
 111      }
 112      // make tool invisible (visibility 1,2->0)
 113      elseif ($hide)
 114      {
 115          change_tool_visibility($id,0);
 116          Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
 117      }
 118      // make tool visible (visibility 0,2->1)
 119      elseif ($restore)
 120      {
 121          change_tool_visibility($id,1);
 122          Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
 123      }
 124  
 125      /*
 126       * editing "apparance" of  a tools  on the course Home Page.
 127       */
 128  
 129      elseif (isset ($update) && $update)
 130      {
 131          $result     = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE id=$id");
 132          $toolsRow     = Database::fetch_array($result);
 133          $racine        = $_configuration['root_sys']."/".$currentCourseID."/images/";
 134          $chemin        = $racine;
 135          $name    = $toolsRow[1];
 136          $image        = $toolsRow[3];
 137  
 138          echo    "<tr>\n",
 139                  "<td colspan=\"4\">\n",
 140                  "<table>\n",
 141                  "<tr>\n",
 142                  "<td>\n",
 143                  "<form method=\"post\" action=\"".api_get_self()."\">\n",
 144                  "<input type=\"hidden\" name=\"id\" value=\"$id\">\n",
 145                  "Image : ".Display::return_icon($image)."\n",
 146                  "</td>\n",
 147                  "<td>\n",
 148                  "<select name=\"image\">\n",
 149                  "<option selected>",$image,"</option>\n";
 150  
 151          if ($dir = @opendir($chemin))
 152          {
 153              while($file = readdir($dir))
 154              {
 155                  if($file==".." OR $file==".")
 156                  {
 157                      unset($file);
 158                  }
 159  
 160                  echo "<option>",$file,"</option>\n";
 161  
 162              }
 163  
 164              closedir($dir);
 165          }
 166  
 167          echo    "</select>\n",
 168                  "</td>\n",
 169                  "</tr>\n",
 170                  "<tr>\n",
 171                  "<td>",get_lang('NameOfTheLink')," : </td>\n",
 172                  "<td><input type=\"text\" name=\"name\" value=\"",$name,"\"></td>\n",
 173                  "</tr>\n",
 174                  "<tr>\n",
 175                  "<td>Lien :</td>\n",
 176                  "<td><input type=\"text\" name=\"link\" value=\"",$link,"\"></td>\n",
 177                  "</tr>\n",
 178                  "<tr>\n",
 179                  "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"",get_lang('Ok'),"\"></td>\n",
 180                  "</tr>\n",
 181                  "</form>\n",
 182                  "</table>\n",
 183                  "</td>\n",
 184                  "</tr>\n";
 185      }
 186  }
 187  
 188  
 189  // work with data post askable by admin of  course
 190  
 191  if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_course_coach())
 192  {
 193      // Show message to confirm that a tools must be hide  from aivailable tools
 194      // visibility 0,1->2
 195      if($askDelete)
 196      {
 197          echo    "<table align=\"center\"><tr>\n",
 198                  "<td colspan=\"4\">\n",
 199                  "<br><br>\n",
 200                  "<font color=\"#ff0000\">",
 201                  "&nbsp;&nbsp;&nbsp;",
 202                  "<strong>",get_lang('DelLk'),"</strong>",
 203                  "<br>&nbsp;&nbsp;&nbsp;\n",
 204                  "<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
 205                  "&nbsp;|&nbsp;\n",
 206                  "<a href=\"".api_get_self()."?delete=yes&amp;id=$id\">",get_lang('Yes'),"</a>\n",
 207                  "</font>\n",
 208                  "<br><br><br>\n",
 209                  "</td>\n",
 210                  "</tr>",
 211                  "</table>\n";
 212      } // if remove
 213  
 214      /*
 215       * Process hiding a tools from aivailable tools.
 216       * visibility=2 are only viewed by Dokeos Administrator visibility 0,1->2
 217       */
 218  
 219      elseif (isset($delete) && $delete)
 220      {
 221          Database::query("DELETE FROM $TBL_ACCUEIL WHERE id='".Database::escape_string($id)."' AND added_tool=1");
 222      }
 223  }
 224  
 225  
 226  //echo "<div class='actions' style='width:100%;margin: 25px auto 10px;'><table class=\"item\" align=\"center\" border=\"0\" width=\"95%\">\n";
 227  
 228  /*
 229  -----------------------------------------------------------
 230      Tools for everybody
 231  -----------------------------------------------------------
 232  */
 233  /*echo    "<tr>\n<td colspan=\"6\">&nbsp;</td>\n</tr>\n";
 234  echo    "<tr>\n<td colspan=\"6\">";
 235  showtools2('Basic');
 236  showtools2('External');
 237  echo     "</td>\n</tr>\n";*/
 238  
 239  echo '<div class="section main_activity"><span class="sectiontitle">'.get_lang('Basic').'</span><table>';
 240  showtools2('Basic');
 241  showtools2('External');
 242  echo '</table></div>';
 243  
 244  
 245  /*
 246  -----------------------------------------------------------
 247      Tools for course admin only
 248  -----------------------------------------------------------
 249  */
 250  /*if (api_is_allowed_to_edit(null,true) && !api_is_coach())
 251  {
 252      echo    "<tr><td colspan=\"6\"><hr noshade size=\"1\" /></td></tr>\n",
 253              "<tr>\n","<td colspan=\"6\">\n",
 254              "<font color=\"#F66105\">\n",get_lang('CourseAdminOnly'),"</font>\n",
 255              "</td>\n","</tr>\n";
 256      echo    "<tr>\n<td colspan=\"6\">";
 257      showtools2('courseAdmin');
 258      echo     "</td>\n</tr>\n";
 259  }*/
 260  
 261  if (api_is_allowed_to_edit(null,true) && !api_is_course_coach())
 262  {
 263  echo '<div class="section main_activity"><span class="sectiontitle">'.get_lang('CourseAdminOnly').'</span><table>';
 264  showtools2('courseAdmin');
 265  echo '</table></div>';
 266  }
 267  
 268  
 269  /*
 270  -----------------------------------------------------------
 271      Tools for platform admin only
 272  -----------------------------------------------------------
 273  */
 274  /*if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_coach())
 275  {
 276      echo    "<tr>","<td colspan=\"6\">",
 277              "<hr noshade size=\"1\" />",
 278              "</td>","</tr>\n",
 279              "<tr>\n","<td colspan=\"6\">\n",
 280              "<font color=\"#F66105\" >",get_lang('PlatformAdminOnly'),"</font>\n",
 281              "</td>\n","</tr>\n";
 282      echo    "<tr>\n<td colspan=\"6\">";
 283      showtools2('platformAdmin');
 284      echo     "</td>\n</tr>\n";
 285  }
 286  
 287  echo    "</table></div>\n";*/
 288  
 289  if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_course_coach())
 290  {
 291  echo '<div class="section main_activity"><span class="sectiontitle">'.get_lang('PlatformAdminOnly').'</span><table>';
 292  showtools2('platformAdmin');
 293  echo '</table></div>';
 294  }
 295  ?>

title

Description

title

Description

title

Description

title

title

Body