Hacked By AnonymousFox

Current Path : /home/missmand/public_html/js/lightbox/
Upload File :
Current File : /home/missmand/public_html/js/lightbox/course_home.tar

3column.php000064400000016213152002726450006643 0ustar00<?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();

// 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'] = api_get_path(WEB_IMG_PATH).$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\">",
			"&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)
 */

elseif ($destroy) {
	Database::query("UPDATE $TBL_ACCUEIL SET visibility='2' WHERE c_id = $course_id AND id = $id");
}

/* HIDE */

elseif ($hide) { // visibility 1 -> 0
	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');
}

/*	REACTIVATE */

elseif ($restore) { // 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');
}
/*
 * Editing "apparance" of  a tools  on the course Home Page.
 */
elseif (isset($update) && $update) {
	$result 	= Database::query("SELECT * FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id=$id");
	$tool		= Database::fetch_array($result);
	$racine		= $_configuration['root_sys'].'/'.$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 ($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) {
		$content .= "<table align=\"center\"><tr><td colspan=\"4\">
            <br /><br /><font color=\"#ff0000\">&nbsp;&nbsp;&nbsp;<strong>".get_lang('DelLk')."</strong>
			<br />&nbsp;&nbsp;&nbsp;
			<a href=\"".api_get_self()."\">".get_lang('No')."</a>
			&nbsp;|&nbsp;
			<a href=\"".api_get_self()."?delete=yes&amp;id=$id\">".get_lang('Yes')."</a>
			</font>
			<br /><br /><br />
			</td>
			</tr>
			</table>\n";
	} // if remove

	/*
	 * Process hiding a tools from aivailable tools.
	 * visibility=2 are only viewed by Dokeos Administrator visibility 0,1->2
	 */

	elseif (isset($delete) && $delete) {
		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\">&nbsp;</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 ($is_platformAdmin && 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";
2column.php000064400000010221152002726450006633 0ustar00<?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
 */



/*	MAIN CODE */

/* 	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 ($_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='.$id.'">'.get_lang('Yes').'</a>';
		$show_message .= Display :: return_message($msgDestroy, 'confirmation',false);
	}

	/*
	 * Process hiding a tools from available tools.
	 * visibility=2 are only view  by Dokeos Administrator (visibility 0,1->2)
	 */

	elseif ($_GET['destroy']) {
		Database::query("UPDATE $tool_table SET visibility='2' WHERE c_id = $course_id AND id='".$id."'");
	}

  	/*	HIDE */

	elseif ($_GET['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');
	}

    /*	REACTIVATE */

	elseif ($_GET["restore"]) { // visibility 0,2 -> 1
		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 />&nbsp;&nbsp;&nbsp;
            <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
            <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>';
}
activity.php000064400000010664152002726450007123 0ustar00<?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();

//	MAIN CODE

if (api_is_allowed_to_edit(null, true)) {
	// HIDE
	if (!empty($_GET['hide'])) {
		$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 />&nbsp;&nbsp;&nbsp;
            <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
            <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

// 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: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"/>&nbsp;&nbsp;';
			$content .=  get_lang('PleaseStandBy');
            $content .=  '</div>
		<div class="confirmation-message" id="id_confirmation_message" style="display:none"></div>
	</div>';


	if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {
        $content .= '<div class="courseadminview">
            <span class="viewcaption">'.get_lang('SessionData').'</span>
            <table class="course_activity_home">'.CourseHome::show_session_data($session_id).'
            </table>
        </div>';
	}
    $my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
	$items = CourseHome::show_tools_category($my_list);
    $content .= return_block(get_lang('Authoring'),  $items);

    $my_list = CourseHome::get_tools_category(TOOL_INTERACTION);

    $list2 = CourseHome::get_tools_category(TOOL_COURSE_PLUGIN);

    $my_list = array_merge($my_list,$list2);
    $items =  CourseHome::show_tools_category($my_list);

    $content .= return_block(get_lang('Interaction'),  $items);

    $my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
    $items = CourseHome::show_tools_category($my_list);

    $content .= return_block(get_lang('Administration'),  $items);

} elseif (api_is_coach()) {
	if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {

		$content .= '<div class="row">
			<span class="viewcaption">'.get_lang('SessionData').'</span>
			<table class="course_activity_home">';
				$content .= CourseHome::show_session_data($session_id);
             $content .=  '</table></div>';
	}

    $content .=  '<div class="row">';
				$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
				$content .= CourseHome::show_tools_category($my_list);
    $content .= '</div>';
    //	TOOLS AUTHORING

} else {
	$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
	if (count($my_list) > 0) {
        $content .= '<div class="row">';
        $content .= CourseHome::show_tools_category($my_list);
        $content .= '</div>';
	}
}

function return_block($title, $content) {
    $html = '<div class="row"><div class="span12"><div class="page-header"><h3>'.$title.'</h3></div></div></div><div class="row">'.$content.'</div>';
    return $html;
}course_home.php000064400000022133152002726450007571 0ustar00<?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...).
*
* 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
*/

/* 		INIT SECTION		*/


use \ChamiloSession as Session;

// Name of the language file that needs to be included.
$language_file = array('course_home','courses');
$use_anonymous = true;

// Inlcuding the global initialization file.
require dirname(__FILE__).'/../inc/global.inc.php';

// Delete LP sessions - commented out after seeing that normal
// users in their first learnpath step (1st SCO of a SCORM)
// cannot have their data saved if they "Return to course homepage"
// before any LMSFinish()
//unset($_SESSION['oLP']);
//unset($_SESSION['lpobject']);

$htmlHeadXtra[] ='<script>
$(document).ready(function() {
	$(".make_visible_and_invisible").attr("href", "javascript:void(0);");
	$(".make_visible_and_invisible > img").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];

		$.ajax({
			contentType: "application/x-www-form-urlencoded",
			beforeSend: function(objeto) {
				$(".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);
				//tool
				$("#toolimage_" + my_tool_id).attr("src", new_current_tool_image);
				//clase
				$("#tooldesc_" + my_tool_id).attr("class", info.tclass);
				$("#istooldesc_" + my_tool_id).attr("class", info.tclass);

				if (image_link == "visible.gif") {
					$("#" + tool_id).attr("alt", "'.get_lang('Activate', '').'");
					$("#" + tool_id).attr("title", "'.get_lang('Activate', '').'");
				} else {
					$("#" + tool_id).attr("alt", "'.get_lang('Deactivate', '').'");
					$("#" + tool_id).attr("title", "'.get_lang('Deactivate', '').'");
				}
				if (info.message == "is_active") {
					message = "'.get_lang('ToolIsNowVisible', '').'";
				} else {
					message = "'.get_lang('ToolIsNowHidden', '').'";
				}
				$(".normal-message").hide();
				$("#id_confirmation_message").html(message);
				$("#id_confirmation_message").show();
			}
		});
	});
});

