Task #761 - Course homepage: Revision, coding conventions, cleaning for all the files.

skala
Ivan Tcholakov 15 years ago
parent 1f64f4f7ed
commit 4f978ed93e
  1. 172
      main/course_home/2column.php
  2. 380
      main/course_home/3column.php
  3. 167
      main/course_home/activity.php
  4. 118
      main/course_home/course_home.php
  5. 3
      main/inc/lib/course_home.lib.php

@ -1,51 +1,39 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* HOME PAGE FOR EACH COURSE
*
* This page, included in every course's index.php is the home
* page. To make administration simple, the teacher edits his
* course from the home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to the teachers tools (statistics, edit forums...).
*
* @package dokeos.course_home
==============================================================================
*/
* HOME PAGE FOR EACH COURSE
*
* This page, included in every course's index.php is the home
* page. To make administration simple, the teacher edits his
* course from the home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to the teachers tools (statistics, edit forums...).
*
* @package chamilo.course_home
*/
require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
/*
==============================================================================
MAIN CODE
==============================================================================
*/
/*
-----------------------------------------------------------
Work with data post askable by admin of course (franglais, clean this)
-----------------------------------------------------------
*/
/* MAIN CODE */
/* Work with data post askable by admin of course (franglais, clean this) */
if (api_is_allowed_to_edit(null,true)) {
/* Work request */
/*
-----------------------------------------------------------
Modify home page
-----------------------------------------------------------
*/
/* Processing request */
/* Modify home page */
/*
* display message to confirm that a tool must be hidden from the list of available tools
* (visibility 0,1->2)
* Display message to confirm that a tool must be hidden from the list of available tools (visibility 0,1->2)
*/
if($_GET["remove"])
{
$msgDestroy=get_lang('DelLk').'<br />';
$msgDestroy.='<a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;';
$msgDestroy.='<a href="'.api_get_self().'?destroy=yes&amp;id='.$_GET["id"].'">'.get_lang('Yes').'</a>';
Display :: display_confirmation_message($msgDestroy,false);
if ($_GET['remove']) {
$msgDestroy = get_lang('DelLk').'<br />';
$msgDestroy .= '<a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;';
$msgDestroy .= '<a href="'.api_get_self().'?destroy=yes&amp;id='.$_GET["id"].'">'.get_lang('Yes').'</a>';
Display :: display_confirmation_message($msgDestroy, false);
}
/*
@ -53,50 +41,39 @@ if (api_is_allowed_to_edit(null,true)) {
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
*/
elseif ($_GET["destroy"])
{
elseif ($_GET['destroy']) {
Database::query("UPDATE $tool_table SET visibility='2' WHERE id='".$_GET["id"]."'");
}
/*
-----------------------------------------------------------
HIDE
-----------------------------------------------------------
*/
elseif ($_GET["hide"]) // visibility 1 -> 0
{
/* HIDE */
elseif ($_GET['hide']) { // visibility 1 -> 0
Database::query("UPDATE $tool_table SET visibility=0 WHERE id='".$_GET["id"]."'");
Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
}
/*
-----------------------------------------------------------
REACTIVATE
-----------------------------------------------------------
*/
elseif ($_GET["restore"]) // visibility 0,2 -> 1
{
/* REACTIVATE */
elseif ($_GET["restore"]) { // visibility 0,2 -> 1
Database::query("UPDATE $tool_table SET visibility=1 WHERE id='".$_GET["id"]."'");
Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
}
}
// work with data post askable by admin of course
// Work with data post askable by admin of course
if (api_is_platform_admin())
{
if (api_is_platform_admin()) {
// Show message to confirm that a tools must be hide from available tools
// visibility 0,1->2
if($_GET["askDelete"])
{
?>
if ($_GET['askDelete']) {
?>
<div id="toolhide">
<?php echo get_lang("DelLk"); ?>
<?php echo get_lang('DelLk'); ?>
<br />&nbsp;&nbsp;&nbsp;
<a href="<?php echo api_get_self(); ?>"><?php echo get_lang("No"); ?></a>&nbsp;|&nbsp;
<a href="<?php echo api_get_self(); ?>?delete=yes&id=<?php echo $_GET["id"]; ?>"><?php echo get_lang("Yes"); ?></a>
<a href="<?php echo api_get_self(); ?>"><?php echo get_lang('No'); ?></a>&nbsp;|&nbsp;
<a href="<?php echo api_get_self(); ?>?delete=yes&id=<?php echo $_GET["id"]; ?>"><?php echo get_lang('Yes'); ?></a>
</div>
<?php
<?php
}
/*
@ -104,53 +81,39 @@ if (api_is_platform_admin())
* visibility=2 are only view by Dokeos Administrator visibility 0,1->2
*/
elseif (isset($_GET["delete"]) && $_GET["delete"])
{
elseif (isset($_GET['delete']) && $_GET['delete']) {
Database::query("DELETE FROM $tool_table WHERE id='$id' AND added_tool=1");
}
}
/*
==============================================================================
TOOLS VISIBLE FOR EVERYBODY
==============================================================================
*/
/* TOOLS VISIBLE FOR EVERYBODY */
echo "<div class=\"everybodyview\">";
echo "<table width=\"100%\">";
echo '<div class="everybodyview">';
echo '<table width="100%">';
CourseHome::show_tool_2column(TOOL_PUBLIC);
echo "</table>";
echo "</div>";
echo '</table>';
echo '</div>';
/*
==============================================================================
COURSE ADMIN ONLY VIEW
==============================================================================
*/
/* COURSE ADMIN ONLY VIEW */
// start of tools for CourseAdmins (teachers/tutors)
if (api_is_allowed_to_edit(null,true) && !api_is_coach()) {
echo "<div class=\"courseadminview\">";
echo "<span class=\"viewcaption\">";
echo get_lang("CourseAdminOnly");
echo "</span>";
echo "<table width=\"100%\">";
// Start of tools for CourseAdmins (teachers/tutors)
if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
echo "<div class=\"courseadminview\">";
echo "<span class=\"viewcaption\">";
echo get_lang("CourseAdminOnly");
echo "</span>";
echo "<table width=\"100%\">";
CourseHome::show_tool_2column(TOOL_COURSE_ADMIN);
/*
-----------------------------------------------------------
INACTIVE TOOLS - HIDDEN (GREY) LINKS
-----------------------------------------------------------
*/
/* INACTIVE TOOLS - HIDDEN (GREY) LINKS */
echo "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n",
"<tr>\n",
"<td colspan=\"4\">\n",
"<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n",get_lang("InLnk"),"</font></div>",
"<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n", get_lang('InLnk'), "</font></div>",
"</td>\n",
"</tr>\n";
@ -160,22 +123,17 @@ if (api_is_allowed_to_edit(null,true) && !api_is_coach()) {
echo "</div> ";
}
/*
-----------------------------------------------------------
Tools for platform admin only
-----------------------------------------------------------
*/
/* Tools for platform admin only */
if (api_is_platform_admin() && api_is_allowed_to_edit(null,true) && !api_is_coach()) {
?>
if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
?>
<div class="platformadminview">
<span class="viewcaption"><?php echo get_lang("PlatformAdminOnly"); ?></span>
<span class="viewcaption"><?php echo get_lang('PlatformAdminOnly'); ?></span>
<table width="100%">
<?php
<?php
CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN);
?>
?>
</table>
</div>
<?php
<?php
}
?>

@ -1,211 +1,195 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* HOME PAGE FOR EACH COURSE (BASIC TOOLS FIXED)
*
* This page, included in every course's index.php is the home
* page.To make administration simple, the professor edits his
* course from it's home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to Professor's tools (statistics, edit forums...).
*
* @package dokeos.course_home
==============================================================================
*/
* HOME PAGE FOR EACH COURSE (BASIC TOOLS FIXED)
*
* This page, included in every course's index.php is the home
* page.To make administration simple, the professor edits his
* course from it's home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to Professor's tools (statistics, edit forums...).
*
* @package chamilo.course_home
*/
require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
$hide = isset($_GET['hide']) && $_GET['hide'] == 'yes' ? 'yes' : null;
$restore = isset($_GET['restore']) && $_GET['restore'] == 'yes' ? 'yes' : null;
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$TABLE_TOOLS = Database::get_main_table(TABLE_MAIN_COURSE_MODULE);
$TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
// WORK with data post askable by admin of course
if (api_is_allowed_to_edit(null,true)) {
/* Work request */
// WORK with data post askable by admin of course
if (api_is_allowed_to_edit(null, true)) {
/*> > > > > > > > > > > > MODIFY HOME PAGE < < < < < < < < < < < <*/
/* Processing request */
/*
* Edit visibility of tools
*
* visibility = 1 - everybody
* visibility = 0 - prof and admin
* visibility = 2 - admin
*
* Who can change visibility ?
*
* admin = 0 - prof and admin
* admin = 1 - admin
*
* Show message to confirm that a tools must be hide from aivailable tools
*
* visibility 0,1->2 - $remove
*
* Process hiding a tools from aivailable tools.
*
* visibility=2 are only view by Dokeos
* Administrator visibility 0,1->2 - $destroy
*
* visibility 1 -> 0 - $hide / $restore
*/
/* MODIFY HOME PAGE */
/*
* diplay message to confirm that a tools must be hide from aivailable tools
* Edit visibility of tools
*
* visibility = 1 - everybody
* visibility = 0 - prof and admin
* visibility = 2 - admin
*
* Who can change visibility ?
*
* admin = 0 - prof and admin
* admin = 1 - admin
*
* Show message to confirm that a tools must be hide from aivailable tools
*
* visibility 0,1->2 - $remove
*
* Process hiding a tools from aivailable tools.
*
* visibility=2 are only view by Dokeos
* Administrator visibility 0,1->2 - $destroy
*
* visibility 1 -> 0 - $hide / $restore
*/
/*
* Diplay message to confirm that a tools must be hide from aivailable tools
* (visibility 0,1->2)
*/
if($remove)
{
if ($remove) {
$sql = "SELECT * FROM $TBL_ACCUEIL WHERE id=$id";
$result = Database::query($sql);
$toolsRow = Database::fetch_array($result);
$tool_name = htmlspecialchars($toolsRow['name'] != "" ? $toolsRow['name'] : $toolsRow['link'],ENT_QUOTES,$charset);
if($toolsRow['img'] != "external.gif")
{
$toolsRow['link']=api_get_path(WEB_CODE_PATH).$toolsRow['link'];
$tool_name = @htmlspecialchars($toolsRow['name'] != '' ? $toolsRow['name'] : $toolsRow['link'], ENT_QUOTES, api_get_system_encoding());
if ($toolsRow['img'] != 'external.gif') {
$toolsRow['link'] = api_get_path(WEB_CODE_PATH).$toolsRow['link'];
}
$toolsRow['image']=api_get_path(WEB_CODE_PATH)."img/".$toolsRow['image'];
echo "<br><br><br>\n";
echo "<table class=\"message\" width=\"70%\" align=\"center\">\n",
"<tr><td width=\"7%\" align=\"center\">\n",
"<a href=\"".$toolsRow['link']."\">".Display::return_icon($toolsRow['image'], get_lang('Delete')),"</a></td>\n",
"<td width=\"28%\" height=\"45\"><small>\n",
"<a href=\"".$toolsRow['link']."\">".$tool_name."</a></small></td>\n";
echo "<td align=\"center\">\n",
"<font color=\"#ff0000\">",
"&nbsp;&nbsp;&nbsp;",
"<strong>",get_lang('DelLk'),"</strong>",
"<br>&nbsp;&nbsp;&nbsp;\n",
"<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
"&nbsp;|&nbsp;\n",
"<a href=\"".api_get_self()."?destroy=yes&amp;id=$id\">",get_lang('Yes'),"</a>\n",
"</font></td></tr>\n",
"</table>\n";
echo "<br><br><br>\n";
} // if remove
/*
* Process hiding a tools from aivailable tools.
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
*/
$toolsRow['image'] = api_get_path(WEB_IMG_PATH).$toolsRow['image'];
echo "<br /><br /><br />\n";
echo "<table class=\"message\" width=\"70%\" align=\"center\">\n",
"<tr><td width=\"7%\" align=\"center\">\n",
"<a href=\"".$toolsRow['link']."\">".Display::return_icon($toolsRow['image'], get_lang('Delete')), "</a></td>\n",
"<td width=\"28%\" height=\"45\"><small>\n",
"<a href=\"".$toolsRow['link']."\">".$tool_name."</a></small></td>\n";
echo "<td align=\"center\">\n",
"<font color=\"#ff0000\">",
"&nbsp;&nbsp;&nbsp;",
"<strong>", get_lang('DelLk'), "</strong>",
"<br />&nbsp;&nbsp;&nbsp;\n",
"<a href=\"".api_get_self()."\">", get_lang('No'), "</a>\n",
"&nbsp;|&nbsp;\n",
"<a href=\"".api_get_self()."?destroy=yes&amp;id=$id\">", get_lang('Yes'), "</a>\n",
"</font></td></tr>\n",
"</table>\n";
echo "<br /><br /><br />\n";
} // if remove
elseif ($destroy)
{
Database::query("UPDATE $TBL_ACCUEIL SET visibility='2' WHERE id=$id");
}
/*
* Process hiding a tools from aivailable tools.
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
*/
/*--------------------------------------
HIDE
--------------------------------------*/
elseif ($destroy) {
Database::query("UPDATE $TBL_ACCUEIL SET visibility='2' WHERE id=$id");
}
elseif ($hide) // visibility 1 -> 0
{
Database::query("UPDATE $TBL_ACCUEIL SET visibility=0 WHERE id=$id");
Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
}
/* HIDE */
/*--------------------------------------
REACTIVATE
--------------------------------------*/
elseif ($hide) { // visibility 1 -> 0
Database::query("UPDATE $TBL_ACCUEIL SET visibility=0 WHERE id=$id");
Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
}
elseif ($restore) // visibility 0,2 -> 1
{
Database::query("UPDATE $TBL_ACCUEIL SET visibility=1 WHERE id=$id");
Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
}
/* REACTIVATE */
/*
* editing "apparance" of a tools on the course Home Page.
*/
elseif ($restore) { // visibility 0,2 -> 1
Database::query("UPDATE $TBL_ACCUEIL SET visibility=1 WHERE id=$id");
Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
}
elseif (isset ($update) && $update)
{
$result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE id=$id");
$toolsRow = Database::fetch_array($result);
$racine = $_configuration['root_sys']."/".$currentCourseID."/images/";
$chemin = $racine;
$name = $toolsRow[1];
$image = $toolsRow[3];
echo "<tr>\n",
"<td colspan=\"4\">\n",
"<table>\n",
"<tr>\n",
"<td>\n",
"<form method=\"post\" action=\"".api_get_self()."\">\n",
"<input type=\"hidden\" name=\"id\" value=\"$id\">\n",
"Image : ".Display::return_icon($image)."\n",
"</td>\n",
"<td>\n",
"<select name=\"image\">\n",
"<option selected>",$image,"</option>\n";
if ($dir = @opendir($chemin))
{
while($file = readdir($dir))
{
if($file==".." OR $file==".")
{
unset($file);
}
echo "<option>",$file,"</option>\n";
/*
* Editing "apparance" of a tools on the course Home Page.
*/
elseif (isset($update) && $update) {
$result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE id=$id");
$toolsRow = Database::fetch_array($result);
$racine = $_configuration['root_sys'].'/'.$currentCourseID.'/images/';
$chemin = $racine;
$name = $toolsRow[1];
$image = $toolsRow[3];
echo "<tr>\n",
"<td colspan=\"4\">\n",
"<table>\n",
"<tr>\n",
"<td>\n",
"<form method=\"post\" action=\"".api_get_self()."\">\n",
"<input type=\"hidden\" name=\"id\" value=\"$id\">\n",
"Image : ".Display::return_icon($image)."\n",
"</td>\n",
"<td>\n",
"<select name=\"image\">\n",
"<option selected>", $image, "</option>\n";
if ($dir = @opendir($chemin)) {
while ($file = readdir($dir)) {
if ($file== '..' || $file == '.') {
unset($file);
}
closedir($dir);
echo "<option>", $file, "</option>\n";
}
closedir($dir);
}
echo "</select>\n",
"</td>\n",
"</tr>\n",
"<tr>\n",
"<td>",get_lang('NameOfTheLink')," : </td>\n",
"<td><input type=\"text\" name=\"name\" value=\"",$name,"\"></td>\n",
"</tr>\n",
"<tr>\n",
"<td>Lien :</td>\n",
"<td><input type=\"text\" name=\"link\" value=\"",$link,"\"></td>\n",
"</tr>\n",
"<tr>\n",
"<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"",get_lang('Ok'),"\"></td>\n",
"</tr>\n",
"</form>\n",
"</table>\n",
"</td>\n",
"</tr>\n";
echo "</select>\n",
"</td>\n",
"</tr>\n",
"<tr>\n",
"<td>", get_lang('NameOfTheLink'), " : </td>\n",
"<td><input type=\"text\" name=\"name\" value=\"", $name, "\"></td>\n",
"</tr>\n",
"<tr>\n",
"<td>Lien :</td>\n",
"<td><input type=\"text\" name=\"link\" value=\"", $link, "\"></td>\n",
"</tr>\n",
"<tr>\n",
"<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"", get_lang('Ok'), "\"></td>\n",
"</tr>\n",
"</form>\n",
"</table>\n",
"</td>\n",
"</tr>\n";
}
}
// work with data post askable by admin of course
// Work with data post askable by admin of course
if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_coach())
{
if ($is_platformAdmin && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
// Show message to confirm that a tools must be hide from aivailable tools
// visibility 0,1->2
if($askDelete)
{
echo "<table align=\"center\"><tr>\n",
"<td colspan=\"4\">\n",
"<br><br>\n",
"<font color=\"#ff0000\">",
"&nbsp;&nbsp;&nbsp;",
"<strong>",get_lang('DelLk'),"</strong>",
"<br>&nbsp;&nbsp;&nbsp;\n",
"<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
"&nbsp;|&nbsp;\n",
"<a href=\"".api_get_self()."?delete=yes&amp;id=$id\">",get_lang('Yes'),"</a>\n",
"</font>\n",
"<br><br><br>\n",
"</td>\n",
"</tr>",
"</table>\n";
if ($askDelete) {
echo "<table align=\"center\"><tr>\n",
"<td colspan=\"4\">\n",
"<br /><br />\n",
"<font color=\"#ff0000\">",
"&nbsp;&nbsp;&nbsp;",
"<strong>",get_lang('DelLk'),"</strong>",
"<br />&nbsp;&nbsp;&nbsp;\n",
"<a href=\"".api_get_self()."\">",get_lang('No'),"</a>\n",
"&nbsp;|&nbsp;\n",
"<a href=\"".api_get_self()."?delete=yes&amp;id=$id\">",get_lang('Yes'),"</a>\n",
"</font>\n",
"<br /><br /><br />\n",
"</td>\n",
"</tr>",
"</table>\n";
} // if remove
/*
@ -213,59 +197,49 @@ if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_coach())
* visibility=2 are only viewed by Dokeos Administrator visibility 0,1->2
*/
elseif (isset($delete) && $delete)
{
elseif (isset($delete) && $delete) {
Database::query("DELETE FROM $TBL_ACCUEIL WHERE id=$id AND added_tool=1");
}
}
echo "<table class=\"item\" align=\"center\" border=\"0\" width=\"95%\">\n";
/*==========================
TOOLS FOR EVERYBODY
==========================*/
/* TOOLS FOR EVERYBODY */
echo "<tr>\n<td colspan=\"6\">&nbsp;</td>\n</tr>\n";
echo "<tr>\n<td colspan=\"6\">";
echo "<tr>\n<td colspan=\"6\">&nbsp;</td>\n</tr>\n";
echo "<tr>\n<td colspan=\"6\">";
CourseHome::show_tool_3column('Basic');
CourseHome::show_tool_3column('External');
echo "</td>\n</tr>\n";
echo "</td>\n</tr>\n";
/*==========================
PROF ONLY VIEW
==========================*/
/* PROF ONLY VIEW */
if (api_is_allowed_to_edit(null,true) && !api_is_coach()) {
echo "<tr><td colspan=\"6\"><hr noshade size=\"1\" /></td></tr>\n",
"<tr>\n","<td colspan=\"6\">\n",
"<font color=\"#F66105\">\n",get_lang('CourseAdminOnly'),"</font>\n",
"</td>\n","</tr>\n";
echo "<tr>\n<td colspan=\"6\">";
if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
echo "<tr><td colspan=\"6\"><hr noshade size=\"1\" /></td></tr>\n",
"<tr>\n","<td colspan=\"6\">\n",
"<font color=\"#F66105\">\n", get_lang('CourseAdminOnly'), "</font>\n",
"</td>\n","</tr>\n";
echo "<tr>\n<td colspan=\"6\">";
CourseHome::show_tool_3column('courseAdmin');
echo "</td>\n</tr>\n";
echo "</td>\n</tr>\n";
}
/*--------------------------------------
TOOLS FOR PLATFORM ADMIN ONLY
--------------------------------------*/
/* TOOLS FOR PLATFORM ADMIN ONLY */
if ($is_platformAdmin && api_is_allowed_to_edit(null,true) && !api_is_coach())
{
echo "<tr>","<td colspan=\"6\">",
"<hr noshade size=\"1\" />",
"</td>","</tr>\n",
"<tr>\n","<td colspan=\"6\">\n",
"<font color=\"#F66105\" >",get_lang('PlatformAdminOnly'),"</font>\n",
"</td>\n","</tr>\n";
echo "<tr>\n<td colspan=\"6\">";
if ($is_platformAdmin && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
echo "<tr>","<td colspan=\"6\">",
"<hr noshade size=\"1\" />",
"</td>","</tr>\n",
"<tr>\n","<td colspan=\"6\">\n",
"<font color=\"#F66105\" >", get_lang('PlatformAdminOnly'), "</font>\n",
"</td>\n","</tr>\n";
echo "<tr>\n<td colspan=\"6\">";
CourseHome::show_tool_3column('platformAdmin');
echo "</td>\n</tr>\n";
echo "</td>\n</tr>\n";
}
echo "</table>\n";
?>
echo "</table>\n";

@ -1,26 +1,25 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* HOME PAGE FOR EACH COURSE
*
* This page, included in every course's index.php is the home
* page. To make administration simple, the teacher edits his
* course from the home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to the teachers tools (statistics, edit forums...).
*
* @package chamilo.course_home
==============================================================================
*/
* HOME PAGE FOR EACH COURSE
*
* This page, included in every course's index.php is the home
* page. To make administration simple, the teacher edits his
* course from the home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to the teachers tools (statistics, edit forums...).
*
* @package chamilo.course_home
*/
require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
// MAIN CODE
if(api_is_allowed_to_edit(null,true)) {
//HIDE
if(!empty($_GET['hide'])) // visibility 1 -> 0
{
if (api_is_allowed_to_edit(null, true)) {
// HIDE
if (!empty($_GET['hide'])) { // visibility 1 -> 0
/* -- session condition for visibility
if (!empty($session_id)) {
$sql = "select session_id FROM $tool_table WHERE id='".intval($_GET["id"])."' AND session_id = '".intval($session_id)."'";
@ -37,146 +36,150 @@ if(api_is_allowed_to_edit(null,true)) {
} else {
$sql="UPDATE $tool_table SET visibility=0 WHERE id='".intval($_GET["id"])."'";
}*/
$sql="UPDATE $tool_table SET visibility=0 WHERE id='".intval($_GET["id"])."'";
$sql = "UPDATE $tool_table SET visibility=0 WHERE id='".intval($_GET["id"])."'";
Database::query($sql);
Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
} elseif(!empty($_GET['restore'])) {
} elseif (!empty($_GET['restore'])) {
// visibility 0,2 -> 1
//REACTIVATE
$sql = "UPDATE $tool_table SET visibility=1 WHERE id='".intval($_GET["id"])."'";
// REACTIVATE
$sql = "UPDATE $tool_table SET visibility=1 WHERE id='".intval($_GET["id"])."'";
Database::query($sql);
Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
}
}
// work with data post askable by admin of course
// Work with data post askable by admin of course
if (api_is_platform_admin()) {
// Show message to confirm that a tools must be hidden from available tools
// Show message to confirm that a tool it to be hidden from available tools
// visibility 0,1->2
if (!empty($_GET['askDelete'])) {
?>
<div id="toolhide">
<?php echo get_lang("DelLk")?>
<br />&nbsp;&nbsp;&nbsp;
<a href="<?php echo api_get_self()?>"><?php echo get_lang("No")?></a>&nbsp;|&nbsp;
<a href="<?php echo api_get_self()?>?delete=yes&id=<?php echo Security::remove_XSS($_GET['id'])?>"><?php echo get_lang("Yes")?></a>
<div id="toolhide"><?php echo get_lang('DelLk'); ?><br />&nbsp;&nbsp;&nbsp;
<a href="<?php echo api_get_self(); ?>"><?php echo get_lang('No'); ?></a>&nbsp;|&nbsp;
<a href="<?php echo api_get_self(); ?>?delete=yes&id=<?php echo Security::remove_XSS($_GET['id']); ?>"><?php echo get_lang('Yes'); ?></a>
</div>
<?php
}
/*
* Process hiding a tools from available tools.
*/
elseif (isset($_GET["delete"]) && $_GET["delete"]) {
elseif (isset($_GET['delete']) && $_GET['delete']) {
//where $id is set?
$id = intval($id);
Database::query("DELETE FROM $tool_table WHERE id='$id' AND added_tool=1");
}
}
// COURSE ADMIN ONLY VIEW
/*
==============================================================================
COURSE ADMIN ONLY VIEW
==============================================================================
*/
// start of tools for CourseAdmins (teachers/tutors)
if(api_is_allowed_to_edit(null,true) && !api_is_coach()) {
// Start of tools for CourseAdmins (teachers/tutors)
if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
$current_protocol = $_SERVER['SERVER_PROTOCOL'];
$current_host = $_SERVER['HTTP_HOST'];
$server_protocol = substr($current_protocol,0,strrpos($current_protocol,'/'));
$server_protocol = $server_protocol.'://';
if ($current_host == 'localhost') {
//Get information of path
$info = explode('courses',api_get_self());
$path_work = substr($info[0], 0, strlen($info[0]));
} else {
$path_work = "";
}
$current_protocol = $_SERVER['SERVER_PROTOCOL'];
$current_host = $_SERVER['HTTP_HOST'];
$server_protocol = substr($current_protocol, 0, strrpos($current_protocol, '/'));
$server_protocol = $server_protocol.'://';
if ($current_host == 'localhost') {
// Get information of path
$info = explode('courses', api_get_self());
$path_work = substr($info[0], 1);
} else {
$path_work = '';
}
?>
<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px 0px;">
<div class="normal-message" id="id_normal_message" style="display:none">
<?php
echo '<img src="'.$server_protocol.$current_host.'/'.$path_work.'main/inc/lib/javascript/indicator.gif"/>'."&nbsp;&nbsp;";
<?php
echo '<img src="'.$server_protocol.$current_host.'/'.$path_work.'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
echo get_lang('PleaseStandBy');
?>
?>
</div>
<div class="confirmation-message" id="id_confirmation_message" style="display:none"></div>
</div>
<?php
if (api_get_setting('show_session_data') === 'true' && $id_session > 0) {
?>
<?php
if (api_get_setting('show_session_data') == 'true' && $id_session > 0) {
?>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang("SessionData") ?></span>
<span class="viewcaption"><?php echo get_lang('SessionData'); ?></span>
<table width="100%">
<?php echo show_session_data($id_session);?>
<?php
echo show_session_data($id_session);
?>
</table>
</div>
<?php
<?php
}
?>
?>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang("Authoring") ?></span>
<span class="viewcaption"><?php echo get_lang('Authoring'); ?></span>
<table width="100%">
<?php
<?php
$my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
CourseHome::show_tools_category($my_list);
?>
?>
</table>
</div>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang("Interaction") ?></span>
<span class="viewcaption"><?php echo get_lang('Interaction'); ?></span>
<table width="100%">
<?php
<?php
$my_list = CourseHome::get_tools_category(TOOL_INTERACTION);
CourseHome::show_tools_category($my_list);
?>
?>
</table>
</div>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang("Administration") ?></span>
<span class="viewcaption"><?php echo get_lang('Administration'); ?></span>
<table width="100%">
<?php
<?php
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATEFORM);
CourseHome::show_tools_category($my_list);
?>
?>
</table>
</div>
<?php
<?php
} elseif (api_is_coach()) {
if (api_get_setting('show_session_data') === 'true' && $id_session > 0) {
?>
if (api_get_setting('show_session_data') == 'true' && $id_session > 0) {
?>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang("SessionData") ?></span>
<span class="viewcaption"><?php echo get_lang('SessionData'); ?></span>
<table width="100%">
<?php echo CourseHome::show_session_data($id_session);?>
<?php
echo CourseHome::show_session_data($id_session);
?>
</table>
</div>
<?php
<?php
}
?>
?>
<div class="Authoringview">
<table width="100%">
<?php $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); CourseHome::show_tools_category($my_list);?>
<?php
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
CourseHome::show_tools_category($my_list);
?>
</table>
</div>
<?php
// TOOLS AUTHORING
<?php
// TOOLS AUTHORING
} else {
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
if (count($my_list)>0) {
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
if (count($my_list) > 0) {
?>
<div class="Authoringview">
<table width="100%">
<?php CourseHome::show_tools_category($my_list);?>
<?php
CourseHome::show_tools_category($my_list);
?>
</table>
</div>
<?php
}
}
}
}

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/* For licensing terms, see /license.txt */
/**
HOME PAGE FOR EACH COURSE
*
@ -24,10 +25,11 @@
* visibility 0,1
*
*
* @package dokeos.course_home
* @package chamilo.course_home
*/
/* INIT SECTION */
// Name of the language file that needs to be included.
$language_file = 'course_home';
$use_anonymous = true;
@ -35,7 +37,7 @@ $use_anonymous = true;
// Inlcuding the global initialization file.
require '../../main/inc/global.inc.php';
//Delete LP sessions
// Delete LP sessions
unset($_SESSION['oLP']);
unset($_SESSION['lpobject']);
@ -108,9 +110,9 @@ $(function() {
if (!isset($cidReq)) {
$cidReq = api_get_course_id(); // To provide compatibility with previous systems.
global $error_msg,$error_no;
$classError = "init";
$error_no[$classError][] = "2";
$error_level[$classError][] = "info";
$classError = 'init';
$error_no[$classError][] = '2';
$error_level[$classError][] = 'info';
$error_msg[$classError][] = "[".__FILE__."][".__LINE__."] cidReq was Missing $cidReq take $dbname;";
}
@ -123,29 +125,26 @@ $this_section = SECTION_COURSES;
// Libraries
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
//require_once api_get_path(LIBRARY_PATH).'debug.lib.inc.php'; // Old technology
/*
-----------------------------------------------------------
Constants
-----------------------------------------------------------
*/
define ('TOOL_PUBLIC', 'Public');
define ('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide');
define ('TOOL_COURSE_ADMIN', 'courseAdmin');
define ('TOOL_PLATFORM_ADMIN', 'platformAdmin');
define ('TOOL_AUTHORING', 'toolauthoring');
define ('TOOL_INTERACTION', 'toolinteraction');
define ('TOOL_ADMIN', 'tooladmin');
define ('TOOL_ADMIN_PLATEFORM', 'tooladminplatform');
// ('TOOL_ADMIN_PLATFORM_VISIBLE', 'tooladminplatformvisible');
//define ('TOOL_ADMIN_PLATFORM_INVISIBLE', 'tooladminplatforminvisible');
//define ('TOOL_ADMIN_COURS_INVISIBLE', 'tooladmincoursinvisible');
define ('TOOL_STUDENT_VIEW', 'toolstudentview');
define ('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
/* Constants */
define('TOOL_PUBLIC', 'Public');
define('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide');
define('TOOL_COURSE_ADMIN', 'courseAdmin');
define('TOOL_PLATFORM_ADMIN', 'platformAdmin');
define('TOOL_AUTHORING', 'toolauthoring');
define('TOOL_INTERACTION', 'toolinteraction');
define('TOOL_ADMIN', 'tooladmin');
define('TOOL_ADMIN_PLATEFORM', 'tooladminplatform');
//define('TOOL_ADMIN_PLATFORM_VISIBLE', 'tooladminplatformvisible');
//define('TOOL_ADMIN_PLATFORM_INVISIBLE', 'tooladminplatforminvisible');
//define('TOOL_ADMIN_COURS_INVISIBLE', 'tooladmincoursinvisible');
define('TOOL_STUDENT_VIEW', 'toolstudentview');
define('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
/* Virtual course support code */
$user_id = api_get_user_id();
$course_code = $_course['sysCode'];
$course_info = Database::get_course_info($course_code);
@ -160,36 +159,27 @@ api_session_unregister('toolgroup');
$is_speacialcourse = CourseManager::is_special_course($course_code);
if ($is_speacialcourse==true){
$autoreg=Security::remove_XSS($_GET['autoreg']);
if ($autoreg==1){
if ($is_speacialcourse){
$autoreg = Security::remove_XSS($_GET['autoreg']);
if ($autoreg == 1) {
CourseManager::subscribe_user($user_id, $course_code, $status = STUDENT);
}
}
/*
-----------------------------------------------------------
Is the user allowed here?
-----------------------------------------------------------
*/
/* Is the user allowed here? */
if (!$is_allowed_in_course) {
api_not_allowed(true);
}
/*
-----------------------------------------------------------
Header
-----------------------------------------------------------
*/
/* Header */
//Display::display_header($course_title, 'Home');
Display::display_header('', 'Home');
/*
-----------------------------------------------------------
STATISTICS
-----------------------------------------------------------
*/
/* STATISTICS */
if (!isset($coursesAlreadyVisited[$_cid])) {
event_access_course();
$coursesAlreadyVisited[$_cid] = 1;
@ -201,47 +191,35 @@ $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$temps = time();
$reqdate = "&reqdate=$temps";
/*
==============================================================================
MAIN CODE
==============================================================================
*/
/* MAIN CODE */
//display course title for course home page (similar to toolname for tool pages)
//echo '<h3>'.api_display_tool_title($nameTools) . '</h3>';
/*
-----------------------------------------------------------
Introduction section
(editable by course admins)
-----------------------------------------------------------
*/
/* Introduction section
(editable by course admins) */
Display::display_introduction_section(TOOL_COURSE_HOMEPAGE, array(
'CreateDocumentWebDir' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/',
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'CreateDocumentDir' => 'document/',
'BaseHref' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/'
'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
)
);
/*
-----------------------------------------------------------
SWITCH TO A DIFFERENT HOMEPAGE VIEW
/* SWITCH TO A DIFFERENT HOMEPAGE VIEW
the setting homepage_view is adjustable through
the platform administration section
-----------------------------------------------------------
*/
the platform administration section */
if (api_get_setting('homepage_view') == 'activity') {
require 'activity.php';
}
elseif(api_get_setting('homepage_view') == '2column') {
elseif (api_get_setting('homepage_view') == '2column') {
require '2column.php';
}
elseif(api_get_setting('homepage_view') == '3column') {
elseif (api_get_setting('homepage_view') == '3column') {
require '3column.php';
}
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
/* FOOTER */
Display::display_footer();

@ -7,6 +7,9 @@ class CourseHome {
* Gets the html content to show in the 3 column view
*/
public static function show_tool_3column($cat) {
if (!class_exists('HTML_Table')) {
require_once 'pear/HTML/Table.php';
}
global $_user;
$charset = api_get_system_encoding();
$TBL_ACCUEIL = Database :: get_course_table(TABLE_TOOL_LIST);

Loading…
Cancel
Save