From b0b26ee7de2ee8b105b8df1adf565cfddcfd38bb Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 7 May 2018 13:05:47 +0200 Subject: [PATCH] Minor - format code, replace jQuery(document) --- main/inc/lib/certificate.lib.php | 3 +- main/lp/lp_ajax_save_item.php | 36 +++++++++---------- main/lp/lp_ajax_switch_item.php | 2 +- main/lp/lp_build.php | 2 -- main/lp/lp_edit.php | 3 +- main/lp/lp_edit_item.php | 9 ++--- main/social/my_skills_report.php | 12 +++++-- main/template/default/social/skills_block.tpl | 2 +- 8 files changed, 33 insertions(+), 36 deletions(-) diff --git a/main/inc/lib/certificate.lib.php b/main/inc/lib/certificate.lib.php index 6707343de4..c9d7fc1b44 100755 --- a/main/inc/lib/certificate.lib.php +++ b/main/inc/lib/certificate.lib.php @@ -508,7 +508,7 @@ class Certificate extends Model */ public function generateQRImage($text, $path) { - //Make sure HTML certificate is generated + // Make sure HTML certificate is generated if (!empty($text) && !empty($path)) { //L low, M - Medium, L large error correction return PHPQRCode\QRcode::png($text, $path, 'M', 2, 2); @@ -692,7 +692,6 @@ class Certificate extends Model } $userInfo = api_get_user_info($this->user_id); - $extraFieldValue = new ExtraFieldValue('user'); $value = $extraFieldValue->get_values_by_handler_and_field_variable($this->user_id, 'legal_accept'); $termsValidationDate = ''; diff --git a/main/lp/lp_ajax_save_item.php b/main/lp/lp_ajax_save_item.php index 4184e0dc7e..50de78f54e 100755 --- a/main/lp/lp_ajax_save_item.php +++ b/main/lp/lp_ajax_save_item.php @@ -137,14 +137,12 @@ function save_item( // set_score function used to save the status, but this is not the case anymore if (isset($score) && $score != -1) { if ($debug > 1) { - error_log('Calling set_score('.$score.')', 0); - error_log('set_score changes the status to failed/passed if mastery score is provided', 0); + error_log('Calling set_score('.$score.')'); + error_log('set_score changes the status to failed/passed if mastery score is provided'); } - $myLPI->set_score($score); - if ($debug > 1) { - error_log('Done calling set_score '.$myLPI->get_score(), 0); + error_log('Done calling set_score '.$myLPI->get_score()); } } else { if ($debug > 1) { @@ -156,13 +154,13 @@ function save_item( // Default behaviour. if (isset($status) && $status != '' && $status != 'undefined') { if ($debug > 1) { - error_log('Calling set_status('.$status.')', 0); + error_log('Calling set_status('.$status.')'); } $myLPI->set_status($status); $statusIsSet = true; if ($debug > 1) { - error_log('Done calling set_status: checking from memory: '.$myLPI->get_status(false), 0); + error_log('Done calling set_status: checking from memory: '.$myLPI->get_status(false)); } } else { if ($debug > 1) { @@ -177,23 +175,23 @@ function save_item( if (($score / $max) > 0.8) { $myStatus = 'completed'; if ($debug > 1) { - error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0); + error_log('Calling set_status('.$myStatus.') for hotpotatoes'); } $myLPI->set_status($myStatus); $statusIsSet = true; if ($debug > 1) { - error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0); + error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false)); } } } elseif ($status == 'completed' && $max > 0 && ($score / $max) < 0.8) { $myStatus = 'failed'; if ($debug > 1) { - error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0); + error_log('Calling set_status('.$myStatus.') for hotpotatoes'); } $myLPI->set_status($myStatus); $statusIsSet = true; if ($debug > 1) { - error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0); + error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false)); } } } elseif ($my_type == 'sco') { @@ -334,13 +332,13 @@ function save_item( // Default behaviour if (isset($status) && $status != '' && $status != 'undefined') { if ($debug > 1) { - error_log('Calling set_status('.$status.')', 0); + error_log('Calling set_status('.$status.')'); } $myLPI->set_status($status); if ($debug > 1) { - error_log('Done calling set_status: checking from memory: '.$myLPI->get_status(false), 0); + error_log('Done calling set_status: checking from memory: '.$myLPI->get_status(false)); } } else { if ($debug > 1) { @@ -352,7 +350,7 @@ function save_item( if (isset($time) && $time != '' && $time != 'undefined') { // If big integer, then it's a timestamp, otherwise it's normal scorm time. if ($debug > 1) { - error_log('Calling set_time('.$time.') ', 0); + error_log('Calling set_time('.$time.') '); } if ($time == intval(strval($time)) && $time > 1000000) { if ($debug > 1) { @@ -360,7 +358,7 @@ function save_item( } $real_time = time() - $time; if ($debug > 1) { - error_log('Calling $real_time '.$real_time.' ', 0); + error_log('Calling $real_time '.$real_time.' '); } $myLPI->set_time($real_time, 'int'); } else { @@ -368,7 +366,7 @@ function save_item( error_log("Time is in SCORM format"); } if ($debug > 1) { - error_log('Calling $time '.$time.' ', 0); + error_log('Calling $time '.$time.' '); } $myLPI->set_time($time, 'scorm'); } @@ -427,9 +425,9 @@ function save_item( $myProgressMode = $myProgressMode == '' ? '%' : $myProgressMode; if ($debug > 1) { - error_log("mystatus: $myStatus", 0); - error_log("myprogress_mode: $myProgressMode", 0); - error_log("progress: $myComplete / $myTotal", 0); + error_log("mystatus: $myStatus"); + error_log("myprogress_mode: $myProgressMode"); + error_log("progress: $myComplete / $myTotal"); } if ($myLPI->get_type() != 'sco') { diff --git a/main/lp/lp_ajax_switch_item.php b/main/lp/lp_ajax_switch_item.php index 3c1330dfd6..358d089be5 100755 --- a/main/lp/lp_ajax_switch_item.php +++ b/main/lp/lp_ajax_switch_item.php @@ -190,7 +190,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it $mycredit = $mylpi->get_credit(); $mylaunch_data = $mylpi->get_launch_data(); $myinteractions_count = $mylpi->get_interactions_count(); - $myobjectives_count = $mylpi->get_objectives_count(); + //$myobjectives_count = $mylpi->get_objectives_count(); $mycore_exit = $mylpi->get_core_exit(); $return .= diff --git a/main/lp/lp_build.php b/main/lp/lp_build.php index 899476d652..c6329b202f 100755 --- a/main/lp/lp_build.php +++ b/main/lp/lp_build.php @@ -125,6 +125,4 @@ function show_block($link, $title, $subtitle, $icon) return $html; } -/* FOOTER */ - Display::display_footer(); diff --git a/main/lp/lp_edit.php b/main/lp/lp_edit.php index a8c055a76c..5c4cd53f5e 100755 --- a/main/lp/lp_edit.php +++ b/main/lp/lp_edit.php @@ -82,13 +82,13 @@ $hide_toc_frame = $form->addElement( null, get_lang('HideTocFrame') ); + if (api_get_setting('allow_course_theme') === 'true') { $mycourselptheme = api_get_course_setting('allow_learning_path_theme'); if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) { //LP theme picker $theme_select = $form->addElement('SelectTheme', 'lp_theme', get_lang('Theme')); $form->applyFilter('lp_theme', 'trim'); - $s_theme = $learnPath->get_theme(); $theme_select->setSelected($s_theme); //default } @@ -113,7 +113,6 @@ if (strlen($learnPath->get_preview_image()) > 0) { } $label = ($learnPath->get_preview_image() != '' ? get_lang('UpdateImage') : get_lang('AddImage')); $form->addElement('file', 'lp_preview_image', [$label, get_lang('ImageWillResizeMsg')]); - $form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', ['jpg', 'jpeg', 'png', 'gif']); // Search terms (only if search is activated). diff --git a/main/lp/lp_edit_item.php b/main/lp/lp_edit_item.php index 39ff680d9b..94f420a15e 100755 --- a/main/lp/lp_edit_item.php +++ b/main/lp/lp_edit_item.php @@ -58,7 +58,6 @@ $(document).on("ready", function() { '; /* Constants and variables */ - $is_allowed_to_edit = api_is_allowed_to_edit(null, true); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN); @@ -66,9 +65,7 @@ $isStudentView = isset($_REQUEST['isStudentView']) ? intval($_REQUEST['isStudent $learnpath_id = (int) $_REQUEST['lp_id']; $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null; -/* MAIN CODE */ - -if ((!$is_allowed_to_edit) || ($isStudentView)) { +if (!$is_allowed_to_edit || $isStudentView) { error_log('New LP - User not authorized in lp_edit_item.php'); header('location:lp_controller.php?action=view&lp_id='.$learnpath_id); exit; @@ -127,11 +124,9 @@ function confirmation(name) { return false; } } -jQuery(document).ready(function(){ - jQuery('.scrollbar-inner').scrollbar(); -}); $(document).ready(function() { + jQuery('.scrollbar-inner').scrollbar(); expandColumnToogle('#hide_bar_template', { selector: '#lp_sidebar' }, { diff --git a/main/social/my_skills_report.php b/main/social/my_skills_report.php index d32107d2d9..347a682512 100644 --- a/main/social/my_skills_report.php +++ b/main/social/my_skills_report.php @@ -86,8 +86,16 @@ if ($isStudent) { $imageSysPath = sprintf("%s%s/course-pic.png", api_get_path(SYS_COURSE_PATH), $resultData['directory']); if (file_exists($imageSysPath)) { - $thumbSysPath = sprintf("%s%s/course-pic32.png", api_get_path(SYS_COURSE_PATH), $resultData['directory']); - $thumbWebPath = sprintf("%s%s/course-pic32.png", api_get_path(WEB_COURSE_PATH), $resultData['directory']); + $thumbSysPath = sprintf( + "%s%s/course-pic32.png", + api_get_path(SYS_COURSE_PATH), + $resultData['directory'] + ); + $thumbWebPath = sprintf( + "%s%s/course-pic32.png", + api_get_path(WEB_COURSE_PATH), + $resultData['directory'] + ); if (!file_exists($thumbSysPath)) { $courseImageThumb = new Image($imageSysPath); diff --git a/main/template/default/social/skills_block.tpl b/main/template/default/social/skills_block.tpl index 2398da8526..ceabdf040b 100644 --- a/main/template/default/social/skills_block.tpl +++ b/main/template/default/social/skills_block.tpl @@ -1,5 +1,5 @@