/* toogle for post-it in course home */
$(function() {
	$(".thematic-postit-head").click(function() {
		$(".thematic-postit-center").slideToggle("fast");
	});
});

</script>';

// The section for the tabs
$this_section = SECTION_COURSES;

/*	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_COURSE_PLUGIN',            'toolcourseplugin'); //all plugins that can be enabled in courses
define('TOOL_ADMIN',                    'tooladmin');
define('TOOL_ADMIN_PLATFORM',           'tooladminplatform');

define('TOOL_STUDENT_VIEW',              'toolstudentview');
define('TOOL_ADMIN_VISIBLE',             'tooladminvisible');

$user_id 		= api_get_user_id();
$course_code 	= api_get_course_id();
$show_message = '';

//Deleting group session
Session::erase('toolgroup');
Session::erase('_gid');

$is_speacialcourse = CourseManager::is_special_course($course_code);

if ($is_speacialcourse) {
    $autoreg = Security::remove_XSS($_GET['autoreg']);
    if ($autoreg == 1) {
        CourseManager::subscribe_user($user_id, $course_code, $status = STUDENT);
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'subscribe') {
    if (Security::check_token('get')) {
        Security::clear_token();
        $auth = new Auth();
        $msg = $auth->subscribe_user($course_code);
        if (!empty($msg)) {
            $show_message .= Display::return_message(get_lang($msg));
        }
    }
}

/*	Is the user allowed here? */
api_protect_course_script(true);

/*  STATISTICS */

if (!isset($coursesAlreadyVisited[$course_code])) {
    event_access_course();
    $coursesAlreadyVisited[$course_code] = 1;
    Session::write('coursesAlreadyVisited', $coursesAlreadyVisited);
}

