Esempio n. 1
0
             Session::write('post_time', $_REQUEST['post_time']);
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
                 $publicated_on = $_REQUEST['publicated_on'];
             } else {
                 $publicated_on = null;
             }
             if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
                 $expired_on = $_REQUEST['expired_on'];
             } else {
                 $expired_on = null;
             }
             $new_lp_id = learnpath::add_lp(api_get_course_id(), Security::remove_XSS($_REQUEST['lp_name']), '', 'chamilo', 'manual', '', $publicated_on, $expired_on, $_REQUEST['category_id']);
             if (is_numeric($new_lp_id)) {
                 // TODO: Maybe create a first module directly to avoid bugging the user with useless queries
                 $learnPath = new learnpath(api_get_course_id(), $new_lp_id, api_get_user_id());
                 $learnPath->updateCurrentLpFromSession();
                 $url = api_get_self() . '?action=add_item&type=step&lp_id=' . intval($new_lp_id) . '&' . api_get_cidreq();
                 header("Location: {$url}&isStudentView=false");
                 exit;
             }
         }
     } else {
         require 'lp_add.php';
     }
     break;
 case 'admin_view':
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) {
         error_log('New LP - admin_view action triggered', 0);