From db498a914d320f6c1f9e7c92f4fd3cb9b762c37d Mon Sep 17 00:00:00 2001 From: Nosolored Date: Wed, 8 May 2019 16:36:23 +0200 Subject: [PATCH 1/2] Add certificate generation date --- plugin/customcertificate/lang/english.php | 1 + plugin/customcertificate/lang/spanish.php | 1 + plugin/customcertificate/src/index.php | 29 ++++++++++++++----- .../src/print_certificate.php | 4 ++- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/plugin/customcertificate/lang/english.php b/plugin/customcertificate/lang/english.php index 4f01d40fa05..b0acb74d171 100644 --- a/plugin/customcertificate/lang/english.php +++ b/plugin/customcertificate/lang/english.php @@ -31,6 +31,7 @@ $strings['DateExpediction'] = "Expediction date"; $strings['UseDateEndAccessSession'] = "Use end date of session access"; $strings['UseDateDownloadCertificate'] = "Use certificate download date"; +$strings['UseDateGenerationCertificate'] = "Use certificate generation date"; $strings['UseCustomDate'] = "Use custom date"; $strings['LogosSeal'] = "Logos / Seals"; $strings['LogoLeft'] = "Logo left"; diff --git a/plugin/customcertificate/lang/spanish.php b/plugin/customcertificate/lang/spanish.php index 84b6d05ed95..775071e9da4 100644 --- a/plugin/customcertificate/lang/spanish.php +++ b/plugin/customcertificate/lang/spanish.php @@ -31,6 +31,7 @@ $strings['DateExpediction'] = "Fecha expedición"; $strings['UseDateEndAccessSession'] = "Usar fecha fin de acceso de la sesión"; $strings['UseDateDownloadCertificate'] = "Usar fecha de descarga del certificado"; +$strings['UseDateGenerationCertificate'] = "Usar fecha de generación del certificado"; $strings['UseCustomDate'] = "Usar fechas personalizadas"; $strings['LogosSeal'] = "Logos / Sellos"; $strings['LogoLeft'] = "Logo izquierda"; diff --git a/plugin/customcertificate/src/index.php b/plugin/customcertificate/src/index.php index 3c2f337d11d..d74ad5d6463 100644 --- a/plugin/customcertificate/src/index.php +++ b/plugin/customcertificate/src/index.php @@ -454,7 +454,7 @@ class="form-control-cert text-center datepicker" ); $group = []; -$option1 = &$form->createElement( +$option = &$form->createElement( 'radio', 'type_date_expediction', '', @@ -466,9 +466,9 @@ class="form-control-cert text-center datepicker" (($sessionId == 0) ? 'disabled' : ''), ] ); -$group[] = $option1; +$group[] = $option; -$option2 = &$form->createElement( +$option = &$form->createElement( 'radio', 'type_date_expediction', '', @@ -479,9 +479,22 @@ class="form-control-cert text-center datepicker" 'onclick' => 'javascript: typeDateExpedictionSwitchRadioButton();', ] ); -$group[] = $option2; +$group[] = $option; + +$option = &$form->createElement( + 'radio', + 'type_date_expediction', + '', + get_lang('UseDateGenerationCertificate'), + 4, + [ + 'id' => 'type_date_expediction_4', + 'onclick' => 'javascript: typeDateExpedictionSwitchRadioButton();', + ] +); +$group[] = $option; -$option4 = &$form->createElement( +$option = &$form->createElement( 'radio', 'type_date_expediction', '', @@ -492,9 +505,9 @@ class="form-control-cert text-center datepicker" 'onclick' => 'javascript: typeDateExpedictionSwitchRadioButton();', ] ); -$group[] = $option4; +$group[] = $option; -$option3 = &$form->createElement( +$option = &$form->createElement( 'radio', 'type_date_expediction', '', @@ -505,7 +518,7 @@ class="form-control-cert text-center datepicker" 'onclick' => 'javascript: typeDateExpedictionSwitchRadioButton();', ] ); -$group[] = $option3; +$group[] = $option; $form->addGroup( $group, diff --git a/plugin/customcertificate/src/print_certificate.php b/plugin/customcertificate/src/print_certificate.php index 2fae2706b39..3e2ec89a1d0 100644 --- a/plugin/customcertificate/src/print_certificate.php +++ b/plugin/customcertificate/src/print_certificate.php @@ -186,7 +186,7 @@ class = "caraA" $all_user_info = DocumentManager::get_all_info_to_certificate( $studentId, $courseCode, - true + false ); $myContentHtml = $infoCertificate['content_course']; @@ -253,6 +253,8 @@ class = "caraA" '............' ); } + } elseif ($infoCertificate['type_date_expediction'] == 4) { + $dateExpediction .= $plugin->get_lang('to').$info_to_replace_in_content_html[9]; //date_certificate_no_time } else { if (!empty($sessionInfo)) { $dateInfo = api_get_local_time($sessionInfo['access_end_date']); From bca6e5887ef508559b0432025b87d9b0ff9f9e0a Mon Sep 17 00:00:00 2001 From: Nosolored Date: Wed, 8 May 2019 17:16:35 +0200 Subject: [PATCH 2/2] Fix camel caps format --- plugin/customcertificate/src/print_certificate.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin/customcertificate/src/print_certificate.php b/plugin/customcertificate/src/print_certificate.php index 3e2ec89a1d0..ace1411a3ae 100644 --- a/plugin/customcertificate/src/print_certificate.php +++ b/plugin/customcertificate/src/print_certificate.php @@ -183,7 +183,7 @@ class = "caraA" $htmlText .= ''; $htmlText .= ''; - $all_user_info = DocumentManager::get_all_info_to_certificate( + $allUserInfo = DocumentManager::get_all_info_to_certificate( $studentId, $courseCode, false @@ -191,11 +191,11 @@ class = "caraA" $myContentHtml = $infoCertificate['content_course']; $myContentHtml = str_replace(chr(13).chr(10).chr(13).chr(10), chr(13).chr(10), $myContentHtml); - $info_to_be_replaced_in_content_html = $all_user_info[0]; - $info_to_replace_in_content_html = $all_user_info[1]; + $infoToBeReplacedInContentHtml = $allUserInfo[0]; + $infoToReplaceInContentHtml = $allUserInfo[1]; $myContentHtml = str_replace( - $info_to_be_replaced_in_content_html, - $info_to_replace_in_content_html, + $infoToBeReplacedInContentHtml, + $infoToReplaceInContentHtml, $myContentHtml ); @@ -254,7 +254,7 @@ class = "caraA" ); } } elseif ($infoCertificate['type_date_expediction'] == 4) { - $dateExpediction .= $plugin->get_lang('to').$info_to_replace_in_content_html[9]; //date_certificate_no_time + $dateExpediction .= $plugin->get_lang('to').$infoToReplaceInContentHtml[9]; //date_certificate_no_time } else { if (!empty($sessionInfo)) { $dateInfo = api_get_local_time($sessionInfo['access_end_date']);