Minor - Adding messages

skala
Julio Montoya 12 years ago
parent 531f5e71cc
commit 42434e8edc
  1. 5
      main/newscorm/learnpath.class.php
  2. 11
      main/newscorm/lp_add_item.php
  3. 10
      main/newscorm/lp_controller.php

@ -4042,7 +4042,6 @@ class learnpath {
} else { } else {
return false; return false;
} }
} }
/** /**
@ -4367,7 +4366,7 @@ class learnpath {
if ($this->debug > 2) { if ($this->debug > 2) {
error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0); error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
} }
$res = Database::query($sql); Database::query($sql);
return true; return true;
} }
@ -5310,7 +5309,7 @@ class learnpath {
$buttons = array( $buttons = array(
array( array(
'title' => get_lang('SetPrerequisiteFoEachItem'), 'title' => get_lang('SetPrerequisiteForEachItem'),
'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id, 'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
), ),
array( array(

@ -248,10 +248,14 @@ echo '<div id="lp_sidebar" class="span4">';
echo $_SESSION['oLP']->return_new_tree(null, true); echo $_SESSION['oLP']->return_new_tree(null, true);
$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
// Show the template list. // Show the template list.
if ($type == 'document' && !isset($_GET['file'])) { if ($type == 'document' && !isset($_GET['file'])) {
// Show the template list. // Show the template list.
echo '<div id="frmModel" style="display:block; height:890px;width:100px; position:relative;"></div>';} echo '<div id="frmModel" style="display:block; height:890px;width:100px; position:relative;"></div>';
}
echo '</div>'; echo '</div>';
//hide bar div //hide bar div
@ -261,6 +265,11 @@ if ($action == 'add_item' && $type == 'document' && !isset($_GET['file'])) {
echo '<div id="doc_form" class="span8">'; echo '<div id="doc_form" class="span8">';
//@todo use session flash messages
if (in_array($message, array('ItemUpdated'))) {
echo Display::return_message(get_lang($message));
}
if (isset($new_item_id) && is_numeric($new_item_id)) { if (isset($new_item_id) && is_numeric($new_item_id)) {
switch ($type) { switch ($type) {
case 'chapter': case 'chapter':

@ -100,6 +100,7 @@ $lpfound = false;
$myrefresh = 0; $myrefresh = 0;
$myrefresh_id = 0; $myrefresh_id = 0;
if (!empty($_SESSION['refresh']) && $_SESSION['refresh'] == 1) { if (!empty($_SESSION['refresh']) && $_SESSION['refresh'] == 1) {
// Check if we should do a refresh of the oLP object (for example after editing the LP). // Check if we should do a refresh of the oLP object (for example after editing the LP).
// If refresh is set, we regenerate the oLP object from the database (kind of flush). // If refresh is set, we regenerate the oLP object from the database (kind of flush).
@ -223,8 +224,6 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
} }
} }
$action = (!empty($_REQUEST['action']) ? $_REQUEST['action'] : ''); $action = (!empty($_REQUEST['action']) ? $_REQUEST['action'] : '');
switch ($action) { switch ($action) {
@ -965,7 +964,7 @@ switch ($action) {
require 'lp_list.php'; require 'lp_list.php';
} else { } else {
if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); } if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); }
if ( !empty($_REQUEST['item_id']) ) { if (!empty($_REQUEST['item_id']) ) {
$_SESSION['oLP']->set_current_item($_REQUEST['item_id']); $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
} }
require 'lp_impress.php'; require 'lp_impress.php';
@ -973,17 +972,16 @@ switch ($action) {
break; break;
case 'set_previous_step_as_prerequisite': case 'set_previous_step_as_prerequisite':
$_SESSION['oLP']->set_previous_step_as_prerequisite_for_all_items(); $_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); $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
header('Location: '.$url); header('Location: '.$url);
break; break;
case 'clear_prerequisites': case 'clear_prerequisites':
$_SESSION['oLP']->clear_prerequisites(); $_SESSION['oLP']->clear_prerequisites();
$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)."&message=ItemUpdated";
header('Location: '.$url); header('Location: '.$url);
break; break;
default: default:
if ($debug > 0) error_log('New LP - default action triggered', 0); if ($debug > 0) error_log('New LP - default action triggered', 0);
//$_SESSION['refresh'] = 1;
require 'lp_list.php'; require 'lp_list.php';
break; break;
} }

Loading…
Cancel
Save