/
home2
/
reumatologia
/
public_html
/
admin
/
Upload File
HOME
<?php require_once("../inc_library_front.php"); /* verificamos si posee permisos */ if (!Session::CheckPerm(Modulo::Eventos)) Session::NoPerm(); $oCategorias = new Categorias(); $arrCategorias = $oCategorias->GetByIdTipo(ContenidoTipos::Encuestas); foreach ($arrCategorias as $oCategoria) { $oCategoria->Nombre = utf8_encode($oCategoria->Nombre); } ?> <!DOCTYPE html> <html> <head> <?php include("ssi_head_inc.php"); ?> <link href="css/cropper.css" rel="stylesheet"> <script type="text/javascript"> var Categorias = <?= json_encode($arrCategorias) ?>; </script> </head> <body class="fixed-left"> <!-- Begin page --> <div id="wrapper"> <?php include("ssi_header.php"); ?> <?php include("ssi_menu.php"); ?> <!-- ============================================================== --> <!-- Start right Content here --> <!-- ============================================================== --> <div class="content-page"> <!-- Start content --> <div class="content"> <div class="container"> <div class="row"> <div class="col-sm-12"> <h4 class="page-title">Encuestas</h4> <ol class="breadcrumb"> <li> <a href="index.php">Home</a> </li> <li class="active"> Encuestas </li> </ol> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="card-box"> <div class="col-sm-8"> </div> <div class="col-sm-4 text-right"> <a href="#custom-modal" class="btn btn-default btn-md waves-effect waves-light m-b-30" data-animation="fadein" data-plugin="custommodal" data-overlaySpeed="200" data-overlayColor="#36404a"><i class="md md-add"></i> Agregar Encuesta</a> </div> <div id="jsGrid"></div> </div> </div> </div> </div> </div> </div> <!-- Modal --> <div id="custom-modal" class="modal-demo"> <button type="button" class="close" onclick="ClosePopup();"> <span>×</span><span class="sr-only">Cerrar</span> </button> <h4 class="custom-modal-title">Agregar Encuesta</h4> <div class="custom-modal-text text-left"> <form id="form-add-encuesta" role="form" method="post" action="json-encuestas-add.php" class="form-horizontal resize-image" enctype="multipart/form-data"> <input type="hidden" id="Submitted" name="Submitted" value="1" /> <div class="form-group"> <label class="col-sm-12" for="Categoria">Categoria</label> <div class="col-sm-12"> <select class="form-control" required name="IdCategoria" id="IdCategoria" required parsley-trigger="change" data-parsley-required-message="Por favor seleccione la categoria"> <option value="">Seleccione la categoria</option> <?php foreach ($arrCategorias as $oCategoria) { ?> <option value="<?= $oCategoria->IdCategoria ?>"><?= utf8_encode($oCategoria->Nombre) ?></option> <?php } ?> </select> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Fecha">Fecha</label> <div class="col-sm-12"> <input type="text" class="form-control datepicker" id="Fecha" name="Fecha" placeholder="Fecha" required parsley-trigger="change" data-parsley-required-message="Por favor ingrese la fecha"> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Nombre">Título</label> <div class="col-sm-12"> <input type="text" class="form-control" required name="Titulo" id="Titulo" placeholder="Nombre" required parsley-trigger="change" data-parsley-required-message="Por favor ingrese el nombre" /> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Copete">Copete</label> <div class="col-sm-12"> <textarea class="form-control" id="Copete" name="Copete" placeholder="Copete"></textarea> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Cuerpo">Cuerpo</label> <div class="col-sm-12"> <textarea class="form-control" id="Cuerpo" name="Cuerpo" placeholder="Cuerpo"></textarea> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Video">Video</label> <div class="col-sm-12"> <input type="text" class="form-control" id="Video" name="Video" placeholder="Video"> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Video">Imágen</label> <div class="col-sm-6 col-sm-12"> <div class="img-container panel-body"> <div class="file-selector"> <img class="img-upl" id="image-1" src="images/upload-icon.png" data-id="1" alt="Picture"> <input type="file" class="img-upload" data-id="1" name="Image" id="img-1" accept="image/*" /> </div> <div class="m-t-10"> <button id="btn-rm-1" type="button" class="btn btn-danger waves-effect waves-light" disabled="disabled" onclick="RemoveImage('1');"><span class="btn-label"><i class="fa fa-times"></i></span> Eliminar imágen</button> </div> </div> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Video">Archivos</label> <div class="col-sm-12" id="files-container"> </div> </div> <div class="form-group"> <label class="col-sm-12" for="Destacado"><input type="checkbox" id="Destacado" name="Destacado" value="1"> Encuesta destacada </label> </div> <div class="form-group"> <div class="col-lg-6"> <div class="form-group col-sm-12" style="margin-bottom: 1px;"> <label for="Keyword">Keywords</label> <input type="text" class="form-control" name="Keyword" id="Keyword" placeholder="Keyword" parsley-trigger="change" data-parsley-selection-autocomplete="#seleccionKeyword" data-parsley-validate-if-empty="true" /> </div> <div class="col-sm-12" id="suggKeyword"></div> </div> <div class="col-lg-6"> <div class="form-group col-sm-12"> <label for="seleccionKeyword">Seleccionadas</label> <div class="col-sm-12" id="seleccionKeyword"></div> <div class="col-sm-12 text-danger" id="errKeyword"></div> </div> </div> </div> <div class="text-right"> <button type="submit" class="btn btn-default waves-effect waves-light">Guardar</button> <button type="button" class="btn btn-danger waves-effect waves-light m-l-10" onclick="ClosePopup();">Cancelar</button> </div> </form> </div> </div> <!-- Modal --> <!-- Modal Update --> <?php include('ssi_encuesta_modal_mod.php'); ?> <div class="modal fade" id="imagemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="z-index: 99999"> <input type="hidden" id="imgId" name="imgId" value=""> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Cerrar</span></button> <img src="" class="imagepreview" style="width: 100%;" > <div class="m-t-20 text-right"> <button class="btn btn-default" onclick="RotateRight();"><i class="fa fa-rotate-right"></i></button> <button class="btn btn-default" onclick="RotateLeft();"><i class="fa fa-rotate-left"></i></button> <a class="btn btn-primary" id="btn-img-save">Recortar imágen</a> </div> </div> </div> </div> </div> </div> <?php include("ssi_scripts.php"); ?> <!-- jsgris table js --> <script src="<?= Config::UrlFiles ?>assets/plugins/jsgrid/js/jsgrid.min.js"></script> <script src="js/jquery.jsgrid.encuestas.init.js"></script> <script src="js/jquery.jsgrid.init.js"></script> <script type="text/javascript" src="<?= Config::UrlFiles ?>assets/plugins/autocomplete/jquery.mockjax.js"></script> <script type="text/javascript" src="<?= Config::UrlFiles ?>assets/plugins/autocomplete/jquery.autocomplete.min.js"></script> <script type="text/javascript" src="js/resize_img.js"></script> <script src="js/cropper.js"></script><!-- Cropper.js is required --> <script src="js/jquery-cropper.min.js"></script> <script src="js/modal_crop.js"></script> <script src="<?= Config::UrlFiles ?>assets/plugins/tinymce/tinymce.min.js"></script> <script type="text/javascript" src="<?= Config::UrlFiles ?>assets/js/controles/autocompletar.js"></script> <script type="text/javascript"> var ratio = 12.91; function ClosePopup() { $('#IdCategoria').val(''); $('#Titulo').val(''); $('#Fecha').val(''); $('#FechaHasta').val(''); $('#Ubicacion').val(''); $('#Direccion').val(''); $('#Copete').val(''); $('#Cuerpo').val(''); $('#Web').val(''); $('#Email').val(''); $('#Descripcion').val(''); $('#Video').val(''); $('#Destacado').prop('checked', false); $('#image-1').attr('src', 'images/upload-icon.png'); $('#hd-1').remove(); $('#btn-rm-1').attr('disabled', 'disabled'); $('#seleccionKeyword').empty(); $('#files-container').empty(); InsertFile(0); SetupFile(1); $('#IdCategoriaU').val(''); $('#TituloU').val(''); $('#FechaU').val(''); $('#FechaHastaU').val(''); $('#UbicacionU').val(''); $('#DireccionU').val(''); $('#CopeteU').val(''); $('#CuerpoU').val(''); $('#WebU').val(''); $('#EmailU').val(''); $('#DescripcionU').val(''); $('#VideoU').val(''); $('#DestacadoU').prop('checked', false); $('#image-1').attr('src', 'images/upload-icon.png'); $('#hd-1').remove(); $('#hd-2').remove(); $('#modal-update #EliminarImagen').val(0); $('#btn-rm-2').attr('disabled', 'disabled'); $('#files-containerU').empty(); $('#seleccionKeywordU').empty(); InsertFile(100); SetupFile(101); Custombox.close(); } function RemoveFile(id) { $('#file-container-' + id).remove(); } function RemoveFileGuardado(id) { $('#file-container-' + id).remove(); var ids = $('#EliminarArchivos').val(); if (ids != '') ids += ','; ids+= id; $('#EliminarArchivos').val(ids); } function InsertFile(id) { var nextid = parseInt(id) + 1; if ($('#file-container-' + nextid).length > 0) return ; var template = '<div class="row" id="file-container-' + nextid + '" style="border: 1px solid #E3E3E3; padding: 10px;">'; template+= ' <div class="col-sm-12" style="margin-bottom: 5px">'; template+= ' <input type="file" class="file-upload" data-id="' + nextid + '" name="Archivo[]" id="file-' + nextid + '" accept="" />'; template+= ' </div>'; template+= ' <div class="col-sm-8">'; template+= ' <input type="text" class="form-control" id="NombreArchivo' + nextid + '" name="NombreArchivo[]" placeholder="Nombre del archivo">'; template+= ' </div>'; template+= ' <div class="col-sm-4">'; template+= ' <button id="btn-rm-file-' + nextid + '" type="button" class="btn btn-danger waves-effect waves-light" disabled="disabled" onclick="RemoveFile(\'' + nextid + '\');" style="height: 38px"><span class="btn-label"><i class="fa fa-times"></i></span> Eliminar</button>'; template+= ' </div>'; template+= '</div>'; if (nextid >= 100) $('#files-containerU').append(template); else $('#files-container').append(template); SetupFile(nextid); } function SetupFile(id) { $('#file-' + id).change(function() { if (this.files.length == 0) { $('#btn-rm-file-' + id).attr('disabled', 'disabled'); return; } var id = $(this).attr('data-id'); $('#btn-rm-file-' + id).removeAttr('disabled'); InsertFile(id); }); } $(document).ready(function () { $('#Keyword, #KeywordU').on("keypress", function(e) { var target = $(this).attr('data-parsley-selection-autocomplete'); /* ENTER PRESSED*/ if (e.keyCode == 13) { /* FOCUS ELEMENT */ var keyword = $(this).val(); $(this).val(''); var element = getItemTemplateDefault(keyword, keyword, 'keyword-seleccionado', 'suggKeyword', 'keyword'); $(target).append(element); return false; } }); document.addEventListener('custombox.close', function() { try { tinymce.execCommand('mceRemoveControl', true, 'Cuerpo'); } catch(err) {} try { tinymce.execCommand('mceRemoveControl', true, 'CuerpoU'); try { } catch(err) {} tinymce.execCommand('mceRemoveControl', true, 'Copete'); } catch(err) {} try { tinymce.execCommand('mceRemoveControl', true, 'CopeteU'); } catch(err) {} $('.mce-tinymce').remove(); $('#Cuerpo').show(); $('#CuerpoU').show(); $('#Copete').show(); $('#CopeteU').show(); }); document.addEventListener('custombox.complete', function() { tinymce.init({ selector: "textarea", theme: "modern", height:200, plugins: [ "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker", "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking", "save table contextmenu directionality emoticons template paste textcolor" ], toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l ink image | print preview media fullpage | forecolor backcolor emoticons", style_formats: [ {title: 'Bold text', inline: 'b'}, {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}}, {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}}, {title: 'Example 1', inline: 'span', classes: 'example1'}, {title: 'Example 2', inline: 'span', classes: 'example2'}, {title: 'Table styles'}, {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'} ] }); }); $('form').parsley({ excluded: "input[type=button], input[type=submit], input[type=reset], input[type=hidden], [disabled], :hidden" }); $('#btn-rm-2').click(function() { $('#EliminarImagen').val(1); }); InsertFile(0); SetupFile(1); InsertFile(100); SetupFile(101); $('#form-add-encuesta, #form-mod-encuesta').submit(function(e) { tinyMCE.triggerSave() var data = new FormData(this); var count = 1; $('.hi-url').each(function() { var id = $(this).attr('data-id'); var blob = dataURLToBlob($(this).val()); data.append('Imagen-' + count, blob); count++; }); data.append('Cantidad', count); $.ajax({ url: $(this).attr('action'), data: data, cache: false, contentType: false, processData: false, type: 'POST', success: function(data){ if (data.Success) { ClosePopup(); $("#jsGrid").jsGrid("loadData"); } else swal({ title: "Error!", text: data.Error, type: "error", timer: 2000, showConfirmButton: false }); } }); e.preventDefault(); return false; }); }); </script> </body> </html>