|
|
|
@ -12,49 +12,10 @@ api_protect_course_script(); |
|
|
|
|
require 'learnpath_functions.inc.php'; |
|
|
|
|
require 'resourcelinker.inc.php'; |
|
|
|
|
|
|
|
|
|
$language_file = 'learnpath'; |
|
|
|
|
|
|
|
|
|
/* Header and action code */ |
|
|
|
|
|
|
|
|
|
$currentstyle = api_get_setting('stylesheets'); |
|
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
|
function setFocus(){ |
|
|
|
|
$("#learnpath_title").focus(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
|
|
setFocus(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
function activate_start_date() { |
|
|
|
|
if(document.getElementById(\'start_date_div\').style.display == \'none\') { |
|
|
|
|
document.getElementById(\'start_date_div\').style.display = \'block\'; |
|
|
|
|
} else { |
|
|
|
|
document.getElementById(\'start_date_div\').style.display = \'none\'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function activate_end_date() { |
|
|
|
|
if(document.getElementById(\'end_date_div\').style.display == \'none\') { |
|
|
|
|
document.getElementById(\'end_date_div\').style.display = \'block\'; |
|
|
|
|
} else { |
|
|
|
|
document.getElementById(\'end_date_div\').style.display = \'none\'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
/* Constants and variables */ |
|
|
|
|
|
|
|
|
|
$is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
|
|
|
|
|
|
|
|
$isStudentView = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView'] : null; |
|
|
|
|
$learnpath_id = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : null; |
|
|
|
|
|
|
|
|
|
/* MAIN CODE */ |
|
|
|
|
|
|
|
|
|
if ((!$is_allowed_to_edit) || ($isStudentView)) { |
|
|
|
|
//error_log('New LP - User not authorized in lp_add.php'); |
|
|
|
|
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id); |
|
|
|
|
if (!$is_allowed_to_edit) { |
|
|
|
|
header('location:lp_controller.php?action=list&'.api_get_cidreq()); |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -73,7 +34,7 @@ $form->addElement('hidden', 'action', 'add_lp_category'); |
|
|
|
|
$form->addElement('hidden', 'c_id', api_get_course_int_id()); |
|
|
|
|
$form->addElement('hidden', 'id', 0); |
|
|
|
|
|
|
|
|
|
$form->addElement('style_submit_button', 'Submit', get_lang('Save'),'class="save"'); |
|
|
|
|
$form->addButtonSave(get_lang('Save')); |
|
|
|
|
|
|
|
|
|
if ($form->validate()) { |
|
|
|
|
$values = $form->getSubmitValues(); |
|
|
|
|