diff --git a/main/coursecopy/classes/CourseBuilder.class.php b/main/coursecopy/classes/CourseBuilder.class.php index a87eacc5d8..96e05336b7 100644 --- a/main/coursecopy/classes/CourseBuilder.class.php +++ b/main/coursecopy/classes/CourseBuilder.class.php @@ -588,13 +588,12 @@ class CourseBuilder { * Build the course-descriptions */ function build_course_descriptions($session_id = 0,$course_code = '', $with_base_content = false) { - $course_info = api_get_course_info($course_code); + $course_info = api_get_course_info($course_code); $course_id = $course_info['real_id']; $table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION); - if (!empty($session_id) && !empty($course_code)) { - + if (!empty($session_id) && !empty($course_code)) { $session_id = intval($session_id); if ($with_base_content) { $session_condition = api_get_session_condition($session_id, true, true); diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 0053e6c01d..f36d044942 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -4834,8 +4834,9 @@ class learnpath { $return .= ' '.Display :: return_icon('i.gif'); $return .= ' '. Display :: return_icon('add.png', get_lang('NewStep'),'','32').''; - $return .= ' - '. Display :: return_icon('add_learnpath_section.png', get_lang('NewChapter'),'','32').''; + + /*$return .= ' + '. Display :: return_icon('add_learnpath_section.png', get_lang('NewChapter'),'','32').'';*/ if ($update_audio == 'true') { $return .= Display::url(Display :: return_icon('upload_audio_na.png', get_lang('UpdateAllAudioFragments'),'','32'),'#'); } else { @@ -5360,11 +5361,11 @@ class learnpath { $return = ''; if (is_numeric($item_id)) { $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); - $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); + $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp WHERE c_id = ".$course_id." AND lp.id = " . Database :: escape_string($item_id); $result = Database::query($sql); - while ($row = Database :: fetch_array($result)) { + while ($row = Database :: fetch_array($result,'ASSOC')) { $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0; // Prevents wrong parent selection for document, see Bug#1251. @@ -5374,27 +5375,26 @@ class learnpath { $return .= $this->display_manipulate($item_id, $row['item_type']); $return .= '
'; + if ($msg != '') $return .= $msg; - $return .= '

' . $row['title'] . '

'; - //$return .= '

' . ((trim($row['description']) == '') ? 'no description' : stripslashes($row['description'])) . '

'; - //$return .= '
'; + + $return .= '

'.$row['title'].'

'; + //var_dump($row); switch ($row['item_type']) { case TOOL_QUIZ: if (!empty($row['path'])) { require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; $exercise = new Exercise(); - $exercise->read($row['path']); - // $exercise_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exercise->id.'&'.api_get_cidReq().'&id_session='.api_get_session_id(); - $return .=$exercise->description.'
'; - //$return .=Display::url($exercise_url, $exercise_url).'
';*/ + $exercise->read($row['path']); + $return .= $exercise->description.'
'; } break; case TOOL_DOCUMENT: $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); $sql_doc = "SELECT path FROM " . $tbl_doc . " WHERE c_id = ".$course_id." AND id = " . Database :: escape_string($row['path']); $result = Database::query($sql_doc); - $path_file = Database :: result($result, 0, 0); + $path_file = Database::result($result, 0, 0); $path_parts = pathinfo($path_file); // TODO: Correct the following naive comparisons, also, htm extension is missing. if (in_array($path_parts['extension'], array ( @@ -5538,7 +5538,7 @@ class learnpath { Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array(), 64) ); - $chapter = $_SESSION['oLP']->display_item_form('chapter', get_lang('EnterDataNewChapter')); + $chapter = $_SESSION['oLP']->display_item_form('chapter', get_lang('EnterDataNewChapter'), 'add_item'); echo Display::tabs($headers, array($documents, $exercises, $links, $works, $forums, $chapter), 'resource_tab'); return true; } @@ -6417,7 +6417,7 @@ class learnpath { * @param mixed Extra info * @return string HTML form */ - public function display_item_form($item_type, $title = '', $action = 'add', $id = 0, $extra_info = 'new') { + public function display_item_form($item_type, $title = '', $action = 'add_item', $id = 0, $extra_info = 'new') { $course_id = api_get_course_int_id(); global $_course; global $charset; @@ -6479,8 +6479,13 @@ class learnpath { $return .= '
'; - - $form = new FormValidator('form', 'POST', api_get_self() . '?' . $_SERVER['QUERY_STRING']); + + + $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null; + $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; + //var_dump(api_get_self() . '?' . $_SERVER['QUERY_STRING']); + + $form = new FormValidator('form', 'POST', $url); $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset); $defaults['description'] = $item_description; @@ -7776,28 +7781,28 @@ class learnpath { $res_quiz = Database::query($sql_quiz); $res_hot = Database::query($sql_hot); - //$return .= '
' . get_lang('Quiz') . '
'; $return = '
'; $return .= '
'; + //$return .= Display::return_icon('new_exercice.png', '', array(), 32); //''; $return .= ''; $return .= '' . get_lang('NewExercise') . ''; - $return .= '
'; - + $return .= '
'; while ($row_hot = Database :: fetch_array($res_hot)) { $return .= '
'; // Display quizhotpotatoes. $return .= 'hp'; $return .= '' . ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . ''; - //$return .= $row_quiz['title']; $return .= '
'; } while ($row_quiz = Database :: fetch_array($res_quiz)) { $return .= '
'; $return .= ''; - $return .= '' . Security :: remove_XSS($row_quiz['title']) . ''; + //$return .= Display::return_icon('quiz.png', '', array(), 32); //''; + $return .= '' . + Security :: remove_XSS(cut($row_quiz['title'], 80)).''; //$return .= $row_quiz['title']; $return .= '
'; } diff --git a/main/newscorm/lp_build.php b/main/newscorm/lp_build.php index 7f813320f6..fa6daeaffe 100644 --- a/main/newscorm/lp_build.php +++ b/main/newscorm/lp_build.php @@ -143,7 +143,7 @@ echo ''; $learnpathadded = '

'.get_lang('LearnPathAddedTitle').'


'; $learnpathadded .= ''.Display::return_icon('new_learnigpath_object.png', get_lang('NewStep'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewStep').': '.get_lang('NewStepComment').'
'; - $learnpathadded .= ''.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewChapter').': '.get_lang('NewChapterComment').'
'; + //$learnpathadded .= ''.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewChapter').': '.get_lang('NewChapterComment').'
'; $learnpathadded .= ''.Display::return_icon('build_learnpath.png', get_lang('Build'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('Build').": ".get_lang('BuildComment').'
'; $learnpathadded .= ''.Display::return_icon('move_learnpath.png', get_lang('BasicOverview'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('BasicOverview').': '.get_lang('BasicOverviewComment').'
'; $learnpathadded .= ''.Display::return_icon('view_left_right.png', get_lang('Display'),array('style' => 'vertical-align: middle;'),'22').' '.get_lang('Display').': '.get_lang('DisplayComment').'
'; diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index 6cf6a396ca..4562a298d6 100644 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -247,10 +247,9 @@ switch ($action) { } else { // For all other item types than documents, load the item using the item type and path rather than its ID. $new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $_POST['path'], $_POST['title'], $_POST['description'], $_POST['prerequisites'], $_POST['maxTimeAllowed']); - } - + } // Display. - require 'lp_add_item.php'; + require 'lp_add_item.php'; } } else { require 'lp_add_item.php'; diff --git a/main/newscorm/lp_edit.php b/main/newscorm/lp_edit.php index 34a8f58e3b..2d498db942 100644 --- a/main/newscorm/lp_edit.php +++ b/main/newscorm/lp_edit.php @@ -63,8 +63,8 @@ echo ' '.Display::return_icon('i.gif'); echo ' '.Display::return_icon('add.png', get_lang('NewStep'),'','32').''; -echo ' -'.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'),'','32').''; +/*echo ' +'.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'),'','32').'';*/ echo ''.Display::return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'','32').''; diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index 80e91460bb..3f9d59f138 100644 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -100,17 +100,18 @@ unset($_SESSION['questionList']); if (!isset($src)) { $src = ''; + switch($lp_type) { case 1: $_SESSION['oLP']->stop_previous_item(); $htmlHeadXtra[] = ''; $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id); - if ($prereq_check === true) { - $src = $_SESSION['oLP']->get_link('http', $lp_item_id); + if ($prereq_check === true) { + $src = $_SESSION['oLP']->get_link('http', $lp_item_id); //Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP. $file_info = parse_url($src); - $file_info = pathinfo($file_info['path']); + $file_info = pathinfo($file_info['path']); if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) { //$src = api_get_path(WEB_CODE_PATH).'newscorm/lp_view_item.php?src='.$src; $src = api_get_path(WEB_CODE_PATH).'newscorm/lp_view_item.php?lp_item_id='.$lp_item_id; @@ -369,8 +370,6 @@ if ($_SESSION['oLP']->mode == 'embedframe' ||$_SESSION['oLP']->get_hide_toc_fram
- - mode == 'fullscreen') { diff --git a/main/newscorm/lp_view_item.php b/main/newscorm/lp_view_item.php index 2bb4c7c0ba..a1b300ea7e 100644 --- a/main/newscorm/lp_view_item.php +++ b/main/newscorm/lp_view_item.php @@ -33,6 +33,7 @@ require_once 'resourcelinker.inc.php'; // Including the global initialization file. require_once '../inc/global.inc.php'; + api_protect_course_script(); if (isset($_GET['lp_item_id'])) { @@ -66,7 +67,7 @@ $_SESSION['whereami'] = 'lp/build'; if (isset($_SESSION['oLP']) && isset($_GET['id'])) { $_SESSION['oLP'] -> current = intval($_GET['id']); } -$this_section=SECTION_COURSES; +$this_section = SECTION_COURSES; /* Libraries */