Advertisement
WOSTEMBERG3

FullCalendar

Sep 18th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.06 KB | None | 0 0
  1.   <script>
  2.  
  3.   document.addEventListener('DOMContentLoaded', function() {
  4.     var calendarEl = document.getElementById('calendarioEventos');
  5.  
  6.     var calendar = new FullCalendar.Calendar(calendarEl, {
  7.       locale: 'pt-br',
  8.       plugins: [ 'interaction', 'dayGrid' ],
  9.       editable: true,
  10.       eventLimit: true,
  11.      
  12.  
  13.          
  14.       <?php if(!empty($viewData['eventos'])): $eventos = $viewData['eventos']; ?>
  15.    
  16.       events: [
  17.           <?php  foreach ($eventos as $evento): ?>  
  18.           {
  19.             id: '<?php echo $evento['id']; ?>',
  20.             title: '<?php echo $evento['title']; ?>',
  21.             start: '<?php echo $evento['start']; ?>',
  22.             end: '<?php echo $evento['end']; ?>',
  23.             color: '<?php echo $evento['color']; ?>',
  24.             url: '<?php echo $evento['url']; ?>',
  25.             description: '<?php echo $evento['descricao']; ?>',
  26.             textColor: 'white'
  27.           },
  28.  
  29.                
  30.           <?php endforeach; ?>
  31.  
  32.         ],
  33.       cache: true,
  34.       eventClick: function(info) {
  35.         info.jsEvent.preventDefault();
  36.         $('#visualizar #descriptionModal').text('<?php echo $evento['descricao']; ?>');
  37.  
  38.  
  39.         var img = 'assets/img/home/eventos/' + '<?php echo $evento['url']; ?>';
  40.         $('#urlModal').attr('src', img);
  41.  
  42.  
  43.         $('#titleModal').text('<?php echo $evento['title']; ?>');
  44.         $('#startModal').text('<?php echo date('d/m/Y H:i', strtotime($evento['start'])); ?>');
  45.         $('#endModal').text('<?php echo date('d/m/Y H:i', strtotime($evento['end'])); ?>');
  46.         $('#eventoModal').modal('show');
  47.       }
  48.         <?php  endif; ?>
  49.     });
  50.  
  51.     calendar.render();
  52.   });
  53.  
  54. </script>
  55.  
  56.  
  57. <?php
  58.  
  59. date_default_timezone_set('America/Campo_Grande'); ?>
  60. <div class="container">
  61.     <div><br/>
  62.     <div class="form-control" style="text-align: center; font-weight: bold;">Clique no evento para visualizar as informações</div>
  63.         <div id="calendarioEventos" class="w-100"></div>
  64.     </div>
  65. </div>
  66. <!-- Modal -->
  67. <div class="modal fade" id="eventoModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  68.   <div class="modal-dialog modal-lg" role="document">
  69.     <div class="modal-content">
  70.       <div class="modal-header">
  71.         <h5 class="modal-title" id="titleModal"></h5>
  72.         <button type="button" class="close" data-dismiss="modal" aria-label="Fechar">
  73.           <span aria-hidden="true">&times;</span>
  74.         </button>
  75.       </div>
  76.       <div class="modal-body">
  77.         <div id="visualizar" >
  78.  
  79.             <div class="row">
  80.             <div class="col" style="text-align: center;"><span>O evento terá início às:<div id="startModal"></div></span></div>
  81.             <div class="col" style="text-align: center;"><span>O evento encerrará às:<div id="endModal"></div> </span></div>
  82.             </div>
  83.             <hr>
  84.           <div id="descriptionModal"  style="text-align: center;"></div><br>
  85.           <figure style="text-align: center;">
  86.           <img src="" id="urlModal">
  87.         </figure>
  88.         </div> 
  89.       </div>
  90.     </div>
  91.   </div>
  92. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement