Add api_get_cidreq

ofaj
jmontoyaa 10 years ago
parent e2c1d77d61
commit a9d20f8e68
  1. 31
      main/newscorm/learnpath.class.php
  2. 12
      main/newscorm/lp_add_audio.php
  3. 12
      main/newscorm/lp_admin_view.php
  4. 37
      main/newscorm/lp_build.php
  5. 29
      main/newscorm/lp_controller.php
  6. 1
      main/newscorm/lp_edit.php
  7. 10
      main/newscorm/lp_edit_item.php
  8. 10
      main/newscorm/lp_edit_item_prereq.php
  9. 4
      main/newscorm/lp_impress.php
  10. 15
      main/newscorm/lp_move_item.php
  11. 2
      main/newscorm/lp_view.php

@ -4768,12 +4768,12 @@ class learnpath
if ($this->debug > 0) {
error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
}
if (intval($hide) == $hide){
if (intval($hide) == $hide) {
$this->hide_toc_frame = $hide;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
$sql = "UPDATE $lp_table SET
hide_toc_frame = '" . $this->hide_toc_frame . "'
hide_toc_frame = '" . (int) $this->hide_toc_frame . "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
@ -4890,17 +4890,18 @@ class learnpath
if (!empty($expired_on)) {
$this->expired_on = api_get_utc_datetime($expired_on);
} else {
$this->expired_on = '';
$this->expired_on = null;
}
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
$sql = "UPDATE $lp_table SET
expired_on = '" . Database::escape_string($this->expired_on) . "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
}
Database::query($sql);
$params = [
'expired_on' => $this->expired_on,
];
Database::update($lp_table, $params, ['c_id = ? AND id = ?' => [$course_id, $lp_id]], true);
return true;
}
@ -4953,6 +4954,7 @@ class learnpath
error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
}
Database::query($sql);
return true;
}
@ -5500,7 +5502,7 @@ class learnpath
// we need to start a form when we want to update all the mp3 files
if ($update_audio == 'true') {
$return .= '<form action="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
$return .= '<form action="' . api_get_self() . '?'.api_get_cidreq().'&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
}
$return .= '<div id="message"></div>';
if (count($this->items) == 0) {
@ -5516,7 +5518,10 @@ class learnpath
$return .= '<div class="col-md-12">';
$return .= self::return_new_tree($update_audio);
$return .='</div>';
$return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
$return .= Display::div(
Display::url(get_lang('Save'), '#', array('id' => 'listSubmit', 'class' => 'btn btn-primary')),
array('style' => 'float:left; margin-top:15px;width:100%')
);
} else {
$return_audio .= self::return_new_tree($update_audio);
$return .= $return_audio.'</table>';
@ -5525,9 +5530,12 @@ class learnpath
// We need to close the form when we are updating the mp3 files.
if ($update_audio == 'true') {
$return .= '<div class="footer-audio">';
$return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
$return .= Display::button(
'save_audio',
'<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'),
array('class' => 'btn btn-primary', 'type' => 'submit')
);
$return .= '</div>';
//$return .= '<div><button class="btn btn-primary" type="submit" name="save_audio" id="save_audio">' . get_lang('SaveAudioAndOrganization') . '</button></div>'; // TODO: What kind of language variable is this?
}
}
@ -5535,6 +5543,7 @@ class learnpath
if ($update_audio == 'true' && count($this->arrMenu) != 0) {
$return .= '</form>';
}
return $return;
}

@ -51,11 +51,17 @@ $interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpa
switch ($type) {
case 'chapter':
$interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$_SESSION['oLP']->get_id(), 'name' => get_lang('NewStep'));
$interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewChapter'));
$interbreadcrumb[] = array(
'url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$_SESSION['oLP']->get_id().'&'.api_get_cidreq(),
'name' => get_lang('NewStep'),
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewChapter'));
break;
case 'document':
$interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$_SESSION['oLP']->get_id(), 'name' => get_lang('NewStep'));
$interbreadcrumb[] = array(
'url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$_SESSION['oLP']->get_id().'&'.api_get_cidreq(),
'name' => get_lang('NewStep'),
);
break;
default:
$interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep'));

@ -68,8 +68,14 @@ if (!empty($gradebook) && $gradebook == 'view') {
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}"));
$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep'));
$interbreadcrumb[] = array(
'url' => api_get_self()."?action=build&lp_id=$learnpath_id",
"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'),
);
if (isset($_REQUEST['updateaudio'])) {
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UpdateAllAudioFragments'));
@ -153,7 +159,7 @@ if (isset($_POST['save_audio'])) {
}
}
//Display::display_confirmation_message(get_lang('ItemUpdated'));
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
header('Location: '.$url);
exit;
}

