Minor fixes when editing an LP + avoiding warning/notices

skala
Julio Montoya 15 years ago
parent ebe8c6d3b9
commit 4e35276058
  1. 7
      main/document/document.inc.php
  2. 49
      main/newscorm/learnpath.class.php
  3. 7
      main/newscorm/lp_add_item.php
  4. 52
      main/newscorm/lp_build.php
  5. 1
      main/newscorm/lp_edit_item.php
  6. 4
      main/newscorm/lp_view_item.php

@ -201,11 +201,14 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
}
$current_session_id = api_get_session_id();
$copy_to_myfiles = $open_in_new_window_link = null;
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
if (!$show_as_icon) {
if ($filetype == 'folder') {
if (api_is_allowed_to_edit() || api_is_platform_admin() || api_get_setting('students_download_folders') == 'true') {
//filter when I am into shared folder, I can show for donwload only my shared folder
if (isset($_GET['curdirpath']) && is_shared_folder($_GET['curdirpath'], $current_session_id)) {
if (is_shared_folder($curdirpath, $current_session_id)) {
if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link))|| preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) || api_is_allowed_to_edit() || api_is_platform_admin()) {
$force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.Display::return_icon($forcedownload_icon, get_lang('Download'), array(),22).'</a>';
}
@ -219,7 +222,7 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
//copy files to users myfiles
if (api_get_setting('users_copy_files') == 'true' && api_get_user_id() != 0){
$copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&curdirpath='.Security::remove_XSS($_GET['curdirpath']).'&amp;action=copytomyfiles&amp;id='.$url_path.$req_gid :api_get_self().'?'.api_get_cidreq();
$copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;action=copytomyfiles&amp;id='.$url_path.$req_gid :api_get_self().'?'.api_get_cidreq();
if ($filetype == 'file') {
$copy_to_myfiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(),22).'&nbsp;&nbsp;</a>';

@ -4804,14 +4804,14 @@ class learnpath {
$gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
echo '<div class="actions">';
echo Display :: return_icon('build_learnpath_na.png', get_lang('Build'),'','32');
echo '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;gradebook=' . $gradebook . '&amp;action=admin_view&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="' . get_lang('BasicOverview') . '">' . Display :: return_icon('move_learnpath.png', get_lang('BasicOverview'),'','32').'</a>';
echo '<a href="lp_controller.php?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('view_left_right.png', get_lang('Display'),'','32').'</a> ';
Display :: display_icon('i.gif');
echo '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;gradebook=' . $gradebook . '&amp;action=add_item&amp;type=step&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="' . get_lang('NewStep') . '">' . Display :: return_icon('new_learnigpath_object.png', get_lang('NewStep'),'','32').'</a>';
echo '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;gradebook=' . $gradebook . '&amp;action=add_item&amp;type=chapter&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="' . get_lang('NewChapter') . '">' . Display :: return_icon('add_learnpath_section.png', get_lang('NewChapter'),'','32').'</a>';
echo '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=admin_view&amp;lp_id=' . $_SESSION['oLP']->lp_id . '&amp;updateaudio=true">' . Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'','32').'</a>';
echo '<a href="lp_controller.php?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=edit&amp;lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('settings.png', get_lang('CourseSettings'),'','32').'</a>';
echo '<a href="' . api_get_self().'?'.api_get_cidreq().'&amp;gradebook=' . $gradebook . '&amp;action=admin_view&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="' . get_lang('BasicOverview') . '">' . Display :: return_icon('move_learnpath.png', get_lang('BasicOverview'),'','32').'</a>';
echo '<a href="lp_controller.php?'.api_get_cidreq().'&amp;gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('view_left_right.png', get_lang('Display'),'','32').'</a> ';
Display :: display_icon('i.gif');
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;gradebook=' . $gradebook . '&amp;action=add_item&amp;type=step&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="' . get_lang('NewStep') . '">' . Display :: return_icon('new_learnigpath_object.png', get_lang('NewStep'),'','32').'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;gradebook=' . $gradebook . '&amp;action=add_item&amp;type=chapter&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="' . get_lang('NewChapter') . '">' . Display :: return_icon('add_learnpath_section.png', get_lang('NewChapter'),'','32').'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=admin_view&amp;lp_id=' . $_SESSION['oLP']->lp_id . '&amp;updateaudio=true">' . Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'','32').'</a>';
echo '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=edit&amp;lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('settings.png', get_lang('CourseSettings'),'','32').'</a>';
echo '</div>';
}
@ -6158,26 +6158,27 @@ class learnpath {
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
if ($id != 0 && is_array($extra_info)) {
$item_title = $extra_info['title'];
$item_description = $extra_info['description'];
$item_title = $extra_info['title'];
$item_description = $extra_info['description'];
$item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
$item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
} else {
$item_title = '';
$item_description = '';
$item_path_fck = '';
}
$return = ' <div class="row">
$return = '<div class="row">
<div class="form_header">';
if ($id != 0 && is_array($extra_info))
$parent = $extra_info['parent_item_id'];
else
$parent = 0;
$sql = "
SELECT *
FROM " . $tbl_lp_item . "
WHERE lp_id = " . $this->lp_id . " AND id != " . $id . " ";
$id = intval($id);
$sql = "SELECT * FROM " . $tbl_lp_item . "
WHERE lp_id = " . $this->lp_id . " AND id != $id";
if ($item_type == 'module')
$sql .= " AND parent_item_id = 0";
@ -6208,7 +6209,7 @@ class learnpath {
unset ($this->arrMenu);
$return .= $title;
$return .= ' </div>
$return .= '</div>
</div>';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
@ -6223,6 +6224,7 @@ class learnpath {
$arrHide[0]['value'] = Security :: remove_XSS($this->name);
$arrHide[0]['padding'] = 3;
$charset = api_get_system_encoding();
if ($item_type != 'module' && $item_type != 'dokeos_module') {
for ($i = 0; $i < count($arrLP); $i++) {
if ($action != 'add') {
@ -6312,8 +6314,18 @@ class learnpath {
$form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
}
$renderer = $form->defaultRenderer();
$renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
$form->addElement('html_editor', 'content_lp', '', null, array('ToolbarSet' => 'LearningPathDocuments', 'Width' => '100%', 'Height' => '400', 'FullPage' => true));
$renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
$relative_prefix = '';
$editor_config = array( 'ToolbarSet' => 'LearningPathDocuments',
'Width' => '100%',
'Height' => '500',
'FullPage' => true,
'CreateDocumentDir' => $relative_prefix,
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
);
$form->addElement('html_editor', 'content_lp', '', null, $editor_config);
$defaults['content_lp'] = file_get_contents($item_path);
}
@ -6362,7 +6374,6 @@ class learnpath {
}
}
}
if ($id != 0 && is_array($extra_info)) {
$item_title = stripslashes($extra_info['title']);
$item_description = stripslashes($extra_info['description']);

@ -19,11 +19,6 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
/* Libraries */
// The main_api.lib.php, database.lib.php and display.lib.php
// libraries are included by default.
include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
@ -287,7 +282,7 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
break;
case TOOL_DOCUMENT:
Display::display_confirmation_message(get_lang('NewDocumentCreated'));
echo $_SESSION['oLP']->display_item($new_item_id, true, $msg);
echo $_SESSION['oLP']->display_item($new_item_id, true);
break;
case TOOL_FORUM:
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);

@ -43,20 +43,6 @@ $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
$isStudentView = (int) $_REQUEST['isStudentView'];
$learnpath_id = (int) $_REQUEST['lp_id'];
$submit = $_POST['submit_button'];
/*
$chapter_id = $_GET['chapter_id'];
$title = $_POST['title'];
$description = $_POST['description'];
$Submititem = $_POST['Submititem'];
$action = $_REQUEST['action'];
$id = (int) $_REQUEST['id'];
$type = $_REQUEST['type'];
$direction = $_REQUEST['direction'];
$moduleid = $_REQUEST['moduleid'];
$prereq = $_REQUEST['prereq'];
$type = $_REQUEST['type'];
*/
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
@ -87,12 +73,6 @@ $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
$result = Database::query($sql_query);
$therow = Database::fetch_array($result);
//$admin_output = '';
/*
Course admin section
- all the functions not available for students - always available in this case (page only shown to admin)
*/
/* SHOWING THE ADMIN TOOLS */
if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
@ -110,17 +90,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" => $therow['name']);
$interbreadcrumb[] = array('url' => '#', "name" => $therow['name']);
// Theme calls.
$lp_theme_css=$_SESSION['oLP']->get_theme();
$show_learn_path = true;
Display::display_header('', 'Path');
//api_display_tool_title($therow['name']);
$suredel = trim(get_lang('AreYouSureToDelete'));
//$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
?>
<script type='text/javascript'>
/* <![CDATA[ */
@ -131,23 +108,18 @@ function stripslashes(str) {
str=str.replace(/\\0/g,'\0');
return str;
}
function confirmation(name)
{
function confirmation(name) {
name=stripslashes(name);
if (confirm("<?php echo $suredel; ?> " + name + " ?"))
{
return true;
}
else
{
} else {
return false;
}
}
</script>
<?php
//echo $admin_output;
/* DISPLAY SECTION */
echo $_SESSION['oLP']->build_action_menu();
@ -167,15 +139,15 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
Display::display_normal_message(get_lang('LearnpathAdded'), false);
}
// Display::display_normal_message(get_lang('LPCreatedAddChapterStep'), false);
$gradebook = Security::remove_XSS($_GET['gradebook']);
//$learnpathadded = Display::return_icon('gallery/creative.gif', '', array('align' => 'right'));
$learnpathadded = '<p><strong>'.get_lang('LearnPathAddedTitle').'</strong><br /><br />';
$learnpathadded .= '<a href="lp_controller.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;gradebook='.$gradebook.'&amp;action=add_item&amp;type=step&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang('NewStep').'">'.Display::return_icon('new_learnigpath_object.png', get_lang('NewStep'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewStep').'</a>: '.get_lang('NewStepComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;gradebook='.$gradebook.'&amp;action=add_item&amp;type=chapter&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang('NewChapter').'">'.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewChapter').'</a>: '.get_lang('NewChapterComment').'<br />';
$gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null;
$learnpathadded = '<p><h2>'.get_lang('LearnPathAddedTitle').'</h2><br />';
$learnpathadded .= '<a href="lp_controller.php?'.api_get_cidreq().'&amp;gradebook='.$gradebook.'&amp;action=add_item&amp;type=step&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang('NewStep').'">'.Display::return_icon('new_learnigpath_object.png', get_lang('NewStep'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewStep').'</a>: '.get_lang('NewStepComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?'.api_get_cidreq().'&amp;gradebook='.$gradebook.'&amp;action=add_item&amp;type=chapter&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang('NewChapter').'">'.Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('NewChapter').'</a>: '.get_lang('NewChapterComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=build&amp;lp_id='.Security::remove_XSS($_GET['lp_id']).'" target="_parent">'.Display::return_icon('build_learnpath.png', get_lang('Build'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('Build')."</a>: ".get_lang('BuildComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;gradebook='.$gradebook.'&amp;action=admin_view&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang("BasicOverview").'">'.Display::return_icon('move_learnpath.png', get_lang('BasicOverview'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('BasicOverview').'</a>: '.get_lang('BasicOverviewComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id.'">'.Display::return_icon('view_left_right.png', get_lang('Display'),array('style' => 'vertical-align: middle;'),'22').' '.get_lang('Display').'</a>: '.get_lang('DisplayComment').'<br />';
$learnpathadded .= '<br /><br /><br /><br /></p>';
$learnpathadded .= '<a href="lp_controller.php?'.api_get_cidreq().'&amp;gradebook='.$gradebook.'&amp;action=admin_view&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="'.get_lang("BasicOverview").'">'.Display::return_icon('move_learnpath.png', get_lang('BasicOverview'), array('style' => 'vertical-align: middle;'),'22').' '.get_lang('BasicOverview').'</a>: '.get_lang('BasicOverviewComment').'<br />';
$learnpathadded .= '<a href="lp_controller.php?'.api_get_cidreq().'&amp;gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id.'">'.Display::return_icon('view_left_right.png', get_lang('Display'),array('style' => 'vertical-align: middle;'),'22').' '.get_lang('Display').'</a>: '.get_lang('DisplayComment').'<br />';
$learnpathadded .= '<br /></p>';
Display::display_normal_message($learnpathadded, false);
}
echo '</td>';

@ -97,6 +97,7 @@ 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' => '#', 'name' => get_lang('Edit'));
// Theme calls.
$show_learn_path = true;

@ -72,6 +72,7 @@ if ($action == 'add' && $type == 'learnpathitem') {
if ((!$is_allowed_to_edit) || ($isStudentView)) {
error_log('New LP - User not authorized in lp_view_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
exit;
}
// From here on, we are admin because of the previous condition, so don't check anymore.
@ -93,7 +94,8 @@ 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=build&lp_id=$learnpath_id", 'name' => $therow['name']);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Item'));
// Theme calls
$show_learn_path = true;

Loading…
Cancel
Save