You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
4.3 KiB
163 lines
4.3 KiB
15 years ago
|
<?php
|
||
15 years ago
|
/* For licensing terms, see /license.txt */
|
||
14 years ago
|
|
||
15 years ago
|
/**
|
||
14 years ago
|
* This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
|
||
15 years ago
|
*
|
||
|
* @author Patrick Cool
|
||
|
* @author Denes Nagy
|
||
|
* @author Roan Embrechts, refactoring and code cleaning
|
||
|
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
|
||
15 years ago
|
* @package chamilo.learnpath
|
||
15 years ago
|
*/
|
||
14 years ago
|
|
||
|
$this_section = SECTION_COURSES;
|
||
15 years ago
|
|
||
|
api_protect_course_script();
|
||
|
|
||
15 years ago
|
include 'learnpath_functions.inc.php';
|
||
14 years ago
|
|
||
|
/* Header and action code */
|
||
14 years ago
|
$htmlHeadXtra[] = '<script type="text/javascript">'.
|
||
|
$_SESSION['oLP']->get_js_dropdown_array() .
|
||
9 years ago
|
"
|
||
|
function load_cbo(id) {
|
||
|
if (!id) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
var cbo = document.getElementById('previous');
|
||
|
|
||
|
for(var i = cbo.length - 1; i > 0; i--) {
|
||
|
cbo.options[i] = null;
|
||
|
}
|
||
|
|
||
|
var k=0;
|
||
|
|
||
|
for(var i = 1; i <= child_name[id].length; i++) {
|
||
|
cbo.options[i] = new Option(child_name[id][i - 1], child_value[id][i - 1]);
|
||
|
k=i;
|
||
|
}
|
||
|
|
||
|
cbo.options[k].selected = true;
|
||
|
$('#previous').selectpicker('refresh');
|
||
|
}
|
||
|
" .
|
||
|
"\n" .
|
||
14 years ago
|
'$().ready(function() {'."\n" .
|
||
14 years ago
|
'if ($(\'#previous\')) {'."\n" .
|
||
14 years ago
|
'if(\'parent is\'+$(\'#idParent\').val()) {'.
|
||
|
'load_cbo($(\'#idParent\').val());'."\n" .
|
||
|
'}}'."\n" .
|
||
|
'});</script>'."\n" ;
|
||
14 years ago
|
|
||
|
/* Constants and variables */
|
||
|
|
||
|
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
|
||
15 years ago
|
|
||
9 years ago
|
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
|
||
15 years ago
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
|
||
|
$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
|
||
|
|
||
9 years ago
|
$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : '';
|
||
|
$learnpath_id = (int) $_REQUEST['lp_id'];
|
||
|
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : '';
|
||
14 years ago
|
|
||
|
/* MAIN CODE */
|
||
|
if ((!$is_allowed_to_edit) || ($isStudentView)) {
|
||
14 years ago
|
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
|
||
15 years ago
|
}
|
||
14 years ago
|
// From here on, we are admin because of the previous condition, so don't check anymore.
|
||
15 years ago
|
|
||
13 years ago
|
$course_id = api_get_course_int_id();
|
||
9 years ago
|
$sql = "SELECT * FROM $tbl_lp
|
||
|
WHERE c_id = $course_id AND id = $learnpath_id";
|
||
13 years ago
|
|
||
9 years ago
|
$result = Database::query($sql);
|
||
14 years ago
|
$therow = Database::fetch_array($result);
|
||
15 years ago
|
|
||
|
/*
|
||
14 years ago
|
Course admin section
|
||
|
- all the functions not available for students - always available in this case (page only shown to admin)
|
||
15 years ago
|
*/
|
||
14 years ago
|
/* SHOWING THE ADMIN TOOLS */
|
||
15 years ago
|
|
||
9 years ago
|
if (isset($_SESSION['gradebook'])) {
|
||
14 years ago
|
$gradebook= $_SESSION['gradebook'];
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
if (!empty($gradebook) && $gradebook == 'view') {
|
||
14 years ago
|
$interbreadcrumb[] = array (
|
||
9 years ago
|
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
|
||
|
'name' => get_lang('ToolGradebook')
|
||
|
);
|
||
15 years ago
|
}
|
||
|
|
||
9 years ago
|
$interbreadcrumb[] = array(
|
||
|
'url' => 'lp_controller.php?action=list?'.api_get_cidreq(),
|
||
|
'name' => get_lang('LearningPaths'),
|
||
|
);
|
||
|
$interbreadcrumb[] = array(
|
||
|
'url' => api_get_self()."?action=build&lp_id=$learnpath_id&".api_get_cidreq(),
|
||
|
'name' => stripslashes("{$therow['name']}"),
|
||
|
);
|
||
|
$interbreadcrumb[] = array(
|
||
|
'url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id&".api_get_cidreq(),
|
||
|
'name' => get_lang('NewStep'),
|
||
|
);
|
||
15 years ago
|
|
||
14 years ago
|
// Theme calls
|
||
|
$show_learn_path = true;
|
||
|
$lp_theme_css = $_SESSION['oLP']->get_theme();
|
||
15 years ago
|
|
||
13 years ago
|
Display::display_header(get_lang('Move'), 'Path');
|
||
15 years ago
|
|
||
9 years ago
|
$suredel = trim(get_lang('AreYouSureToDeleteJS'));
|
||
15 years ago
|
?>
|
||
|
<script type='text/javascript'>
|
||
|
/* <![CDATA[ */
|
||
|
function stripslashes(str) {
|
||
14 years ago
|
str=str.replace(/\\'/g,'\'');
|
||
|
str=str.replace(/\\"/g,'"');
|
||
|
str=str.replace(/\\\\/g,'\\');
|
||
|
str=str.replace(/\\0/g,'\0');
|
||
|
return str;
|
||
15 years ago
|
}
|
||
|
function confirmation(name)
|
||
|
{
|
||
14 years ago
|
name=stripslashes(name);
|
||
|
if (confirm("<?php echo $suredel; ?> " + name + " ?"))
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
15 years ago
|
}
|
||
|
</script>
|
||
|
<?php
|
||
|
|
||
|
echo $_SESSION['oLP']->build_action_menu();
|
||
10 years ago
|
echo '<div class="row">';
|
||
|
echo '<div class="col-md-3">';
|
||
13 years ago
|
echo $_SESSION['oLP']->return_new_tree();
|
||
13 years ago
|
echo '</div>';
|
||
|
|
||
10 years ago
|
echo '<div class="col-md-9">';
|
||
13 years ago
|
|
||
|
if (isset($is_success) && $is_success === true) {
|
||
|
$msg = '<div class="lp_message" style="margin-bottom:10px;">';
|
||
9 years ago
|
$msg .= 'The item has been moved.';
|
||
13 years ago
|
$msg .= '</div>';
|
||
|
echo $_SESSION['oLP']->display_item($_GET['id'], $msg);
|
||
|
} else {
|
||
|
echo $_SESSION['oLP']->display_move_item($_GET['id']);
|
||
|
}
|
||
|
echo '</div>';
|
||
|
echo '</div>';
|
||
15 years ago
|
|
||
14 years ago
|
/* FOOTER */
|
||
|
|
||
15 years ago
|
Display::display_footer();
|