@ -131,15 +131,18 @@ if (isset($is_success) && $is_success === true) {
echo Display::page_subheader(get_lang('LearnPathAddedTitle'));
echo '<ul id="lp_overview" class="thumbnails">';
echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add_item&type=step&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png');
// echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=admin_view&updateaudio=true&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("BasicOverview"), get_lang('BasicOverviewComment'), 'audio.png');
echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png');
//echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Settings"), null, 'reference.png');
echo show_block(
'lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add_item&type=step&lp_id='.$_SESSION['oLP']->lp_id,
get_lang("NewStep"),
get_lang('NewStepComment'),
'tools.png'
);
echo show_block(
'lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id,
get_lang("Display"),
get_lang('DisplayComment'),
'view.png'
);
echo '</ul>';
}
echo '</div>';
@ -148,14 +151,14 @@ echo '</div>';
function show_block($link, $title, $subtitle, $icon) {
$html = '<li class="col-md-4">';
$html .= '<div class="thumbnail">';
$html .= '<a href="'.$link.'" title="'.$title.'">';
$html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
$html .= '</a>';
$html .= '<div class="caption">';
$html .= '<strong>'.$title.'</strong></a> '.$subtitle;
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="thumbnail">';
$html .= '<a href="'.$link.'" title="'.$title.'">';
$html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
$html .= '</a>';
$html .= '<div class="caption">';
$html .= '<strong>'.$title.'</strong></a> '.$subtitle;
$html .= '</div>';
$html .= '</div>';
$html .= '</li>';
return $html;
}

@ -444,7 +444,7 @@ switch ($action) {
$maxTimeAllowed
);
}
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
header('Location: '.$url);
exit;
}
@ -603,8 +603,10 @@ switch ($action) {
api_not_allowed(true);
}
if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
else {
if (!$lp_found) {
error_log('New LP - No learnpath given for admin_view', 0);
require 'lp_list.php';
} else {
$_SESSION['refresh'] = 1;
require 'lp_admin_view.php';
}
@ -633,7 +635,7 @@ switch ($action) {
else {
$_SESSION['refresh'] = 1;
//require 'lp_build.php';
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
header('Location: '.$url);
exit;
}
@ -644,8 +646,10 @@ switch ($action) {
}
if ($debug > 0) error_log('New LP - edit item action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
else {
if (!$lp_found) {
error_log('New LP - No learnpath given for edit item', 0);
require 'lp_list.php';
} else {
$_SESSION['refresh'] = 1;
if (isset($_POST['submit_button']) && !empty($post_title)) {
@ -680,7 +684,7 @@ switch ($action) {
}
$is_success = true;
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
header('Location: '.$url);
exit;
}
@ -952,7 +956,10 @@ switch ($action) {
$_SESSION['oLP']->set_hide_toc_frame($hide_toc_frame);
$_SESSION['oLP']->set_prerequisite($_REQUEST['prerequisites']);
$_SESSION['oLP']->set_use_max_score($_REQUEST['use_max_score']);
$_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
if (isset($_REQUEST['subscribe_users'])) {
$_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
}
if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
$publicated_on = $_REQUEST['publicated_on'];
@ -1268,12 +1275,14 @@ switch ($action) {
break;
case 'set_previous_step_as_prerequisite':
$_SESSION['oLP']->set_previous_step_as_prerequisite_for_all_items();
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&".api_get_cidreq();
Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
header('Location: '.$url);
break;
case 'clear_prerequisites':
$_SESSION['oLP']->clear_prerequisites();
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&".api_get_cidreq();
Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
header('Location: '.$url);
break;
case 'toggle_seriousgame': //activate/deactive seriousgame_mode

@ -29,7 +29,6 @@ if (!empty($gradebook) && $gradebook == 'view') {
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=".$_SESSION['oLP']->get_id(), 'name' => $_SESSION['oLP']->get_name());
//$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep'));
$htmlHeadXtra[] = '<script>
function activate_start_date() {

@ -105,8 +105,14 @@ if (!empty($gradebook) && $gradebook == 'view') {
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep'));
$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'),
);
// Theme calls.
$show_learn_path = true;

@ -61,8 +61,14 @@ if (!empty($gradebook) && $gradebook == 'view') {
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self() . "?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
$interbreadcrumb[] = array('url' => api_get_self() . "?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep'));
$interbreadcrumb[] = array(
'url' => api_get_self()."?action=build&lp_id=$learnpath_id",
'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'),
);
// Theme calls.
$show_learn_path = true;

@ -58,11 +58,11 @@ if ($is_allowed_to_edit) {
echo '<div style="position: fixed; top: 0px; left: 0px; pointer-events: auto;width:100%">';
global $interbreadcrumb;
$interbreadcrumb[] = array(
'url' => 'lp_controller.php?action=list&isStudentView=false',
'url' => 'lp_controller.php?action=list&isStudentView=false&'.api_get_cidreq(),
'name' => get_lang('LearningPaths'),
);
$interbreadcrumb[] = array(
'url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false",
'url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false&".api_get_cidreq(),
'name' => $_SESSION['oLP']->get_name(),
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));

@ -100,9 +100,18 @@ if (!empty($gradebook) && $gradebook == 'view') {
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep'));
$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'),
);
// Theme calls
$show_learn_path = true;

@ -416,7 +416,7 @@ if ($is_allowed_to_edit) {
'name' => get_lang('LearningPaths')
);
$interbreadcrumb[] = array(
'url' => api_get_self() . "?action=add_item&type=step&lp_id={$_SESSION['oLP']->lp_id}&isStudentView=false",
'url' => api_get_self() . "?action=add_item&type=step&lp_id={$_SESSION['oLP']->lp_id}&isStudentView=false&".api_get_cidreq(),
'name' => $_SESSION['oLP']->get_name()
);
$interbreadcrumb[] = array(

Loading…
Cancel
Save