Minor - format code.

pull/2487/head
jmontoyaa 7 years ago
parent 855addcf07
commit 4175c9a22c
  1. 13
      certificates/index.php
  2. 4
      main/gradebook/lib/GradebookUtils.php

@ -8,14 +8,15 @@
require_once '../main/inc/global.inc.php'; require_once '../main/inc/global.inc.php';
$action = isset($_GET['action']) ? $_GET['action'] : null; $action = isset($_GET['action']) ? $_GET['action'] : null;
$certificate = new Certificate($_GET['id']); $certificate = new Certificate($_GET['id']);
switch ($action) { switch ($action) {
case 'export': case 'export':
$hideExportLink = api_get_setting('hide_certificate_export_link'); $hideExportLink = api_get_setting('hide_certificate_export_link');
$hideExportLinkStudent = api_get_setting('hide_certificate_export_link_students'); $hideExportLinkStudent = api_get_setting('hide_certificate_export_link_students');
if ($hideExportLink === 'true' || (api_is_student() && $hideExportLinkStudent === 'true')) { if ($hideExportLink === 'true' ||
(api_is_student() && $hideExportLinkStudent === 'true')
) {
api_not_allowed(true); api_not_allowed(true);
} }
@ -24,12 +25,12 @@ switch ($action) {
if ($certificate->isHtmlFileGenerated()) { if ($certificate->isHtmlFileGenerated()) {
$certificatePathList[] = $certificate->html_file; $certificatePathList[] = $certificate->html_file;
$pdfParams = array( $pdfParams = [
'top' => 0, 'top' => 0,
'right' => 0, 'right' => 0,
'bottom' => 0, 'bottom' => 0,
'left' => 0 'left' => 0
); ];
$orientation = api_get_configuration_value('certificate_pdf_orientation'); $orientation = api_get_configuration_value('certificate_pdf_orientation');
$pdfParams['orientation'] = 'landscape'; $pdfParams['orientation'] = 'landscape';
@ -39,7 +40,9 @@ switch ($action) {
$pageFormat = $pdfParams['orientation'] === 'landscape' ? 'A4-L' : 'A4'; $pageFormat = $pdfParams['orientation'] === 'landscape' ? 'A4-L' : 'A4';
$userInfo = api_get_user_info($certificate->user_id); $userInfo = api_get_user_info($certificate->user_id);
$pdfName = api_replace_dangerous_char(get_lang('Certificate').' '.$userInfo['username']); $pdfName = api_replace_dangerous_char(
get_lang('Certificate').' '.$userInfo['username']
);
$pdf = new PDF($pageFormat, $pdfParams['orientation'], $pdfParams); $pdf = new PDF($pageFormat, $pdfParams['orientation'], $pdfParams);
$pdf->html_to_pdf( $pdf->html_to_pdf(

@ -641,8 +641,8 @@ class GradebookUtils
*/ */
public static function get_certificate_by_user_id($cat_id, $user_id) public static function get_certificate_by_user_id($cat_id, $user_id)
{ {
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$sql = 'SELECT * FROM '.$table_certificate.' $sql = 'SELECT * FROM '.$table.'
WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"'; WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"';
$result = Database::query($sql); $result = Database::query($sql);

Loading…
Cancel
Save