/*Auto launch code */
$show_autolunch_lp_warning = false;
$auto_launch = api_get_course_setting('enable_lp_auto_launch');
if (!empty($auto_launch)) {
    $session_id = api_get_session_id();
    if ($auto_launch == 2) { //LP list
        if (api_is_platform_admin() || api_is_allowed_to_edit()) {
            $show_autolunch_lp_warning = true;
        } else {
            $session_key = 'lp_autolunch_'.$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).'newscorm/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);
        $course_id = api_get_course_int_id();
        $condition = '';
        if (!empty($session_id)) {
            $condition =  api_get_session_condition($session_id);
            $sql = "SELECT id FROM $lp_table WHERE c_id = $course_id AND autolunch = 1 $condition LIMIT 1";
            $result = Database::query($sql);
            //If we found nothing in the session we just called the session_id =  0 autolunch
            if (Database::num_rows($result) ==  0) {
                $condition = '';
            } else {
            	//great, there is an specific auto lunch for this session we leave the $condition
            }
        }

        $sql = "SELECT id FROM $lp_table WHERE c_id = $course_id AND autolunch = 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 (api_is_platform_admin() || api_is_allowed_to_edit()) {
                	$show_autolunch_lp_warning = true;
                } else {
                    $session_key = 'lp_autolunch_'.$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).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id'];

                        $_SESSION[$session_key] = true;
                        header("Location: $url");
                        exit;
                    }
                }
            }
        }
    }
}

$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$temps = time();
$reqdate = "&reqdate=$temps";

/*	MAIN CODE */

/*	Introduction section (editable by course admins) */

$content = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, array(
		'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 */

require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';

if ($show_autolunch_lp_warning) {
    $show_message .= Display::return_message(get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'),'warning');
}
if (api_get_setting('homepage_view') == 'activity' || api_get_setting('homepage_view') == 'activity_big') {
	require 'activity.php';
} elseif (api_get_setting('homepage_view') == '2column') {
	require '2column.php';
} elseif (api_get_setting('homepage_view') == '3column') {
	require '3column.php';
} elseif (api_get_setting('homepage_view') == 'vertical_activity') {
	require 'vertical_activity.php';
}
$content = '<div id="course_tools">'.$content.'</div>';
$tpl = new Template(null);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
Session::erase('_gid');index.html000064400000000151152002726450006541 0ustar00<html>
<head>
<meta http-equiv="refresh" content="0; url=course_home.php">
</head>
<body>
</body>
</html>vertical_activity.php000064400000012144152002726450011007 0ustar00<?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
 */

//	MAIN CODE
$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 />&nbsp;&nbsp;&nbsp;
            <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
            <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

// 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"/>&nbsp;&nbsp;';
        $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>';
    }

    $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('Authoring').'</span>';
    $my_list  = CourseHome::get_tools_category(TOOL_AUTHORING);
    $content .= CourseHome::show_tools_category($my_list);
    $content .= '</div>';

    $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('Interaction').'</span>';
    $my_list  = CourseHome::get_tools_category(TOOL_INTERACTION);
    $content .= CourseHome::show_tools_category($my_list);
    $content .= '</div>';

    $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('Administration').'</span>';
    $my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
    $content .= CourseHome::show_tools_category($my_list);
    $content .= '</div>';

} 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>';
	}

    $content .=  '<div class="Authoringview">';
				$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
				$content .= CourseHome::show_tools_category($my_list);
    $content .= '</div>';
    //	TOOLS AUTHORING

} else {
	$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
	if (count($my_list) > 0) {
        $content .= '<div class="course-student-view-activity-3col">';
		//ordering by get_lang name
		$order_tool_list = array();
		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 = array();
		foreach($order_tool_list as $key=>$new_tool) {
			$my_temp_tool_array[] = $my_list[$key];
		}
		$my_list = $my_temp_tool_array;

		$i = 0;
		foreach($my_list as $new_tool) {
			if ($i >= 10) {
				$my_list2[] = $new_tool;
			} else {
				$my_list1[] = $new_tool;
			}
			$i++;
		}
		$content .=CourseHome::show_tools_category($my_list1);
		$content .=CourseHome::show_tools_category($my_list2);
        $content .= '</div>';
	}
}
$content .= '</div>';

Hacked By AnonymousFox1.0, Coded By AnonymousFox