diff --git a/main/inc/ajax/lp.ajax.php b/main/inc/ajax/lp.ajax.php index 9aea0c8fbe..ec9c16ab47 100644 --- a/main/inc/ajax/lp.ajax.php +++ b/main/inc/ajax/lp.ajax.php @@ -8,45 +8,49 @@ require_once '../global.inc.php'; api_protect_course_script(true); $action = $_REQUEST['a']; -$course_id = api_get_course_int_id(); -$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); +$course_id = api_get_course_int_id(); +$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); -switch ($action) { +switch ($action) { case 'add_lp_item': - if (api_is_allowed_to_edit(null, true)) { + if (api_is_allowed_to_edit(null, true)) { if ($_SESSION['oLP']) { - //Updating the lp.modified_on - $_SESSION['oLP']->set_modified_on(); - echo $_SESSION['oLP']->add_item($_REQUEST['parent_id'], $_REQUEST['previous_id'], $_REQUEST['type'], $_REQUEST['id'], $_REQUEST['title'], null); + //Updating the lp.modified_on + $_SESSION['oLP']->set_modified_on(); + echo $_SESSION['oLP']->add_item($_REQUEST['parent_id'], $_REQUEST['previous_id'], $_REQUEST['type'], $_REQUEST['id'], $_REQUEST['title'], null); } } - break; + break; case 'update_lp_item_order': if (api_is_allowed_to_edit(null, true)) { $new_order = $_POST['new_order']; - $sections = explode('^', $new_order); + $sections = explode('^', $new_order); $new_array = array(); $i = 0; + foreach ($sections as $items) { - list($id, $parent_id) = explode('|', $items); - $new_array[$i]['id'] = intval($id); - $new_array[$i]['parent_id'] = intval($parent_id); - $i++; - } + if (!empty($items)) { + list($id, $parent_id) = explode('|', $items); + $new_array[$i]['id'] = intval($id); + $new_array[$i]['parent_id'] = intval($parent_id); + $i++; + } + } + $counter = 1; for ($i=0; $i < count($new_array); $i++) { - $params = array(); + $params = array(); $id = $new_array[$i]['id']; if (empty($id)) { continue; } $parent_id = isset($new_array[$i]['parent_id']) ? $new_array[$i]['parent_id'] : 0; - $params['display_order'] = $counter; + $params['display_order'] = $counter; $params['previous_item_id'] = isset($new_array[$i-1]) && isset($new_array[$i-1]['id']) ? $new_array[$i-1]['id'] : 0; - $params['next_item_id'] = isset($new_array[$i+1]) && isset($new_array[$i+1]['id']) ? $new_array[$i+1]['id'] : 0; - $params['parent_item_id'] = $parent_id; + $params['next_item_id'] = isset($new_array[$i+1]) && isset($new_array[$i+1]['id']) ? $new_array[$i+1]['id'] : 0; + $params['parent_item_id'] = $parent_id; Database::update($tbl_lp_item, $params, array('id = ? AND c_id = ? '=> array(intval($id), $course_id))); - $counter ++; + $counter ++; } Display::display_confirmation_message(get_lang('Saved')); } diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 71d9df0ceb..fb1ce36c45 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -1608,7 +1608,7 @@ class learnpath { } $this->last = $this->current; // current is - $this->current = $this->ordered_items[$index]; + $this->current = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null; $this->index = $index; if ($this->debug > 2) { error_log('$index ' . $index); @@ -5030,6 +5030,8 @@ class learnpath { $this->tree_array($arrLP); $arrLP = $this->arrMenu; unset ($this->arrMenu); + $default_data = null; + $default_content = null; $elements = array(); for ($i = 0; $i < count($arrLP); $i++) { @@ -6618,7 +6620,9 @@ class learnpath { } $this->tree_array($arrLP); - $arrLP = $this->arrMenu; + + $arrLP = isset($this->arrMenu) ? $this->arrMenu : null; + unset ($this->arrMenu); $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null; @@ -7914,7 +7918,7 @@ class learnpath { $return .= ' '; $return .= ''; - $return .= ''. + $return .= ''. ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . ''; $return .= ''; } @@ -7927,7 +7931,7 @@ class learnpath { $return .= ' '; $return .= ''; - $return .= '' . + $return .= '' . Security :: remove_XSS(cut($row_quiz['title'], 80)). ''; $return .= ''; @@ -7987,7 +7991,7 @@ class learnpath { $return = '
'; $return .= '
'; $return .= ''; - $return .= '' . get_lang('AddAssignmentPage') . ''; + $return .= '' . get_lang('AddAssignmentPage') . ''; $return .= '
'; $return .= '
'; return $return; diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 770826d0db..5790060887 100644 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -41,8 +41,8 @@ class bbb { } // Setting BBB api - define(CONFIG_SECURITY_SALT, $this->salt); - define(CONFIG_SERVER_BASE_URL, $this->url); + define('CONFIG_SECURITY_SALT', $this->salt); + define('CONFIG_SERVER_BASE_URL', $this->url); $this->api = new BigBlueButtonBN(); $this->plugin_enabled = true; diff --git a/plugin/bbb/listing.php b/plugin/bbb/listing.php index 1e4aa67362..864e2248c8 100644 --- a/plugin/bbb/listing.php +++ b/plugin/bbb/listing.php @@ -18,6 +18,7 @@ $action = isset($_GET['action']) ? $_GET['action'] : null; $teacher = api_is_course_admin() || api_is_coach() || api_is_platform_admin(); api_protect_course_script(true); +$message = null; if ($teacher) { switch ($action) { @@ -80,7 +81,7 @@ $tpl->assign('conference_url', $conference_url); $tpl->assign('users_online', $users_online); $tpl->assign('bbb_status', $status); -$tpl->assign('actions', $actions); +//$tpl->assign('actions', $actions); $tpl->assign('message', $message); $listing_tpl = 'bbb/listing.tpl'; $content = $tpl->fetch($listing_tpl);