|
|
|
|
@ -14,6 +14,57 @@ $this_section = SECTION_PLATFORM_ADMIN; |
|
|
|
|
|
|
|
|
|
$formSent = 0; |
|
|
|
|
|
|
|
|
|
// Crop picture plugin for session images |
|
|
|
|
$htmlHeadXtra[] = '<link href="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">'; |
|
|
|
|
$htmlHeadXtra[] = '<script src="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.js"></script>'; |
|
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
|
$(document).ready(function() { |
|
|
|
|
var $image = $("#previewImage"); |
|
|
|
|
var $input = $("[name=\'cropResult\']"); |
|
|
|
|
var $cropButton = $("#cropButton"); |
|
|
|
|
|
|
|
|
|
$("input:file").change(function() { |
|
|
|
|
var oFReader = new FileReader(); |
|
|
|
|
oFReader.readAsDataURL(document.getElementById("extra_image").files[0]); |
|
|
|
|
$("#extra_image").next("p").remove(); |
|
|
|
|
|
|
|
|
|
oFReader.onload = function (oFREvent) { |
|
|
|
|
$image.attr("src", this.result); |
|
|
|
|
$("#labelCropImage").html("'.get_lang('Preview').'"); |
|
|
|
|
$("#cropImage").addClass("thumbnail"); |
|
|
|
|
$cropButton.removeClass("hidden"); |
|
|
|
|
// Destroy cropper |
|
|
|
|
$image.cropper("destroy"); |
|
|
|
|
|
|
|
|
|
$image.cropper({ |
|
|
|
|
aspectRatio: 4 / 3, |
|
|
|
|
responsive : true, |
|
|
|
|
center : false, |
|
|
|
|
guides : false, |
|
|
|
|
movable: false, |
|
|
|
|
zoomable: false, |
|
|
|
|
rotatable: false, |
|
|
|
|
scalable: false, |
|
|
|
|
crop: function(e) { |
|
|
|
|
// Output the result data for cropping image. |
|
|
|
|
$input.val(e.x+","+e.y+","+e.width+","+e.height); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$("#cropButton").on("click", function() { |
|
|
|
|
var canvas = $image.cropper("getCroppedCanvas"); |
|
|
|
|
var dataUrl = canvas.toDataURL(); |
|
|
|
|
$image.attr("src", dataUrl); |
|
|
|
|
$image.cropper("destroy"); |
|
|
|
|
$cropButton.addClass("hidden"); |
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
// Database Table Definitions |
|
|
|
|
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
@ -120,6 +171,21 @@ $(function() { |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
$form->addHtml('' |
|
|
|
|
. '<div class="form-group">' |
|
|
|
|
. '<label for="cropImage" id="labelCropImage" class="col-sm-2 control-label"></label>' |
|
|
|
|
. '<div class="col-sm-8">' |
|
|
|
|
. '<div id="cropImage" class="cropCanvas">' |
|
|
|
|
. '<img id="previewImage" >' |
|
|
|
|
. '</div>' |
|
|
|
|
. '<div>' |
|
|
|
|
. '<button class="btn btn-primary hidden" name="cropButton" id="cropButton"><em class="fa fa-crop"></em> '.get_lang('CropYourPicture').'</button>' |
|
|
|
|
. '</div>' |
|
|
|
|
. '</div>' |
|
|
|
|
. '</div>' |
|
|
|
|
. ''); |
|
|
|
|
$form->addHidden('cropResult', ''); |
|
|
|
|
|
|
|
|
|
$form->addButtonUpdate(get_lang('ModifyThisSession')); |
|
|
|
|
|
|
|
|
|
$formDefaults = $sessionInfo; |
|
|
|
|
@ -156,14 +222,19 @@ if ($form->validate()) { |
|
|
|
|
$description = $params['description']; |
|
|
|
|
$showDescription = isset($params['show_description']) ? 1: 0; |
|
|
|
|
$sendSubscriptionNotification = isset($params['send_subscription_notification']); |
|
|
|
|
$isThisImageCropped = isset($params['cropResult']); |
|
|
|
|
|
|
|
|
|
$extraFields = array(); |
|
|
|
|
$extraFields = []; |
|
|
|
|
foreach ($params as $key => $value) { |
|
|
|
|
if (strpos($key, 'extra_') === 0) { |
|
|
|
|
$extraFields[$key] = $value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isset($extraFields['extra_image']) && $isThisImageCropped) { |
|
|
|
|
$extraFields['extra_image']['crop_parameters'] = $params['cropResult']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$return = SessionManager::edit_session( |
|
|
|
|
$id, |
|
|
|
|
$name, |
|
|
|
|
|