Minor - format code, replace jQuery(document)

pull/2539/head
jmontoyaa 7 years ago
parent 859eb4ae70
commit b0b26ee7de
  1. 3
      main/inc/lib/certificate.lib.php
  2. 36
      main/lp/lp_ajax_save_item.php
  3. 2
      main/lp/lp_ajax_switch_item.php
  4. 2
      main/lp/lp_build.php
  5. 3
      main/lp/lp_edit.php
  6. 9
      main/lp/lp_edit_item.php
  7. 12
      main/social/my_skills_report.php
  8. 2
      main/template/default/social/skills_block.tpl

@ -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 = '';

@ -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') {

@ -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 .=

@ -125,6 +125,4 @@ function show_block($link, $title, $subtitle, $icon)
return $html;
}
/* FOOTER */
Display::display_footer();

@ -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).

@ -58,7 +58,6 @@ $(document).on("ready", function() {
</script>';
/* 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'
}, {

@ -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);

@ -1,5 +1,5 @@
<script>
jQuery(document).ready(function(){
$(function() {
jQuery('.scrollbar-inner').scrollbar();
});
</script>

Loading…
Cancel
Save