|
|
|
@ -1,8 +1,6 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
|
|
use ChamiloSession as Session; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (intval($_GET['default']) == 1) { |
|
|
|
if (intval($_GET['default']) == 1) { |
|
|
|
$cidReset = true; |
|
|
|
$cidReset = true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -62,7 +60,7 @@ if ($enable) { |
|
|
|
$infoCertificate = Database::select( |
|
|
|
$infoCertificate = Database::select( |
|
|
|
'*', |
|
|
|
'*', |
|
|
|
$table, |
|
|
|
$table, |
|
|
|
['where'=> ['access_url_id = ? AND c_id = ? AND session_id = ?' => [$accessUrlId, $courseId, $sessionId]]], |
|
|
|
['where' => ['access_url_id = ? AND c_id = ? AND session_id = ?' => [$accessUrlId, $courseId, $sessionId]]], |
|
|
|
'first' |
|
|
|
'first' |
|
|
|
); |
|
|
|
); |
|
|
|
if (!is_array($infoCertificate)) { |
|
|
|
if (!is_array($infoCertificate)) { |
|
|
|
@ -74,9 +72,9 @@ if ($enable) { |
|
|
|
'post', |
|
|
|
'post', |
|
|
|
api_get_self().$urlParams, |
|
|
|
api_get_self().$urlParams, |
|
|
|
null, |
|
|
|
null, |
|
|
|
array('class' => 'form-vertical') |
|
|
|
['class' => 'form-vertical'] |
|
|
|
); |
|
|
|
); |
|
|
|
if (isset($_POST['formSent']) && $_POST['formSent'] == 1 && $form->validate()) { |
|
|
|
if ($form->validate()) { |
|
|
|
$formValues = $form->getSubmitValues(); |
|
|
|
$formValues = $form->getSubmitValues(); |
|
|
|
if (empty($formValues['contents'])) { |
|
|
|
if (empty($formValues['contents'])) { |
|
|
|
$contents = ''; |
|
|
|
$contents = ''; |
|
|
|
@ -86,8 +84,8 @@ if ($enable) { |
|
|
|
|
|
|
|
|
|
|
|
$check = Security::check_token('post'); |
|
|
|
$check = Security::check_token('post'); |
|
|
|
if ($check) { |
|
|
|
if ($check) { |
|
|
|
$date_start = str_replace('/', '-', $_POST['date_start']); |
|
|
|
$date_start = str_replace('/', '-', $formValues['date_start']); |
|
|
|
$date_end = str_replace('/', '-', $_POST['date_end']); |
|
|
|
$date_end = str_replace('/', '-', $formValues['date_end']); |
|
|
|
$params = [ |
|
|
|
$params = [ |
|
|
|
'access_url_id' => api_get_current_access_url_id(), |
|
|
|
'access_url_id' => api_get_current_access_url_id(), |
|
|
|
'c_id' => $formValues['c_id'], |
|
|
|
'c_id' => $formValues['c_id'], |
|
|
|
@ -100,19 +98,19 @@ if ($enable) { |
|
|
|
'date_end' => date("Y-m-d", strtotime($date_end)), |
|
|
|
'date_end' => date("Y-m-d", strtotime($date_end)), |
|
|
|
'place' => $formValues['place'], |
|
|
|
'place' => $formValues['place'], |
|
|
|
'type_date_expediction' => intval($formValues['type_date_expediction']), |
|
|
|
'type_date_expediction' => intval($formValues['type_date_expediction']), |
|
|
|
'day' => Database::escape_string($_POST['day']), |
|
|
|
'day' => $formValues['day'], |
|
|
|
'month' => Database::escape_string($_POST['month']), |
|
|
|
'month' => $formValues['month'], |
|
|
|
'year' => Database::escape_string($_POST['year']), |
|
|
|
'year' => $formValues['year'], |
|
|
|
'signature_text1' => $formValues['signature_text1'], |
|
|
|
'signature_text1' => $formValues['signature_text1'], |
|
|
|
'signature_text2' => $formValues['signature_text2'], |
|
|
|
'signature_text2' => $formValues['signature_text2'], |
|
|
|
'signature_text3' => $formValues['signature_text3'], |
|
|
|
'signature_text3' => $formValues['signature_text3'], |
|
|
|
'signature_text4' => $formValues['signature_text4'], |
|
|
|
'signature_text4' => $formValues['signature_text4'], |
|
|
|
'margin_left' => intval($formValues['margin_left']), |
|
|
|
'margin_left' => intval($formValues['margin_left']), |
|
|
|
'margin_right' => intval($formValues['margin_right']), |
|
|
|
'margin_right' => intval($formValues['margin_right']), |
|
|
|
'certificate_default' => 0 |
|
|
|
'certificate_default' => 0, |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
if (intval($_POST['default_certificate'] == 1)) { |
|
|
|
if (intval($formValues['default_certificate'] == 1)) { |
|
|
|
$params['certificate_default'] = 1; |
|
|
|
$params['certificate_default'] = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -320,13 +318,13 @@ if ($enable) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Certificate Default |
|
|
|
// Certificate Default |
|
|
|
if (intval($_POST['use_default'] == 1)) { |
|
|
|
if (intval($formValues['use_default'] == 1)) { |
|
|
|
$base = api_get_path(SYS_UPLOAD_PATH); |
|
|
|
$base = api_get_path(SYS_UPLOAD_PATH); |
|
|
|
|
|
|
|
|
|
|
|
$infoCertificateDefault = Database::select( |
|
|
|
$infoCertificateDefault = Database::select( |
|
|
|
'*', |
|
|
|
'*', |
|
|
|
$table, |
|
|
|
$table, |
|
|
|
['where'=> ['certificate_default = ? ' => 1]], |
|
|
|
['where' => ['certificate_default = ? ' => 1]], |
|
|
|
'first' |
|
|
|
'first' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
@ -447,12 +445,12 @@ if ($enable) { |
|
|
|
$infoCertificate = Database::select( |
|
|
|
$infoCertificate = Database::select( |
|
|
|
'*', |
|
|
|
'*', |
|
|
|
$table, |
|
|
|
$table, |
|
|
|
['where'=> ['access_url_id = ? AND certificate_default = ? ' => [$accessUrlId, 1]]], |
|
|
|
['where' => ['access_url_id = ? AND certificate_default = ? ' => [$accessUrlId, 1]]], |
|
|
|
'first' |
|
|
|
'first' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (!is_array($infoCertificate)) { |
|
|
|
if (!is_array($infoCertificate)) { |
|
|
|
$infoCertificate = array(); |
|
|
|
$infoCertificate = []; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!empty($infoCertificate)) { |
|
|
|
if (!empty($infoCertificate)) { |
|
|
|
$useDefault = true; |
|
|
|
$useDefault = true; |
|
|
|
@ -467,7 +465,7 @@ if ($enable) { |
|
|
|
); |
|
|
|
); |
|
|
|
echo Display::toolbarAction( |
|
|
|
echo Display::toolbarAction( |
|
|
|
'toolbar-document', |
|
|
|
'toolbar-document', |
|
|
|
array($actionsLeft) |
|
|
|
[$actionsLeft] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if ($useDefault && $courseId > 0) { |
|
|
|
if ($useDefault && $courseId > 0) { |
|
|
|
@ -543,7 +541,7 @@ if ($enable) { |
|
|
|
'', |
|
|
|
'', |
|
|
|
get_lang('ContentsCourseDescription'), |
|
|
|
get_lang('ContentsCourseDescription'), |
|
|
|
0, |
|
|
|
0, |
|
|
|
['id' => 'contents_type_0', 'onclick' => 'javascript: contents_type_switch_radio_button();'] |
|
|
|
['id' => 'contents_type_0', 'onclick' => 'javascript: contentsTypeSwitchRadioButton();'] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$group[] = $element; |
|
|
|
$group[] = $element; |
|
|
|
@ -554,7 +552,7 @@ if ($enable) { |
|
|
|
'', |
|
|
|
'', |
|
|
|
get_lang('ContentsIndexLearnpath'), |
|
|
|
get_lang('ContentsIndexLearnpath'), |
|
|
|
1, |
|
|
|
1, |
|
|
|
['id' => 'contents_type_1', 'onclick' => 'javascript: contents_type_switch_radio_button();'] |
|
|
|
['id' => 'contents_type_1', 'onclick' => 'javascript: contentsTypeSwitchRadioButton();'] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $element; |
|
|
|
$group[] = $element; |
|
|
|
|
|
|
|
|
|
|
|
@ -564,7 +562,7 @@ if ($enable) { |
|
|
|
'', |
|
|
|
'', |
|
|
|
get_lang('ContentsCustom'), |
|
|
|
get_lang('ContentsCustom'), |
|
|
|
2, |
|
|
|
2, |
|
|
|
['id' => 'contents_type_2', 'onclick' => 'javascript: contents_type_switch_radio_button();'] |
|
|
|
['id' => 'contents_type_2', 'onclick' => 'javascript: contentsTypeSwitchRadioButton();'] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $element; |
|
|
|
$group[] = $element; |
|
|
|
|
|
|
|
|
|
|
|
@ -610,7 +608,7 @@ if ($enable) { |
|
|
|
'', |
|
|
|
'', |
|
|
|
get_lang('UseDateSessionAccess'), |
|
|
|
get_lang('UseDateSessionAccess'), |
|
|
|
0, |
|
|
|
0, |
|
|
|
['id' => 'contents_type_0', 'onclick' => 'javascript: date_certificate_switch_radio_button_0();'] |
|
|
|
['id' => 'contents_type_0', 'onclick' => 'javascript: dateCertificateSwitchRadioButton0();'] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $option1; |
|
|
|
$group[] = $option1; |
|
|
|
|
|
|
|
|
|
|
|
@ -620,7 +618,7 @@ if ($enable) { |
|
|
|
'', |
|
|
|
'', |
|
|
|
get_lang('None'), |
|
|
|
get_lang('None'), |
|
|
|
2, |
|
|
|
2, |
|
|
|
['id' => 'contents_type_2', 'onclick' => 'javascript: date_certificate_switch_radio_button_2();'] |
|
|
|
['id' => 'contents_type_2', 'onclick' => 'javascript: dateCertificateSwitchRadioButton2();'] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $option2; |
|
|
|
$group[] = $option2; |
|
|
|
|
|
|
|
|
|
|
|
@ -630,7 +628,7 @@ if ($enable) { |
|
|
|
'', |
|
|
|
'', |
|
|
|
get_lang('Custom'), |
|
|
|
get_lang('Custom'), |
|
|
|
1, |
|
|
|
1, |
|
|
|
['id' => 'contents_type_1', 'onclick' => 'javascript: date_certificate_switch_radio_button_1();'] |
|
|
|
['id' => 'contents_type_1', 'onclick' => 'javascript: dateCertificateSwitchRadioButton1();'] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $option3; |
|
|
|
$group[] = $option3; |
|
|
|
|
|
|
|
|
|
|
|
@ -678,7 +676,7 @@ if ($enable) { |
|
|
|
'place', |
|
|
|
'place', |
|
|
|
get_lang('ExpectionPlace'), |
|
|
|
get_lang('ExpectionPlace'), |
|
|
|
false, |
|
|
|
false, |
|
|
|
array('id' => 'place', 'cols-size' => [2, 5, 5], 'autofocus') |
|
|
|
['id' => 'place', 'cols-size' => [2, 5, 5], 'autofocus'] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$group = []; |
|
|
|
$group = []; |
|
|
|
@ -690,8 +688,8 @@ if ($enable) { |
|
|
|
0, |
|
|
|
0, |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => 'type_date_expediction_0', |
|
|
|
'id' => 'type_date_expediction_0', |
|
|
|
'onclick' => 'javascript: date_certificate_switch_radio_button_0();', |
|
|
|
'onclick' => 'javascript: dateCertificateSwitchRadioButton0();', |
|
|
|
(($sessionId == 0) ? 'disabled' : '') |
|
|
|
(($sessionId == 0) ? 'disabled' : ''), |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $option1; |
|
|
|
$group[] = $option1; |
|
|
|
@ -704,7 +702,7 @@ if ($enable) { |
|
|
|
1, |
|
|
|
1, |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => 'type_date_expediction_1', |
|
|
|
'id' => 'type_date_expediction_1', |
|
|
|
'onclick' => 'javascript: type_date_expediction_switch_radio_button();', |
|
|
|
'onclick' => 'javascript: typeDateExpedictionSwitchRadioButton();', |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $option2; |
|
|
|
$group[] = $option2; |
|
|
|
@ -717,7 +715,7 @@ if ($enable) { |
|
|
|
3, |
|
|
|
3, |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => 'type_date_expediction_3', |
|
|
|
'id' => 'type_date_expediction_3', |
|
|
|
'onclick' => 'javascript: type_date_expediction_switch_radio_button();', |
|
|
|
'onclick' => 'javascript: typeDateExpedictionSwitchRadioButton();', |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $option4; |
|
|
|
$group[] = $option4; |
|
|
|
@ -730,7 +728,7 @@ if ($enable) { |
|
|
|
2, |
|
|
|
2, |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => 'type_date_expediction_2', |
|
|
|
'id' => 'type_date_expediction_2', |
|
|
|
'onclick' => 'javascript: type_date_expediction_switch_radio_button();', |
|
|
|
'onclick' => 'javascript: typeDateExpedictionSwitchRadioButton();', |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$group[] = $option3; |
|
|
|
$group[] = $option3; |
|
|
|
@ -795,12 +793,12 @@ if ($enable) { |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'logo_left', |
|
|
|
'logo_left', |
|
|
|
get_lang('LogoLeft'), |
|
|
|
get_lang('LogoLeft'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'logo_left', |
|
|
|
'id' => 'logo_left', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['logo_left'])) { |
|
|
|
if (!empty($infoCertificate['logo_left'])) { |
|
|
|
@ -825,12 +823,12 @@ if ($enable) { |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'logo_center', |
|
|
|
'logo_center', |
|
|
|
get_lang('LogoCenter'), |
|
|
|
get_lang('LogoCenter'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'logo_center', |
|
|
|
'id' => 'logo_center', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['logo_center'])) { |
|
|
|
if (!empty($infoCertificate['logo_center'])) { |
|
|
|
@ -855,12 +853,12 @@ if ($enable) { |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'logo_right', |
|
|
|
'logo_right', |
|
|
|
get_lang('LogoRight'), |
|
|
|
get_lang('LogoRight'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'logo_right', |
|
|
|
'id' => 'logo_right', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['logo_right'])) { |
|
|
|
if (!empty($infoCertificate['logo_right'])) { |
|
|
|
@ -884,12 +882,12 @@ if ($enable) { |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'seal', |
|
|
|
'seal', |
|
|
|
get_lang('Seal'), |
|
|
|
get_lang('Seal'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'seal', |
|
|
|
'id' => 'seal', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['seal'])) { |
|
|
|
if (!empty($infoCertificate['seal'])) { |
|
|
|
@ -917,17 +915,17 @@ if ($enable) { |
|
|
|
'signature_text1', |
|
|
|
'signature_text1', |
|
|
|
get_lang('SignatureText1'), |
|
|
|
get_lang('SignatureText1'), |
|
|
|
false, |
|
|
|
false, |
|
|
|
array('cols-size' => [2, 10, 0], 'autofocus') |
|
|
|
['cols-size' => [2, 10, 0], 'autofocus'] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'signature1', |
|
|
|
'signature1', |
|
|
|
get_lang('Signature1'), |
|
|
|
get_lang('Signature1'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'signature1', |
|
|
|
'id' => 'signature1', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['signature1'])) { |
|
|
|
if (!empty($infoCertificate['signature1'])) { |
|
|
|
@ -953,17 +951,17 @@ if ($enable) { |
|
|
|
'signature_text2', |
|
|
|
'signature_text2', |
|
|
|
get_lang('SignatureText2'), |
|
|
|
get_lang('SignatureText2'), |
|
|
|
false, |
|
|
|
false, |
|
|
|
array('cols-size' => [2, 10, 0], 'autofocus') |
|
|
|
['cols-size' => [2, 10, 0], 'autofocus'] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'signature2', |
|
|
|
'signature2', |
|
|
|
get_lang('Signature2'), |
|
|
|
get_lang('Signature2'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'signature2', |
|
|
|
'id' => 'signature2', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['signature2'])) { |
|
|
|
if (!empty($infoCertificate['signature2'])) { |
|
|
|
@ -989,17 +987,17 @@ if ($enable) { |
|
|
|
'signature_text3', |
|
|
|
'signature_text3', |
|
|
|
get_lang('SignatureText3'), |
|
|
|
get_lang('SignatureText3'), |
|
|
|
false, |
|
|
|
false, |
|
|
|
array('cols-size' => [2, 10, 0], 'autofocus') |
|
|
|
['cols-size' => [2, 10, 0], 'autofocus'] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'signature3', |
|
|
|
'signature3', |
|
|
|
get_lang('Signature3'), |
|
|
|
get_lang('Signature3'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'signature3', |
|
|
|
'id' => 'signature3', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['signature3'])) { |
|
|
|
if (!empty($infoCertificate['signature3'])) { |
|
|
|
@ -1025,17 +1023,17 @@ if ($enable) { |
|
|
|
'signature_text4', |
|
|
|
'signature_text4', |
|
|
|
get_lang('SignatureText4'), |
|
|
|
get_lang('SignatureText4'), |
|
|
|
false, |
|
|
|
false, |
|
|
|
array('cols-size' => [2, 10, 0], 'autofocus') |
|
|
|
['cols-size' => [2, 10, 0], 'autofocus'] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'signature4', |
|
|
|
'signature4', |
|
|
|
get_lang('Signature4'), |
|
|
|
get_lang('Signature4'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'signature4', |
|
|
|
'id' => 'signature4', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_scalable' => 'true' |
|
|
|
'crop_scalable' => 'true', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['signature4'])) { |
|
|
|
if (!empty($infoCertificate['signature4'])) { |
|
|
|
@ -1062,12 +1060,12 @@ if ($enable) { |
|
|
|
$form->addFile( |
|
|
|
$form->addFile( |
|
|
|
'background', |
|
|
|
'background', |
|
|
|
get_lang('Background'), |
|
|
|
get_lang('Background'), |
|
|
|
array( |
|
|
|
[ |
|
|
|
'id' => 'background', |
|
|
|
'id' => 'background', |
|
|
|
'class' => 'picture-form', |
|
|
|
'class' => 'picture-form', |
|
|
|
'crop_image' => true, |
|
|
|
'crop_image' => true, |
|
|
|
'crop_ratio' => '297 / 210' |
|
|
|
'crop_ratio' => '297 / 210', |
|
|
|
) |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addProgress(); |
|
|
|
$form->addProgress(); |
|
|
|
if (!empty($infoCertificate['background'])) { |
|
|
|
if (!empty($infoCertificate['background'])) { |
|
|
|
@ -1101,14 +1099,14 @@ if ($enable) { |
|
|
|
'margin_left', |
|
|
|
'margin_left', |
|
|
|
get_lang('MarginLeft'), |
|
|
|
get_lang('MarginLeft'), |
|
|
|
$marginOptions, |
|
|
|
$marginOptions, |
|
|
|
array('cols-size' => [4, 8, 0]) |
|
|
|
['cols-size' => [4, 8, 0]] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addElement( |
|
|
|
$form->addElement( |
|
|
|
'select', |
|
|
|
'select', |
|
|
|
'margin_right', |
|
|
|
'margin_right', |
|
|
|
get_lang('MarginRight'), |
|
|
|
get_lang('MarginRight'), |
|
|
|
$marginOptions, |
|
|
|
$marginOptions, |
|
|
|
array('cols-size' => [4, 8, 0]) |
|
|
|
['cols-size' => [4, 8, 0]] |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addElement('html', '</fieldset>'); |
|
|
|
$form->addElement('html', '</fieldset>'); |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
@ -1143,13 +1141,13 @@ if ($enable) { |
|
|
|
'session_id' => $sessionId, |
|
|
|
'session_id' => $sessionId, |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
echo '<div class="page-create"> |
|
|
|
echo '<div class="page-create">'; |
|
|
|
<div class="row" style="overflow:hidden"> |
|
|
|
echo '<div class="row" style="overflow:hidden">'; |
|
|
|
<div id="doc_form" class="col-md-12"> |
|
|
|
echo '<div id="doc_form" class="col-md-12">'; |
|
|
|
'.$form->returnForm().' |
|
|
|
echo $form->returnForm(); |
|
|
|
</div> |
|
|
|
echo '</div>'; |
|
|
|
</div> |
|
|
|
echo '</div>'; |
|
|
|
</div>'; |
|
|
|
echo '</div>'; |
|
|
|
Display::display_footer(); |
|
|
|
Display::display_footer(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$session = api_get_session_entity(api_get_session_id()); |
|
|
|
$session = api_get_session_entity(api_get_session_id()); |
|
|
|
@ -1171,20 +1169,23 @@ if ($enable) { |
|
|
|
function uploadImageCertificate( |
|
|
|
function uploadImageCertificate( |
|
|
|
$certId, |
|
|
|
$certId, |
|
|
|
$file = null, |
|
|
|
$file = null, |
|
|
|
$source_file = null, |
|
|
|
$sourceFile = null, |
|
|
|
$cropParameters = '', |
|
|
|
$cropParameters = '', |
|
|
|
$default = false |
|
|
|
$default = false |
|
|
|
) { |
|
|
|
) { |
|
|
|
if (empty($certId)) { |
|
|
|
if (empty($certId)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$delete = empty($file); |
|
|
|
$delete = empty($file); |
|
|
|
if (empty($source_file)) { |
|
|
|
|
|
|
|
$source_file = $file; |
|
|
|
if (empty($sourceFile)) { |
|
|
|
|
|
|
|
$sourceFile = $file; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$base = api_get_path(SYS_UPLOAD_PATH); |
|
|
|
$base = api_get_path(SYS_UPLOAD_PATH); |
|
|
|
$path = $base.'certificates/'.$certId.'/'; |
|
|
|
$path = $base.'certificates/'.$certId.'/'; |
|
|
|
|
|
|
|
|
|
|
|
if ($default) { |
|
|
|
if ($default) { |
|
|
|
$path = $base.'certificates/default/'; |
|
|
|
$path = $base.'certificates/default/'; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1193,14 +1194,17 @@ function uploadImageCertificate( |
|
|
|
if (!file_exists($path)) { |
|
|
|
if (!file_exists($path)) { |
|
|
|
mkdir($path, api_get_permissions_for_new_directories(), true); |
|
|
|
mkdir($path, api_get_permissions_for_new_directories(), true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Exit if only deletion has been requested. Return an empty picture name. |
|
|
|
// Exit if only deletion has been requested. Return an empty picture name. |
|
|
|
if ($delete) { |
|
|
|
if ($delete) { |
|
|
|
return ''; |
|
|
|
return ''; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$allowedTypes = api_get_supported_image_extensions(); |
|
|
|
$allowedTypes = api_get_supported_image_extensions(); |
|
|
|
$file = str_replace('\\', '/', $file); |
|
|
|
$file = str_replace('\\', '/', $file); |
|
|
|
$filename = (($pos = strrpos($file, '/')) !== false) ? substr($file, $pos + 1) : $file; |
|
|
|
$filename = (($pos = strrpos($file, '/')) !== false) ? substr($file, $pos + 1) : $file; |
|
|
|
$extension = strtolower(substr(strrchr($filename, '.'), 1)); |
|
|
|
$extension = strtolower(substr(strrchr($filename, '.'), 1)); |
|
|
|
|
|
|
|
|
|
|
|
if (!in_array($extension, $allowedTypes)) { |
|
|
|
if (!in_array($extension, $allowedTypes)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1210,10 +1214,10 @@ function uploadImageCertificate( |
|
|
|
$filename = $certId.'_'.$filename; |
|
|
|
$filename = $certId.'_'.$filename; |
|
|
|
|
|
|
|
|
|
|
|
//Crop the image to adjust 1:1 ratio |
|
|
|
//Crop the image to adjust 1:1 ratio |
|
|
|
$image = new Image($source_file); |
|
|
|
$image = new Image($sourceFile); |
|
|
|
$image->crop($cropParameters); |
|
|
|
$image->crop($cropParameters); |
|
|
|
|
|
|
|
|
|
|
|
$origin = new Image($source_file); // This is the original picture. |
|
|
|
$origin = new Image($sourceFile); // This is the original picture. |
|
|
|
$origin->send_image($path.$filename); |
|
|
|
$origin->send_image($path.$filename); |
|
|
|
|
|
|
|
|
|
|
|
$result = $origin; |
|
|
|
$result = $origin; |
|
|
|
|