From f3eb877fec16c673e07fe69589d066015d9d3b25 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 3 Mar 2023 12:18:52 -0500 Subject: [PATCH] Minor: Format code + fix HTML --- main/lp/lp_add_audio.php | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/main/lp/lp_add_audio.php b/main/lp/lp_add_audio.php index 2d2c7b37827..08228600d76 100755 --- a/main/lp/lp_add_audio.php +++ b/main/lp/lp_add_audio.php @@ -15,9 +15,9 @@ $isStudentView = api_is_student_view_active(); $learnpath_id = (int) $_REQUEST['lp_id']; $lp_item_id = isset($_GET['id']) ? (int) $_GET['id'] : null; -$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null; -$type = isset($_GET['type']) ? $_GET['type'] : null; -$action = isset($_GET['action']) ? $_GET['action'] : null; +$submit = $_POST['submit_button'] ?? null; +$type = $_GET['type'] ?? null; +$action = $_GET['action'] ?? null; $courseInfo = api_get_course_info(); if (!$is_allowed_to_edit || $isStudentView) { @@ -48,7 +48,7 @@ 'name' => $lp->getNameNoTags(), ]; -$audioPreview = DocumentManager::generateAudioJavascript([]); +$audioPreview = DocumentManager::generateAudioJavascript(); $htmlHeadXtra[] = "'; -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; $tpl = new Template(get_lang('Add')); $tpl->assign('unique_file_id', api_get_unique_id()); @@ -161,7 +166,14 @@ Display::getMediaPlayer($file, ['url' => $urlFile]). ""; $form->addElement('label', get_lang('Listen'), $audioPlayer); - $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?lp_id='.$lp->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq(); + $url = $webCodePath.'lp/lp_controller.php?&' + .http_build_query([ + 'lp_id' => $lp->get_id(), + 'action' => 'add_audio', + 'id' => $lp_item_id, + 'delete_file' => 1, + ]) + .'&'.api_get_cidreq(); $form->addElement( 'label', null, @@ -184,7 +196,7 @@ api_get_session_id(), false, '', - api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=add_audio&lp_id='.$lp->get_id().'&id='.$lp_item_id, + $webCodePath.'lp/lp_controller.php?action=add_audio&lp_id='.$lp->get_id().'&id='.$lp_item_id, false, true, $audioFolderId, @@ -229,7 +241,7 @@ $page .= '
  • '.get_lang('Audio').'
  • '; $page .= '
  • '; $page .= ''; -$page .= ''; +$page .= '
  • '; $page .= ''; $page .= ''; $page .= '';