Actualización
This commit is contained in:
111
main/course_home/2column.php
Normal file
111
main/course_home/2column.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/* 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
|
||||
*/
|
||||
|
||||
/* Work with data post askable by admin of course (franglais, clean this) */
|
||||
|
||||
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
|
||||
$course_id = api_get_course_int_id();
|
||||
|
||||
if (api_is_allowed_to_edit(null, true)) {
|
||||
/* 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)
|
||||
*/
|
||||
if (isset($_GET['remove']) && $_GET['remove']) {
|
||||
$msgDestroy = get_lang('DelLk').'<br />';
|
||||
$msgDestroy .= '<a href="'.api_get_self().'">'.get_lang('No').'</a> | ';
|
||||
$msgDestroy .= '<a href="'.api_get_self().'?destroy=yes&id='.$id.'">'.get_lang('Yes').'</a>';
|
||||
$show_message .= Display::return_message($msgDestroy, 'confirmation', false);
|
||||
} elseif (isset($_GET['destroy']) && $_GET['destroy']) {
|
||||
/*
|
||||
* Process hiding a tools from available tools.
|
||||
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
|
||||
*/
|
||||
Database::query("UPDATE $tool_table SET visibility='2' WHERE c_id = $course_id AND id='".$id."'");
|
||||
} elseif (isset($_GET['hide']) && $_GET['hide']) {
|
||||
/* HIDE */
|
||||
// visibility 1 -> 0
|
||||
Database::query("UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'");
|
||||
$show_message .= Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
|
||||
} elseif (isset($_GET['restore']) && $_GET["restore"]) {
|
||||
// visibility 0,2 -> 1
|
||||
/* REACTIVATE */
|
||||
Database::query("UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'");
|
||||
$show_message .= Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation');
|
||||
}
|
||||
}
|
||||
|
||||
// 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 tool it to be hidden from available tools
|
||||
// visibility 0,1->2
|
||||
if (!empty($_GET['askDelete'])) {
|
||||
$content .= '<div id="toolhide">'.get_lang('DelLk').'<br />
|
||||
<a href="'.api_get_self().'">'.get_lang('No').'</a> |
|
||||
<a href="'.api_get_self().'?delete=yes&id='.intval($_GET['id']).'">'.get_lang('Yes').'</a>
|
||||
</div>';
|
||||
} elseif (isset($_GET['delete']) && $_GET['delete']) {
|
||||
/*
|
||||
* Process hiding a tools from available tools.
|
||||
*/
|
||||
//where $id is set?
|
||||
$id = intval($id);
|
||||
Database::query("DELETE FROM $tool_table WHERE c_id = $course_id AND id='$id' AND added_tool=1");
|
||||
}
|
||||
}
|
||||
|
||||
/* TOOLS VISIBLE FOR EVERYBODY */
|
||||
|
||||
$content .= '<div class="everybodyview">';
|
||||
$content .= '<table width="100%">';
|
||||
$content .= CourseHome::show_tool_2column(TOOL_PUBLIC);
|
||||
$content .= '</table>';
|
||||
$content .= '</div>';
|
||||
|
||||
/* COURSE ADMIN ONLY VIEW */
|
||||
|
||||
// Start of tools for CourseAdmins (teachers/tutors)
|
||||
if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
|
||||
$content .= "<div class=\"courseadminview\">";
|
||||
$content .= "<span class=\"viewcaption\">";
|
||||
$content .= get_lang('CourseAdminOnly');
|
||||
$content .= "</span>";
|
||||
$content .= "<table width=\"100%\">";
|
||||
$content .= CourseHome::show_tool_2column(TOOL_COURSE_ADMIN);
|
||||
/* INACTIVE TOOLS - HIDDEN (GREY) LINKS */
|
||||
$content .= "<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>".
|
||||
"</td>\n".
|
||||
"</tr>";
|
||||
|
||||
$content .= CourseHome::show_tool_2column(TOOL_PUBLIC_BUT_HIDDEN);
|
||||
$content .= "</table>";
|
||||
$content .= "</div> ";
|
||||
}
|
||||
|
||||
/* Tools for platform admin only */
|
||||
if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
|
||||
$content .= '<div class="platformadminview">
|
||||
<span class="viewcaption">'.get_lang('PlatformAdminOnly').'</span>
|
||||
<table width="100%">
|
||||
'.CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN).'
|
||||
</table>
|
||||
</div>';
|
||||
}
|
||||
220
main/course_home/3column.php
Normal file
220
main/course_home/3column.php
Normal file
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/* 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 chamilo.course_home
|
||||
*/
|
||||
$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;
|
||||
$TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
|
||||
$course_id = api_get_course_int_id();
|
||||
$remove = isset($remove) ? $remove : false;
|
||||
$destroy = isset($destroy) ? $destroy : false;
|
||||
$askDelete = isset($askDelete) ? $askDelete : false;
|
||||
|
||||
// WORK with data post askable by admin of course
|
||||
if (api_is_allowed_to_edit(null, true)) {
|
||||
/* Processing request */
|
||||
/* MODIFY HOME PAGE */
|
||||
/*
|
||||
* 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) {
|
||||
$sql = "SELECT * FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id=$id";
|
||||
$result = Database::query($sql);
|
||||
$tool = Database::fetch_array($result);
|
||||
$tool_name = @htmlspecialchars(
|
||||
$tool['name'] != '' ? $tool['name'] : $tool['link'],
|
||||
ENT_QUOTES,
|
||||
api_get_system_encoding()
|
||||
);
|
||||
if ($tool['img'] != 'external.gif') {
|
||||
$tool['link'] = api_get_path(WEB_CODE_PATH).$tool['link'];
|
||||
}
|
||||
$tool['image'] = Display::returnIconPath($tool['image']);
|
||||
|
||||
echo "<br /><br /><br />\n";
|
||||
echo "<table class=\"message\" width=\"70%\" align=\"center\">\n",
|
||||
"<tr><td width=\"7%\" align=\"center\">\n",
|
||||
"<a href=\"".$tool['link']."\">".Display::return_icon($tool['image'], get_lang('Delete')), "</a></td>\n",
|
||||
"<td width=\"28%\" height=\"45\"><small>\n",
|
||||
"<a href=\"".$tool['link']."\">".$tool_name."</a></small></td>\n";
|
||||
echo "<td align=\"center\">\n",
|
||||
"<font color=\"#ff0000\">",
|
||||
" ",
|
||||
"<strong>", get_lang('DelLk'), "</strong>",
|
||||
"<br /> \n",
|
||||
"<a href=\"".api_get_self()."\">", get_lang('No'), "</a>\n",
|
||||
" | \n",
|
||||
"<a href=\"".api_get_self()."?destroy=yes&id=$id\">", get_lang('Yes'), "</a>\n",
|
||||
"</font></td></tr>\n",
|
||||
"</table>\n";
|
||||
echo "<br /><br /><br />\n";
|
||||
} elseif ($destroy) {
|
||||
// if remove
|
||||
|
||||
/*
|
||||
* Process hiding a tools from aivailable tools.
|
||||
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
|
||||
*/
|
||||
Database::query("UPDATE $TBL_ACCUEIL SET visibility='2' WHERE c_id = $course_id AND id = $id");
|
||||
} elseif ($hide) {
|
||||
// visibility 1 -> 0
|
||||
/* HIDE */
|
||||
Database::query("UPDATE $TBL_ACCUEIL SET visibility=0 WHERE c_id = $course_id AND id=$id");
|
||||
$show_message .= Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
|
||||
} elseif ($restore) {
|
||||
/* REACTIVATE */
|
||||
// visibility 0,2 -> 1
|
||||
Database::query("UPDATE $TBL_ACCUEIL SET visibility=1 WHERE c_id = $course_id AND id=$id");
|
||||
$show_message .= Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation');
|
||||
} elseif (isset($update) && $update) {
|
||||
/*
|
||||
* Editing "apparance" of a tools on the course Home Page.
|
||||
*/
|
||||
$result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id=$id");
|
||||
$tool = Database::fetch_array($result);
|
||||
$racine = api_get_path(SYS_PATH).'/'.$currentCourseID.'/images/';
|
||||
$chemin = $racine;
|
||||
$name = $tool[1];
|
||||
$image = $tool[3];
|
||||
|
||||
$content .= "<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);
|
||||
}
|
||||
$content .= "<option>".$file."</option>\n";
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
$content .= "</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
|
||||
if (api_is_platform_admin() && 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) {
|
||||
$content .= "<table align=\"center\"><tr><td colspan=\"4\">
|
||||
<br /><br /><font color=\"#ff0000\"> <strong>".get_lang('DelLk')."</strong>
|
||||
<br />
|
||||
<a href=\"".api_get_self()."\">".get_lang('No')."</a>
|
||||
|
|
||||
<a href=\"".api_get_self()."?delete=yes&id=$id\">".get_lang('Yes')."</a>
|
||||
</font>
|
||||
<br /><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
</table>\n";
|
||||
} elseif (isset($delete) && $delete) {
|
||||
// if remove
|
||||
/*
|
||||
* Process hiding a tools from aivailable tools.
|
||||
* visibility=2 are only viewed by Dokeos Administrator visibility 0,1->2
|
||||
*/
|
||||
Database::query("DELETE FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id = $id AND added_tool=1");
|
||||
}
|
||||
}
|
||||
|
||||
$content .= "<table class=\"item\" align=\"center\" border=\"0\" width=\"95%\">\n";
|
||||
|
||||
/* TOOLS FOR EVERYBODY */
|
||||
$content .= "<tr>\n<td colspan=\"6\"> </td>\n</tr>\n";
|
||||
$content .= "<tr>\n<td colspan=\"6\">";
|
||||
$content .= CourseHome::show_tool_3column('Basic');
|
||||
$content .= CourseHome::show_tool_3column('External');
|
||||
$content .= "</td>\n</tr>\n";
|
||||
|
||||
/* PROF ONLY VIEW */
|
||||
|
||||
if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
|
||||
$content .= "<tr><td colspan=\"6\"><hr noshade size=\"1\" /></td></tr>\n".
|
||||
"<tr><td colspan=\"6\"><font color=\"#F66105\">\n".get_lang('CourseAdminOnly')."</font>
|
||||
</td></tr>\n";
|
||||
$content .= "<tr>\n<td colspan=\"6\">";
|
||||
$content .= CourseHome::show_tool_3column('courseAdmin');
|
||||
$content .= "</td>\n</tr>\n";
|
||||
}
|
||||
|
||||
/* TOOLS FOR PLATFORM ADMIN ONLY */
|
||||
if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
|
||||
$content .= "<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";
|
||||
$content .= "<tr>\n<td colspan=\"6\">";
|
||||
$content .= CourseHome::show_tool_3column('platformAdmin');
|
||||
$content .= "</td>\n</tr>\n";
|
||||
}
|
||||
|
||||
$content .= "</table>\n";
|
||||
73
main/course_home/activity.php
Normal file
73
main/course_home/activity.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/* 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
|
||||
*/
|
||||
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
|
||||
$course_id = api_get_course_int_id();
|
||||
$session_id = api_get_session_id();
|
||||
|
||||
// Work with data post askable by admin of course
|
||||
if (api_is_platform_admin()) {
|
||||
// Show message to confirm that a tool it to be hidden from available tools
|
||||
// visibility 0,1->2
|
||||
if (!empty($_GET['askDelete'])) {
|
||||
$content .= '<div id="toolhide">'.get_lang('DelLk').'<br />
|
||||
<a href="'.api_get_self().'">'.get_lang('No').'</a> |
|
||||
<a href="'.api_get_self().'?delete=yes&id='.$id.'">'.get_lang('Yes').'</a>
|
||||
</div>';
|
||||
} elseif (isset($_GET['delete']) && $_GET['delete']) {
|
||||
/*
|
||||
* Process hiding a tools from available tools.
|
||||
*/
|
||||
Database::query("DELETE FROM $tool_table WHERE c_id = $course_id AND id='$id' AND added_tool=1");
|
||||
}
|
||||
}
|
||||
|
||||
// Course legal
|
||||
$enabled = api_get_plugin_setting('courselegal', 'tool_enable');
|
||||
$pluginExtra = null;
|
||||
if ($enabled === 'true') {
|
||||
require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php';
|
||||
$plugin = CourseLegalPlugin::create();
|
||||
$pluginExtra = $plugin->getTeacherLink();
|
||||
}
|
||||
|
||||
// Start of tools for CourseAdmins (teachers/tutors)
|
||||
if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) {
|
||||
$content .= '<div class="alert alert-success" style="border:0px; margin-top: 0px;padding:0px;">
|
||||
<div class="normal-message" id="id_normal_message" style="display:none">';
|
||||
$content .= '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/> ';
|
||||
$content .= get_lang('PleaseStandBy');
|
||||
$content .= '</div>
|
||||
<div class="alert alert-success" id="id_confirmation_message" style="display:none"></div>
|
||||
</div>';
|
||||
$content .= $pluginExtra;
|
||||
} elseif (api_is_coach()) {
|
||||
$content .= $pluginExtra;
|
||||
if (api_get_setting('show_session_data') === 'true' && $session_id > 0) {
|
||||
$content .= '<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<span class="viewcaption">'.get_lang('SessionData').'</span>
|
||||
<table class="course_activity_home">';
|
||||
$content .= CourseHome::show_session_data($session_id);
|
||||
$content .= '</table></div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$blocks = CourseHome::getUserBlocks();
|
||||
$activityView = new Template('', false, false, false, false, false, false);
|
||||
$activityView->assign('blocks', $blocks);
|
||||
|
||||
$content .= $activityView->fetch(
|
||||
$activityView->get_template('course_home/activity.tpl')
|
||||
);
|
||||
546
main/course_home/course_home.php
Normal file
546
main/course_home/course_home.php
Normal file
@@ -0,0 +1,546 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
use ChamiloSession as Session;
|
||||
use Fhaculty\Graph\Graph;
|
||||
|
||||
/**
|
||||
* 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...).
|
||||
*
|
||||
* Edit visibility of tools
|
||||
*
|
||||
* visibility = 1 - everybody
|
||||
* visibility = 0 - course admin (teacher) and platform admin
|
||||
*
|
||||
* Who can change visibility ?
|
||||
*
|
||||
* admin = 0 - course admin (teacher) and platform admin
|
||||
* admin = 1 - platform admin
|
||||
*
|
||||
* Show message to confirm that a tools must be hide from available tools
|
||||
*
|
||||
* visibility 0,1
|
||||
*
|
||||
* @package chamilo.course_home
|
||||
*/
|
||||
$use_anonymous = true;
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
$js = '<script>'.api_get_language_translate_html().'</script>';
|
||||
$htmlHeadXtra[] = $js;
|
||||
$htmlHeadXtra[] = '<script>
|
||||
/* show eye for all show/hide*/
|
||||
function buttonForAllShowHide()
|
||||
{
|
||||
tools_invisibles = [];
|
||||
tools_visibles = [];
|
||||
$.each($(".make_visible_and_invisible").parent(), function (index, item) {
|
||||
var element = $(item).find("a");
|
||||
image = $(element[0]).find("em")[0];
|
||||
// extract the tool ID from the HTML em id, removing linktool_
|
||||
image_id = $(image).attr("id").replace("linktool_","");
|
||||
if (!$(image).hasClass("fa-eye-slash")) {
|
||||
// if the image does not have the eye-slash icon, prepare to make invisible
|
||||
tools_invisibles.push(image_id)
|
||||
} else {
|
||||
// if the image has the eye-slash icon, prepare to make visible
|
||||
tools_visibles.push(image_id)
|
||||
}
|
||||
});
|
||||
if (tools_visibles.length == 0) {
|
||||
$(".visible-all").addClass("hidden");
|
||||
$(".invisible-all").removeClass("hidden");
|
||||
} else {
|
||||
$(".visible-all").removeClass("hidden");
|
||||
$(".invisible-all").addClass("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
/* option show/hide thematic-block */
|
||||
$(function() {
|
||||
buttonForAllShowHide();
|
||||
/* option show/hide all*/
|
||||
$(".show-hide-all-tools").on("click" , function() {
|
||||
$(".show-hide-all-tools").addClass("disabled");
|
||||
tools_invisibles = [];
|
||||
tools_visibles = [];
|
||||
$.each($(".make_visible_and_invisible").parent(), function (index, item) {
|
||||
var element = $(item).find("a");
|
||||
image = $(element[0]).find("em")[0];
|
||||
image_id = $(image).attr("id").replace("linktool_","");
|
||||
if (!$(image).hasClass("fa-eye-slash")) {
|
||||
tools_invisibles.push(image_id)
|
||||
} else {
|
||||
tools_visibles.push(image_id)
|
||||
}
|
||||
});
|
||||
message_invisible = "'.get_lang('ToolIsNowHidden').'";
|
||||
ids = tools_invisibles;
|
||||
if (tools_invisibles.length == 0) {
|
||||
ids = tools_visibles;
|
||||
message_invisible = "'.get_lang('ToolIsNowVisible').'";
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
contentType: "application/x-www-form-urlencoded",
|
||||
beforeSend: function (myObject) {
|
||||
$(".normal-message").show();
|
||||
$("#id_confirmation_message").hide();
|
||||
},
|
||||
type: "GET",
|
||||
url: "'.api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?'.api_get_cidreq().'&a=set_visibility_for_all",
|
||||
data: "tools_ids=" + JSON.stringify(ids) + "&sent_http_request=1",
|
||||
success: function (data) {
|
||||
data = JSON.parse(data);
|
||||
$.each(data,function(index,item){
|
||||
new_current_view = "'.api_get_path(WEB_IMG_PATH).'" + item.view;
|
||||
//eyes
|
||||
$("#linktool_"+item.id).attr("class", item.fclass);
|
||||
//tool
|
||||
var $toolImage = $("#toolimage_" + item.id);
|
||||
|
||||
if (!$toolImage.data("forced-src")) {
|
||||
$toolImage.attr("src", item.image);
|
||||
}
|
||||
|
||||
//class
|
||||
$("#tooldesc_" + item.id).attr("class", item.tclass);
|
||||
$("#istooldesc_" + item.id).attr("class", item.tclass);
|
||||
});
|
||||
$(".show-hide-all-tools").removeClass("disabled");
|
||||
$(".normal-message").hide();
|
||||
$("#id_confirmation_message").html(message_invisible);
|
||||
$("#id_confirmation_message").show();
|
||||
buttonForAllShowHide();
|
||||
},
|
||||
error: function( jqXHR, textStatus, errorThrown ) {
|
||||
$(".show-hide-all-tools").removeClass("disabled");
|
||||
$(".normal-message").hide();
|
||||
buttonForAllShowHide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#thematic-show").click(function(){
|
||||
$(".btn-hide-thematic").hide();
|
||||
$(".btn-show-thematic").show(); //show using class
|
||||
$("#pross").fadeToggle(); //Not working collapse for Chrome
|
||||
});
|
||||
|
||||
$("#thematic-hide").click(function(){
|
||||
$(".btn-show-thematic").hide(); //show using class
|
||||
$(".btn-hide-thematic").show();
|
||||
$("#pross").fadeToggle(); //Not working collapse for Chrome
|
||||
});
|
||||
|
||||
$(".make_visible_and_invisible").attr("href", "javascript:void(0);");
|
||||
$(".make_visible_and_invisible > em").click(function () {
|
||||
make_visible = "visible.gif";
|
||||
make_invisible = "invisible.gif";
|
||||
//path_name = $(this).attr("src");
|
||||
//list_path_name = path_name.split("/");
|
||||
//image_link = list_path_name[list_path_name.length - 1];
|
||||
tool_id = $(this).attr("id");
|
||||
tool_info = tool_id.split("_");
|
||||
my_tool_id = tool_info[1];
|
||||
$("#id_normal_message").attr("class", "normal-message alert alert-success");
|
||||
|
||||
$.ajax({
|
||||
contentType: "application/x-www-form-urlencoded",
|
||||
beforeSend: function(myObject) {
|
||||
$(".normal-message").show();
|
||||
$("#id_confirmation_message").hide();
|
||||
},
|
||||
type: "GET",
|
||||
url: "'.api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?'.api_get_cidreq().'&a=set_visibility",
|
||||
data: "id=" + my_tool_id + "&sent_http_request=1",
|
||||
success: function(data) {
|
||||
eval("var info=" + data);
|
||||
new_current_tool_image = info.image;
|
||||
new_current_view = "'.api_get_path(WEB_IMG_PATH).'" + info.view;
|
||||
//eyes
|
||||
//$("#" + tool_id).attr("src", new_current_view);
|
||||
$("#linktool_"+my_tool_id).attr("class", info.fclass);
|
||||
$("#linktool_"+my_tool_id).attr("title", info.label);
|
||||
|
||||
//tool
|
||||
var $toolImage = $("#toolimage_" + my_tool_id);
|
||||
|
||||
if (!$toolImage.data("forced-src")) {
|
||||
$toolImage.attr("src", new_current_tool_image);
|
||||
}
|
||||
|
||||
//clase
|
||||
$("#tooldesc_" + my_tool_id).attr("class", info.tclass);
|
||||
$("#istooldesc_" + my_tool_id).attr("class", info.tclass);
|
||||
|
||||
if (info.message == "is_active") {
|
||||
message = "'.get_lang('ToolIsNowVisible').'";
|
||||
$("#" + tool_id)
|
||||
.attr("alt", "'.get_lang('Deactivate').'")
|
||||
.attr("title", "'.get_lang('Deactivate').'");
|
||||
} else {
|
||||
message = "'.get_lang('ToolIsNowHidden').'";
|
||||
$("#" + tool_id)
|
||||
.attr("alt", "'.get_lang('Activate').'")
|
||||
.attr("title", "'.get_lang('Activate').'");
|
||||
}
|
||||
$(".normal-message").hide();
|
||||
$("#id_confirmation_message").html(message);
|
||||
$("#id_confirmation_message").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
// The section for the tabs
|
||||
$this_section = SECTION_COURSES;
|
||||
|
||||
$user_id = api_get_user_id();
|
||||
$course_code = api_get_course_id();
|
||||
$courseId = api_get_course_int_id();
|
||||
$sessionId = api_get_session_id();
|
||||
$show_message = '';
|
||||
|
||||
if (api_is_invitee()) {
|
||||
$isInASession = $sessionId > 0;
|
||||
$isSubscribed = CourseManager::is_user_subscribed_in_course(
|
||||
$user_id,
|
||||
$course_code,
|
||||
$isInASession,
|
||||
$sessionId
|
||||
);
|
||||
|
||||
if (!$isSubscribed) {
|
||||
api_not_allowed(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Deleting group session
|
||||
Session::erase('toolgroup');
|
||||
Session::erase('_gid');
|
||||
|
||||
$isSpecialCourse = CourseManager::isSpecialCourse($courseId);
|
||||
|
||||
if ($isSpecialCourse) {
|
||||
if (isset($_GET['autoreg']) && $_GET['autoreg'] == 1) {
|
||||
if (CourseManager::subscribeUser($user_id, $course_code, STUDENT)) {
|
||||
Session::write('is_allowed_in_course', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$action = !empty($_GET['action']) ? Security::remove_XSS($_GET['action']) : '';
|
||||
|
||||
if ($action === 'subscribe' && Security::check_token('get')) {
|
||||
Security::clear_token();
|
||||
$generateRedirectUrlAfterSubscription = function () use ($course_code, $courseId, $user_id) {
|
||||
$redirectionTarget = api_get_self();
|
||||
if (CourseManager::autoSubscribeToCourse($course_code)) {
|
||||
if (CourseManager::is_user_subscribed_in_course($user_id, $course_code)) {
|
||||
Session::write('is_allowed_in_course', true);
|
||||
}
|
||||
if (api_get_configuration_value('catalog_course_subscription_in_user_s_session')) {
|
||||
$user = api_get_user_entity(api_get_user_id());
|
||||
|
||||
if ($user && $accesibleSessions = $user->getCurrentlyAccessibleSessions()) {
|
||||
return api_get_self().'?id_session='.$accesibleSessions[0]->getId();
|
||||
}
|
||||
}
|
||||
} elseif (api_get_configuration_value('catalog_course_subscription_in_user_s_session')) {
|
||||
$user = api_get_user_entity(api_get_user_id());
|
||||
|
||||
if ($user && !$user->getCurrentlyAccessibleSessions()) {
|
||||
// subscription was probably refused because user session expired, go back to page "about"
|
||||
return api_get_path(WEB_PATH).'course/'.$courseId.'/about';
|
||||
}
|
||||
}
|
||||
|
||||
return $redirectionTarget;
|
||||
};
|
||||
|
||||
header('Location: '.$generateRedirectUrlAfterSubscription());
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Is the user allowed here? */
|
||||
api_protect_course_script(true);
|
||||
|
||||
/* STATISTICS */
|
||||
if (!isset($coursesAlreadyVisited[$course_code])) {
|
||||
Event::accessCourse();
|
||||
$coursesAlreadyVisited[$course_code] = 1;
|
||||
Session::write('coursesAlreadyVisited', $coursesAlreadyVisited);
|
||||
}
|
||||
|
||||
$logInfo = [
|
||||
'tool' => 'course-main',
|
||||
'tool_id' => 0,
|
||||
'tool_id_detail' => 0,
|
||||
'action' => $action,
|
||||
'info' => '',
|
||||
];
|
||||
Event::registerLog($logInfo);
|
||||
|
||||
/* Auto launch code */
|
||||
$autoLaunchWarning = '';
|
||||
$showAutoLaunchLpWarning = false;
|
||||
$course_id = api_get_course_int_id();
|
||||
$lpAutoLaunch = api_get_course_setting('enable_lp_auto_launch');
|
||||
$session_id = api_get_session_id();
|
||||
$allowAutoLaunchForCourseAdmins = api_is_platform_admin() || api_is_allowed_to_edit(true, true) || api_is_coach();
|
||||
|
||||
if (!empty($lpAutoLaunch)) {
|
||||
if ($lpAutoLaunch == 2) {
|
||||
// LP list
|
||||
if ($allowAutoLaunchForCourseAdmins) {
|
||||
$showAutoLaunchLpWarning = true;
|
||||
} else {
|
||||
$session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
|
||||
if (!isset($_SESSION[$session_key])) {
|
||||
// Redirecting to the LP
|
||||
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&id_session='.$session_id;
|
||||
$_SESSION[$session_key] = true;
|
||||
header("Location: $url");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
|
||||
$condition = '';
|
||||
if (!empty($session_id)) {
|
||||
$condition = api_get_session_condition($session_id);
|
||||
$sql = "SELECT id FROM $lp_table
|
||||
WHERE c_id = $course_id AND autolaunch = 1 $condition
|
||||
LIMIT 1";
|
||||
$result = Database::query($sql);
|
||||
// If we found nothing in the session we just called the session_id = 0 autolaunch
|
||||
if (Database::num_rows($result) == 0) {
|
||||
$condition = '';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT id FROM $lp_table
|
||||
WHERE c_id = $course_id AND autolaunch = 1 $condition
|
||||
LIMIT 1";
|
||||
$result = Database::query($sql);
|
||||
if (Database::num_rows($result) > 0) {
|
||||
$lp_data = Database::fetch_array($result, 'ASSOC');
|
||||
if (!empty($lp_data['id'])) {
|
||||
if ($allowAutoLaunchForCourseAdmins) {
|
||||
$showAutoLaunchLpWarning = true;
|
||||
} else {
|
||||
$session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
|
||||
if (!isset($_SESSION[$session_key])) {
|
||||
// Redirecting to the LP
|
||||
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id'];
|
||||
|
||||
$_SESSION[$session_key] = true;
|
||||
header("Location: $url");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($showAutoLaunchLpWarning) {
|
||||
$autoLaunchWarning = get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP');
|
||||
}
|
||||
|
||||
$forumAutoLaunch = api_get_course_setting('enable_forum_auto_launch');
|
||||
if ($forumAutoLaunch == 1) {
|
||||
if ($allowAutoLaunchForCourseAdmins) {
|
||||
if (empty($autoLaunchWarning)) {
|
||||
$autoLaunchWarning = get_lang('TheForumAutoLaunchSettingIsOnStudentsWillBeRedirectToTheForumTool');
|
||||
}
|
||||
} else {
|
||||
$url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&id_session='.$session_id;
|
||||
header("Location: $url");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (api_get_configuration_value('allow_exercise_auto_launch')) {
|
||||
$exerciseAutoLaunch = (int) api_get_course_setting('enable_exercise_auto_launch');
|
||||
if ($exerciseAutoLaunch == 2) {
|
||||
if ($allowAutoLaunchForCourseAdmins) {
|
||||
if (empty($autoLaunchWarning)) {
|
||||
$autoLaunchWarning = get_lang(
|
||||
'TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToTheExerciseList'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Redirecting to the document
|
||||
$url = api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'&id_session='.$session_id;
|
||||
header("Location: $url");
|
||||
exit;
|
||||
}
|
||||
} elseif ($exerciseAutoLaunch == 1) {
|
||||
if ($allowAutoLaunchForCourseAdmins) {
|
||||
if (empty($autoLaunchWarning)) {
|
||||
$autoLaunchWarning = get_lang(
|
||||
'TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Redirecting to an exercise
|
||||
$table = Database::get_course_table(TABLE_QUIZ_TEST);
|
||||
$condition = '';
|
||||
if (!empty($session_id)) {
|
||||
$condition = api_get_session_condition($session_id);
|
||||
$sql = "SELECT iid FROM $table
|
||||
WHERE c_id = $course_id AND autolaunch = 1 $condition
|
||||
LIMIT 1";
|
||||
$result = Database::query($sql);
|
||||
// If we found nothing in the session we just called the session_id = 0 autolaunch
|
||||
if (Database::num_rows($result) == 0) {
|
||||
$condition = '';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT iid FROM $table
|
||||
WHERE c_id = $course_id AND autolaunch = 1 $condition
|
||||
LIMIT 1";
|
||||
$result = Database::query($sql);
|
||||
if (Database::num_rows($result) > 0) {
|
||||
$row = Database::fetch_array($result, 'ASSOC');
|
||||
$exerciseId = $row['iid'];
|
||||
$url = api_get_path(WEB_CODE_PATH).
|
||||
'exercise/overview.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&id_session='.$session_id;
|
||||
header("Location: $url");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$documentAutoLaunch = api_get_course_setting('enable_document_auto_launch');
|
||||
if ($documentAutoLaunch == 1) {
|
||||
if ($allowAutoLaunchForCourseAdmins) {
|
||||
if (empty($autoLaunchWarning)) {
|
||||
$autoLaunchWarning = get_lang('TheDocumentAutoLaunchSettingIsOnStudentsWillBeRedirectToTheDocumentTool');
|
||||
}
|
||||
} else {
|
||||
// Redirecting to the document
|
||||
$url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id_session='.$session_id;
|
||||
header("Location: $url");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Used in different pages
|
||||
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
|
||||
|
||||
/* Introduction section (editable by course admins) */
|
||||
$content = Display::return_introduction_section(
|
||||
TOOL_COURSE_HOMEPAGE,
|
||||
[
|
||||
'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().'/',
|
||||
]
|
||||
);
|
||||
|
||||
/* SWITCH TO A DIFFERENT HOMEPAGE VIEW
|
||||
the setting homepage_view is adjustable through
|
||||
the platform administration section */
|
||||
if (!empty($autoLaunchWarning)) {
|
||||
$show_message .= Display::return_message(
|
||||
$autoLaunchWarning,
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
|
||||
$homePageView = api_get_setting('homepage_view');
|
||||
|
||||
switch ($homePageView) {
|
||||
case 'activity':
|
||||
case 'activity_big':
|
||||
require 'activity.php';
|
||||
break;
|
||||
case '2column':
|
||||
require '2column.php';
|
||||
break;
|
||||
case '3column':
|
||||
require '3column.php';
|
||||
break;
|
||||
case 'vertical_activity':
|
||||
require 'vertical_activity.php';
|
||||
break;
|
||||
}
|
||||
|
||||
// Get session-career diagram
|
||||
$diagram = '';
|
||||
$allow = api_get_configuration_value('allow_career_diagram');
|
||||
if ($allow === true) {
|
||||
$htmlHeadXtra[] = api_get_js('jsplumb2.js');
|
||||
$extra = new ExtraFieldValue('session');
|
||||
$value = $extra->get_values_by_handler_and_field_variable(
|
||||
api_get_session_id(),
|
||||
'external_career_id'
|
||||
);
|
||||
|
||||
if (!empty($value) && isset($value['value'])) {
|
||||
$careerId = $value['value'];
|
||||
$extraFieldValue = new ExtraFieldValue('career');
|
||||
$item = $extraFieldValue->get_item_id_from_field_variable_and_field_value(
|
||||
'external_career_id',
|
||||
$careerId,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
if (!empty($item) && isset($item['item_id'])) {
|
||||
$careerId = $item['item_id'];
|
||||
$career = new Career();
|
||||
$careerInfo = $career->get($careerId);
|
||||
if (!empty($careerInfo)) {
|
||||
$extraFieldValue = new ExtraFieldValue('career');
|
||||
$item = $extraFieldValue->get_values_by_handler_and_field_variable(
|
||||
$careerId,
|
||||
'career_diagram',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
if (!empty($item) && isset($item['value']) && !empty($item['value'])) {
|
||||
/** @var Graph $graph */
|
||||
$graph = UnserializeApi::unserialize(
|
||||
'career',
|
||||
$item['value']
|
||||
);
|
||||
$diagram = Career::renderDiagram($careerInfo, $graph);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$content = '<div id="course_tools">'.$diagram.$content.'</div>';
|
||||
|
||||
// Deleting the objects
|
||||
Session::erase('_gid');
|
||||
Session::erase('oLP');
|
||||
Session::erase('lpobject');
|
||||
api_remove_in_gradebook();
|
||||
Exercise::cleanSessionVariables();
|
||||
DocumentManager::removeGeneratedAudioTempFile();
|
||||
|
||||
$tpl = new Template(null);
|
||||
$tpl->assign('message', $show_message);
|
||||
$tpl->assign('content', $content);
|
||||
|
||||
// Direct login to course
|
||||
$tpl->assign('course_code', $course_code);
|
||||
$tpl->display_one_col_template();
|
||||
7
main/course_home/index.html
Normal file
7
main/course_home/index.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; url=course_home.php">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
35
main/course_home/last_course.php
Normal file
35
main/course_home/last_course.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
$cidReset = true;
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
api_block_anonymous_users();
|
||||
|
||||
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
|
||||
|
||||
$userId = api_get_user_id();
|
||||
|
||||
$sql = "SELECT c_id, session_id
|
||||
FROM $table
|
||||
WHERE
|
||||
user_id = $userId
|
||||
ORDER BY logout_course_date DESC
|
||||
LIMIT 1 ";
|
||||
|
||||
$result = Database::query($sql);
|
||||
|
||||
if (Database::num_rows($result)) {
|
||||
$result = Database::fetch_array($result, 'ASSOC');
|
||||
$courseId = (int) $result['c_id'];
|
||||
$sessionId = (int) $result['session_id'];
|
||||
$courseInfo = api_get_course_info_by_id($courseId);
|
||||
if (!empty($courseInfo)) {
|
||||
$url = $courseInfo['course_public_url'].'?id_session='.$sessionId;
|
||||
api_location($url);
|
||||
}
|
||||
}
|
||||
|
||||
Display::addFlash(Display::return_message(get_lang('YouDidNotVisitACourseHereTheCourseList')));
|
||||
api_location(api_get_path(WEB_PATH).'user_portal.php');
|
||||
38
main/course_home/last_lp.php
Normal file
38
main/course_home/last_lp.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
$cidReset = true;
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
api_block_anonymous_users();
|
||||
|
||||
$itemView = Database::get_course_table(TABLE_LP_ITEM_VIEW);
|
||||
$view = Database::get_course_table(TABLE_LP_VIEW);
|
||||
$userId = api_get_user_id();
|
||||
|
||||
$sql = "SELECT v.lp_id, v.c_id, v.session_id
|
||||
FROM $view v
|
||||
INNER JOIN $itemView iv
|
||||
ON (v.c_id = iv.c_id AND v.iid = iv.lp_view_id)
|
||||
WHERE
|
||||
user_id = $userId
|
||||
ORDER BY start_time DESC
|
||||
LIMIT 1 ";
|
||||
$result = Database::query($sql);
|
||||
|
||||
if (Database::num_rows($result)) {
|
||||
$result = Database::fetch_array($result, 'ASSOC');
|
||||
$lpId = (int) $result['lp_id'];
|
||||
$courseId = (int) $result['c_id'];
|
||||
$sessionId = (int) $result['session_id'];
|
||||
$courseInfo = api_get_course_info_by_id($courseId);
|
||||
if (!empty($courseInfo)) {
|
||||
$url = api_get_path(WEB_CODE_PATH).
|
||||
'lp/lp_controller.php?action=view&lp_id='.$lpId.'&cidReq='.$courseInfo['code'].'&id_session='.$sessionId;
|
||||
api_location($url);
|
||||
}
|
||||
}
|
||||
|
||||
Display::addFlash(Display::return_message(get_lang('YouDidNotVisitALpHereTheLpList')));
|
||||
api_location(api_get_path(WEB_CODE_PATH).'lp/my_list.php');
|
||||
24
main/course_home/redirect.php
Normal file
24
main/course_home/redirect.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Redirects a session name to a correct session id.
|
||||
*/
|
||||
$cidReset = true;
|
||||
require_once __DIR__.'/../inc/global.inc.php';
|
||||
|
||||
$sessionName = isset($_GET['session_name']) ? $_GET['session_name'] : '';
|
||||
$courseCode = isset($_GET['cidReq']) ? $_GET['cidReq'] : '';
|
||||
|
||||
if (!empty($sessionName) && !empty($courseCode)) {
|
||||
$sessionInfo = SessionManager::get_session_by_name($sessionName);
|
||||
$courseInfo = api_get_course_info($courseCode);
|
||||
if (!empty($sessionInfo) && !empty($courseInfo)) {
|
||||
$url = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/index.php?id_session='.$sessionInfo['id'];
|
||||
header('Location: '.$url);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
api_not_allowed(true);
|
||||
133
main/course_home/vertical_activity.php
Normal file
133
main/course_home/vertical_activity.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/* 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
|
||||
*/
|
||||
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
|
||||
$course_id = api_get_course_int_id();
|
||||
$session_id = api_get_session_id();
|
||||
|
||||
if (api_is_allowed_to_edit(null, true)) {
|
||||
// HIDE
|
||||
if (!empty($_GET['hide'])) { // visibility 1 -> 0
|
||||
$sql = "UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'";
|
||||
Database::query($sql);
|
||||
$show_message = Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
|
||||
} elseif (!empty($_GET['restore'])) {
|
||||
// visibility 0,2 -> 1
|
||||
// REACTIVATE
|
||||
$sql = "UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'";
|
||||
Database::query($sql);
|
||||
$show_message = Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation');
|
||||
}
|
||||
}
|
||||
|
||||
// Work with data post askable by admin of course
|
||||
if (api_is_platform_admin()) {
|
||||
// Show message to confirm that a tool it to be hidden from available tools
|
||||
// visibility 0,1->2
|
||||
if (!empty($_GET['askDelete'])) {
|
||||
$content .= '<div id="toolhide">'.get_lang('DelLk').'<br />
|
||||
<a href="'.api_get_self().'">'.get_lang('No').'</a> |
|
||||
<a href="'.api_get_self().'?delete=yes&id='.$id.'">'.get_lang('Yes').'</a>
|
||||
</div>';
|
||||
} elseif (isset($_GET['delete']) && $_GET['delete']) {
|
||||
/*
|
||||
* Process hiding a tools from available tools.
|
||||
*/
|
||||
//where $id is set?
|
||||
$id = intval($id);
|
||||
Database::query("DELETE FROM $tool_table WHERE c_id = $course_id AND id='$id' AND added_tool=1");
|
||||
}
|
||||
}
|
||||
|
||||
// COURSE ADMIN ONLY VIEW
|
||||
$blocks = [];
|
||||
|
||||
// Start of tools for CourseAdmins (teachers/tutors)
|
||||
if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
|
||||
$content .= '<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px;">
|
||||
<div class="normal-message" id="id_normal_message" style="display:none">';
|
||||
$content .= '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/> ';
|
||||
$content .= get_lang('PleaseStandBy');
|
||||
|
||||
$content .= '</div>
|
||||
<div class="confirmation-message" id="id_confirmation_message" style="display:none"></div></div>';
|
||||
$content .= '<div id="activity-3col">';
|
||||
|
||||
if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {
|
||||
$content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('SessionData').'</span>
|
||||
<table width="100%">'.CourseHome::show_session_data($session_id).'</table>
|
||||
</div>';
|
||||
}
|
||||
|
||||
$my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
|
||||
$blocks[] = [
|
||||
'title' => get_lang('Authoring'),
|
||||
'content' => CourseHome::show_tools_category($my_list),
|
||||
];
|
||||
|
||||
$my_list = CourseHome::get_tools_category(TOOL_INTERACTION);
|
||||
$blocks[] = [
|
||||
'title' => get_lang('Interaction'),
|
||||
'content' => CourseHome::show_tools_category($my_list),
|
||||
];
|
||||
|
||||
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
|
||||
|
||||
$blocks[] = [
|
||||
'title' => get_lang('Administration'),
|
||||
'content' => CourseHome::show_tools_category($my_list),
|
||||
];
|
||||
} elseif (api_is_coach()) {
|
||||
if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {
|
||||
$content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('SessionData').'</span>
|
||||
<table width="100%">';
|
||||
$content .= CourseHome::show_session_data($session_id);
|
||||
$content .= '</table></div>';
|
||||
}
|
||||
|
||||
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
|
||||
|
||||
$blocks[] = [
|
||||
'class' => 'Authoringview',
|
||||
'content' => CourseHome::show_tools_category($my_list),
|
||||
];
|
||||
// TOOLS AUTHORING
|
||||
} else {
|
||||
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
|
||||
if (count($my_list) > 0) {
|
||||
//ordering by get_lang name
|
||||
$order_tool_list = [];
|
||||
foreach ($my_list as $key => $new_tool) {
|
||||
$tool_name = CourseHome::translate_tool_name($new_tool);
|
||||
$order_tool_list[$key] = $tool_name;
|
||||
}
|
||||
natsort($order_tool_list);
|
||||
$my_temp_tool_array = [];
|
||||
foreach ($order_tool_list as $key => $new_tool) {
|
||||
$my_temp_tool_array[] = $my_list[$key];
|
||||
}
|
||||
|
||||
$blocks[] = [
|
||||
'class' => 'course-student-view-activity-3col',
|
||||
'content' => CourseHome::show_tools_category($my_temp_tool_array),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$activityView = new Template('', false, false, false, false, false, false);
|
||||
$activityView->assign('blocks', $blocks);
|
||||
|
||||
$content .= $activityView->fetch(
|
||||
$activityView->get_template('course_home/vertical_activity.tpl')
|
||||
);
|
||||
Reference in New Issue
Block a user