<?php
   include_once('conexao.php');
   include_once('controller.php');
   include_once('funcao.php');
   include_once('DAO/DAOnoticias.php');
   include_once('classes/noticias.php');
   include_once('DAO/DAOblogMateria.php');
   include_once('classes/blog.php');
   
   $instance     = new funcao();
   $conn         = new Conexao();
   $noticias  = new DAOnoticias();
   $z  = new noticias();
   $blog  = new DaoBlogMateria();
    $b  = new Blog();

   
   
      if(!empty($_GET["nti_id"])){
   
   	$result = $noticias->pesquisarnoticias($_GET["nti_id"]);
   	foreach($result as $row){
   
   		$nti_id = $row["nti_id"]; 
   		$nti_titulo = $row["nti_titulo"]; 					
   		$nti_descricao = $row["nti_descricao"]; 			
   		$nti_imagem = $row["nti_imagem"]; 			
   		$nti_categoria = $row["nti_categoria"]; 			
   	}
   } 
   

   ?>
<!DOCTYPE html>
<html class="loading" lang="pt-br" data-textdirection="ltr">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
      <meta name="description" content="Micromaq Soluções em Impressão">
      <meta name="keywords" content="admin template, robust admin template, dashboard template, flat admin template, responsive admin template, web app, crypto dashboard, bitcoin dashboard">
      <!--<meta name="author" content="PIXINVENT">-->
      <title><?php include "titulo.php" ?></title>
      <link rel="apple-touch-icon" href="images/ico/apple-icon-120.png">
      <!--Favicon-->
      <link rel="icon" href="../img/core-img/favicon.png">
      <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i%7CMuli:300,400,500,700" rel="stylesheet">
      <link rel="stylesheet" type="text/css" href="fonts/feather/style.min.css">
      <link rel="stylesheet" type="text/css" href="fonts/simple-line-icons/style.min.css">
      <link rel="stylesheet" type="text/css" href="fonts/flag-icon-css/css/flag-icon.min.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/extensions/pace.css">
      <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
      <!--Editor Texto-->
      <script type="text/javascript" src="js/nicEdit.js"></script>
      <script type="text/javascript">
         bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
         
      </script>
      <!-- BEGIN VENDOR CSS-->
      <link rel="stylesheet" href="assets/font-awesome-4.7.0/css/font-awesome.min.css">
      <!--<link rel="stylesheet" type="text/css" href="vendors/css/extensions/sweetalert.css">-->
      <link rel="stylesheet" type="text/css" href="vendors/css/forms/selects/select2.min.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/forms/icheck/icheck.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/forms/icheck/custom.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/charts/morris.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/extensions/unslider.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/weather-icons/climacons.min.css">
      <!-- END VENDOR CSS-->
      <!-- BEGIN ROBUST CSS-->
      <link rel="stylesheet" type="text/css" href="css/app.min.css">
      <!-- END ROBUST CSS-->
      <!-- BEGIN Page Level CSS-->
      <link rel="stylesheet" type="text/css" href="css/core/menu/menu-types/horizontal-top-icon-menu.min.css">
      <link rel="stylesheet" type="text/css" href="css/core/colors/palette-climacon.css">
      <link rel="stylesheet" type="text/css" href="css/pages/users.min.css">
      <!-- END Page Level CSS-->
      <!-- BEGIN Custom CSS-->
      <link rel="stylesheet" type="text/css" href="assets/css/style.css">
      <!-- END Custom CSS-->
      <style>
         .card.card-fullscreen {
         display: block;
         z-index: 9999;
         position: fixed;
         width: 100% !important;
         height: 100% !important;
         top: 99px;
         right: 0;
         left: 0;
         bottom: 0;
         overflow: auto;
         }
         form .form-actions {
         border-top: 1px solid #FFF;
         padding: 1px 0;
         margin-top: 20px;
         }	
         @media screen and (max-width: 700px) {
         div.dt-buttons {
         float: none;
         width: 100%;
         text-align: center;
         margin-bottom: 3.5em;
         }	
         }
      </style>
   </head>
   <body class="horizontal-layout horizontal-top-icon-menu 2-columns   menu-expanded" data-open="hover" data-menu="horizontal-menu" data-col="2-columns">
      <!-- Menu-->
      <?php include "menu.php" ?>
      <?php
         function selected( $value, $selected ){
         return $value==$selected ? ' selected="selected"' : '';
         }
         ?>
      <!-- Horizontal navigation-->
      <div class="app-content content">
         <div class="content-wrapper">
            <div class="content-header row">
               <div class="content-header-left col-md-6 col-12 mb-2">
                  <h3 class="content-header-title"><i class="icon-note"></i>Cadastros</h3>
                  <h5 class="content-header-title" style="margin-left: 7px;"><i class="ft-corner-down-right"></i><a href="view-lista-comentario.php" style="font-size: 12px;">Listar Comentários</a></h5>
                  
               </div>
            </div>
            <div class="content-body">
               <!-- Basic form layout section start -->
               <section id="basic-form-layouts">
                  <div class="row justify-content-md-center">
                     <div class="col-md-8">
                        <div class="card" style="margin-top: -100px;">
                           <div class="card-header">
                              <h4 class="card-title" id="basic-layout-card-center">Listar Comentários</h4>
                              <a class="heading-elements-toggle"><i class="fa fa-ellipsis-v font-medium-3"></i></a>
                              <div class="heading-elements">
                                 <ul class="list-inline mb-0">
                                    <li>
                                       <a href="view-lista-comentario.php">
                                          <i class="ft-eye" style="font-size: 19px;"></i>
                                    <li><a data-action="collapse"><i class="ft-minus" style="font-size: 19px;"></i></a></li>
                                    <li><a data-action="reload"><i class="ft-rotate-cw" style="font-size: 19px;"></i></a></li>
                                    <li><a data-action="expand"><i class="ft-maximize" style="font-size: 19px;"></i></a></li>
                                    <li><a data-action="close"><i class="ft-x" style="font-size: 19px;"></i></a></li>
                                 </ul>
                              </div>
                           </div>
                           <div class="card-content collapse show">
                              <div class="card-body">						  
                                 <form id="myForm" method="post" enctype="multipart/form-data" style="line-height: 1.2;">
                                    <!--<form class="form" style="line-height: 1.2;">-->
                                    <div class="form-body">
                                       <div class="row">
                                          <!--INPUT SERVA PARA GRAVAR O LINK DE DESTINO DO LOCATION APOS INSERÇÃO-->
                                          <input type="hidden" id="link_destino" name="link_destino" value="" >
										  
										
										  
                                          <div class="col-md-12">
                                             <div class="form-group">
                                                <label for="Títuli">Título</label>
                                                <input type="text" class="form-control" id="nti_titulo" name="nti_titulo" value="<?php echo $nti_titulo; ?>" style="font-size: 12px;" placeholder="" readonly>
                                             </div>
                                          </div>
										  
								<!-- <div class="comment-content">-->
								 <div class="col-md-12">
								    <div class="comments-wrapper"><br>
                                                <h3 style="margin-left: 0%;"> Comentários </h3>
												
												
												
												<!--table-->
												<div class="tab-content table-responsive" style="width: 100%;">
												<table id="DataTable" class="table table-striped table-bordered" style="font-size: 13px;" >
													<thead>
														<tr>
														
															<th style="">Nome</th>
															<th style="">Comentário</th>		
															<th style="">Data</th>		
															<th style="">Ação</th>		

														</tr>
													</thead>
													<tbody>  
												   <?php $result =  $blog->ListarComentarios($_GET['nti_id']);
												   foreach($result as $row){ 
												   ?>
													<tr id="coment_<?php echo $row['blc_id']; ?>">
															<td data-target="" > <?php echo $row["blc_nome"];?> </td>
															<td	data-target=""><?php echo $row['blc_comentario'];?> </td>
															<td	data-target=""><?php echo $row['blc_dt_inserido'];?> </td>
															<td>	
																<a href="javascript:void(0)" onclick="deletar_registro('<?php echo $row["blc_nome"];?>','<?php echo $row["blc_id"];?>')" data-toggle="tooltip" title="Excluir" > 
																<button type="button" class="btn btn-danger btn-xs" ><span class="ft-trash-2" aria-hidden="true"></span></button>
																</a>
															</td>
															
														</tr>
														<?php } ?> 
													</tbody>
												</table>      
											</div>

                                            </div>
                                       
                                       </div>
                                      
                                  
                                                   </span>
                                                </div>
                                             </div>
                                          </div>
                                       </div>
                                    </div>
                                 
                                 </form>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
				  
				  
               </section>
               <!-- // Basic form layout section end -->
            </div>
         </div>
      </div>
      <!-- ////////////////////////////////////////////////////////////////////////////-->
      <?php include "footer.php" ?>
      <!-- Ampliar imagem -->
      <div class="modal fade" id="myModalImagem" role="dialog">
         <div class="modal-dialog modal-lg">
            <!-- Modal content-->
            <div class="modal-content" style="width: 50%;margin-left: 35%;margin-right: 35%;margin-top: 20%;">
               <div class="modal-header">
                  <h4 class="modal-title">Foto Ampliada</h4>
                  <button data-toggle="tooltip" title="Fechar" onclick="atualiza()" target="Iframe" href="view-noticias.php" type="button" class="btn btn-default" data-dismiss="modal" style="float: right;position: relative;margin-top: -31px;">X</button>
               </div>
               <div class="modal-body">
                  <!-- Iframe -->
                  <div id="imagem12" >
                  </div>
               </div>
            </div>
         </div>
      </div>
      <script src="js/sweetalert2@10.js"></script>
      <!-- BEGIN VENDOR JS-->
      <script src="vendors/js/vendors.min.js"></script>
      <!-- BEGIN VENDOR JS-->
      <!-- BEGIN PAGE VENDOR JS--> 
      <script src="vendors/js/ui/jquery.sticky.js"></script>
      <script src="vendors/js/charts/jquery.sparkline.min.js"></script>
      <!--<script src="vendors/js/extensions/sweetalert.min.js"></script>-->
      <script src="vendors/js/forms/select/select2.full.min.js"></script>
      <!-- END PAGE VENDOR JS-->
      <!-- BEGIN ROBUST JS-->
      <script src="js/core/app-menu.min.js"></script>
      <script src="js/core/app.min.js"></script>
      <script src="js/scripts/customizer.min.js"></script>
      <!-- END ROBUST JS-->
      <!-- BEGIN PAGE LEVEL JS-->
      <script src="js/scripts/ui/breadcrumbs-with-stats.min.js"></script>
      <script src="js/scripts/extensions/sweet-alerts.min.js"></script>
      <script src="js/scripts/forms/select/form-select2.min.js"></script>
      <script src="js/scripts/navs/navs.min.js"></script>
      <!-- END PAGE LEVEL JS-->
      <!--<script src="js/jquery.3.2.1.min.js"></script>-->
	  
	  	<script>
	function deletar_registro(nome,id){
		Swal.fire({
		  title: 'Prosseguir com a exclusão?',
		  text: "O registro "+nome+" será excluído!",
		  icon: 'question',
		  showCancelButton: true,
		  confirmButtonColor: '#3085d6',
		  cancelButtonColor: '#d33',
		  confirmButtonText: 'Sim, prosseguir!',
		  cancelButtonText: 'Cancelar'
		}).then((result) => {
		  if (result.isConfirmed) {
			  
			  $.post("excluir_comentario.php",{id:id},function(data){
				  
				  var el = document.getElementById('coment_'+id);
el.remove();
				  
					//$('#DataTable').DataTable().ajax.reload();
				//alert(data);
				//select();
				});	
			
			Swal.fire({
			  position: 'top-end',
			  icon: 'success',
			  title: 'Registro Excluído',
			  showConfirmButton: false,
			  timer: 1500
			})
			
		  }
		})
}	
	</script>
	  
      <script>
         // INICIO FUNÇÃO DE MASCARA MAIUSCULA
         function maiuscula(z){
         v = z.value.toUpperCase();
         z.value = v;
         				 }
         //FIM DA FUNÇÃO MASCARA MAIUSCULA
      </script>
      <script>
         //AmpliarImagem
         function ampliaimagem(imagem){
         document.getElementById("imagem12").innerHTML  = '<img src="uploads/noticias/'+imagem+'" width="100%" height="100%" />';
         
                  } 
         
         
      </script>
   </body>
   <!-- Mirrored from pixinvent.com/bootstrap-admin-template/robust/html/ltr/horizontal-top-icon-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 12 Feb 2021 19:25:59 GMT -->
</html>