From d454d1471f5572f3b5d88642fcea306ae8c5576f Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 24 Jun 2011 11:37:12 +0200 Subject: [PATCH] Students can download LP as PDF see BT#2711 --- main/newscorm/lp_controller.php | 12 +++++++----- main/newscorm/lp_list.php | 29 +++++++++++++++++------------ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index e4a5c778d0..e2e53224a0 100755 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -475,13 +475,15 @@ switch ($action) { } break; case 'export_to_pdf': - if (!$is_allowed_to_edit) { - api_not_allowed(true); + + if (!learnpath::is_lp_visible_for_student($_SESSION['oLP']->lp_id, api_get_user_id())) { + api_not_allowed(); } + if ($debug > 0) error_log('New LP - export action triggered', 0); - if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php'; } - else { - $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']); + if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php'; + } else { + $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']); if (!$result) { require 'lp_list.php'; } diff --git a/main/newscorm/lp_list.php b/main/newscorm/lp_list.php index 61fc8d0ac3..7f1f681461 100755 --- a/main/newscorm/lp_list.php +++ b/main/newscorm/lp_list.php @@ -136,6 +136,7 @@ if ($is_allowed_to_edit) { } else { echo ''.get_lang('Title').''; echo ''.get_lang('Progress').""; + echo ''.get_lang('Actions').""; } echo ''; @@ -215,7 +216,7 @@ if (is_array($flat_list)) { $extra = '
'.$dsp_desc .''; } - $image='' . $name . ''; + $image = '' . $name . ''; $my_title = $name; if ($details['lp_visibility'] == 0 ) { @@ -257,12 +258,16 @@ if (is_array($flat_list)) { if ($is_allowed_to_edit) { $dsp_progress = ''.learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id()).''; } else { - $dsp_progress = '
'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'
'; + $dsp_progress = '
'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'
'; } } else { $dsp_progress = '
'.learnpath::get_db_progress($id, api_get_user_id(), 'both','',false, api_get_session_id()).'
'; } - + + + $dsp_edit = ''; + $dsp_edit_close = ''; + if ($is_allowed_to_edit) { /* @@ -300,11 +305,7 @@ if (is_array($flat_list)) { //""; }*/ - /* Edit title and description */ - - $dsp_edit = ''; - $dsp_edit_close = ''; - + // EDIT LP if ($current_session == $details['lp_session']) { $dsp_edit_lp = ''.Display::return_icon('settings.png', get_lang('CourseSettings'),'','22').''; @@ -438,10 +439,10 @@ if (is_array($flat_list)) { } } - if (api_get_setting('pdf_export_watermark_enable') == 'true') { + //if (api_get_setting('pdf_export_watermark_enable') == 'true') { $export_icon = ' '.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'','22').''; - } + //} /* DELETE COMMAND */ @@ -481,9 +482,13 @@ if (is_array($flat_list)) { } else { $start_time = $end_time= ''; } - } // end if ($is_allowedToEdit) + } else { // end if ($is_allowedToEdit) + //Student + $export_icon = ' '.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'','22').''; + } - echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$dsp_reinit.$dsp_default_view.$dsp_debug.$dsp_disk.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close; + echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$dsp_reinit. + $dsp_default_view.$dsp_debug.$dsp_disk.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close; echo ""; $current ++; //counter for number of elements treated