Blocking scorm editions see #5141

skala
Julio Montoya 14 years ago
parent 587634649c
commit 21ad9c817e
  1. 34
      main/newscorm/learnpath.class.php
  2. 2
      main/newscorm/lp_controller.php
  3. 1
      main/newscorm/lp_edit.php
  4. 4
      main/newscorm/lp_edit_item.php

@ -1058,7 +1058,7 @@ class learnpath {
if (empty ($id) || ($id != strval(intval($id))) || empty ($title)) {
return false;
}
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
$sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
$res_select = Database::query($sql_select);
@ -5034,14 +5034,17 @@ class learnpath {
$move_icon .= '</a>';
}
if ($arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] != 'dokeos_module') {
$edit_icon .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=edit_item&amp;view=build&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
$edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY);
$edit_icon .= '</a>';
} else {
$edit_icon .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=edit_item&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
$edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY);
$edit_icon .= '</a>';
// No edit for this item types
if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
$edit_icon .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=edit_item&amp;view=build&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
$edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY);
$edit_icon .= '</a>';
} else {
$edit_icon .= '<a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=edit_item&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '&amp;path_item=' . $arrLP[$i]['path'] . '">';
$edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY);
$edit_icon .= '</a>';
}
}
$delete_icon .= ' <a href="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&amp;action=delete_item&amp;id=' . $arrLP[$i]['id'] . '&amp;lp_id=' . $this->lp_id . '" onClick="return confirmation(\'' . addslashes($title) . '\');">';
@ -5053,7 +5056,7 @@ class learnpath {
if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
$prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('Prerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq');
$move_item_icon = Display::url(Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_TINY), $url.'&action=move_item');
$audio_icon = Display::url(Display::return_icon('audio.png', get_lang('Upload'), array(), ICON_SIZE_TINY), $url.'&action=add_audio');
$audio_icon = Display::url(Display::return_icon('audio.png', get_lang('UplUpload'), array(), ICON_SIZE_TINY), $url.'&action=add_audio');
}
}
if ($update_audio != 'true') {
@ -5549,7 +5552,7 @@ class learnpath {
case 'asset' :
case 'sco' :
if (isset ($_GET['view']) && $_GET['view'] == 'build') {
$return .= $this->display_manipulate($item_id, $row['item_type']);
$return .= $this->display_manipulate($item_id, $row['item_type']);
$return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
} else {
$return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
@ -6521,7 +6524,7 @@ class learnpath {
if ($id != 0 && is_array($extra_info)) {
$item_title = $extra_info['title'];
$item_description = $extra_info['description'];
$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 {
@ -6574,6 +6577,7 @@ class learnpath {
$legend .= '</legend>';
$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;
$form = new FormValidator('form', 'POST', $url);
@ -6675,7 +6679,7 @@ class learnpath {
$extension = null;
if (!empty($item_path)) {
$extension = pathinfo($item_path, PATHINFO_EXTENSION);
}
}
//assets can't be modified
@ -6698,7 +6702,9 @@ class learnpath {
'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);
$content_path = (api_get_path(SYS_COURSE_PATH).api_get_course_path().$item_path_fck);
//$defaults['content_lp'] = file_get_contents($item_path);
$defaults['content_lp'] = file_get_contents($content_path);
}
$form->addElement('hidden', 'type', 'dokeos_' . $item_type);

@ -407,7 +407,9 @@ switch ($action) {
//$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites']);
// TODO: mp3 edit
$audio = array();
if (isset($_FILES['mp3'])) $audio = $_FILES['mp3'];
$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites'], $audio, $_POST['maxTimeAllowed']);
if (isset($_POST['content_lp'])) {

@ -218,7 +218,6 @@ if (api_is_platform_admin()) {
$defaults['use_max_score'] = $_SESSION['oLP']->use_max_score;
}
//Submit button
$form->addElement('style_submit_button', 'Submit',get_lang('SaveLPSettings'),'class="save"');

@ -139,6 +139,7 @@ $path_item = isset($_GET['path_item']) ? $_GET['path_item'] : 0;
$path_item = Database::escape_string($path_item);
$tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
$sql_doc = "SELECT path FROM " . $tbl_doc . " WHERE c_id = $course_id AND id = '". $path_item."' ";
$res_doc = Database::query($sql_doc);
$path_file = Database::result($res_doc, 0, 0);
$path_parts = pathinfo($path_file);
@ -170,5 +171,4 @@ echo '</div>';
echo '</div>';
/* FOOTER */
Display::display_footer();
Display::display_footer();
Loading…
Cancel
Save