<?php

//Dropzone Dosyalarını Yazdırma Gösterim Yapılırken

function coklu_dosya_yazdir($dosya,$ekleyen,$baslik,$silme="silmesiz",$silmelink=0) {

error_reporting(0);

if($dosya!=null){
	
$dosyalar=json_decode($dosya);

	if(count($dosyalar)> 0){
?>
<div class="card">
                    <div class="card-header">
                        <h5> <?php echo $baslik; ?></h5>
                    </div>
                    <div class="card-body task-attachment">
                        <ul class="media-list p-0">
					<?php
					
					foreach($dosyalar as $d){ 
					
					//Dosya Türlerine Göre Stil
					if(strstr($d, "jpg") || strstr($d, "png")|| strstr($d, "jpeg")){$dosyatur="fa-file-image";
					}else if(strstr($d, "avi") || strstr($d, "mov")|| strstr($d, "mp4")){$dosyatur="fa-file-movie";
					}else if(strstr($d, "pdf")){$dosyatur="fa-file-pdf";
					}else{$dosyatur="fa-file";};
					
					

					//dosya yoksa dosyalar silinmiş vericez
					$testdosya=site_url('uploads/'. $d);
					if(!file_exists($testdosya))
					{
					
					?>
					
						<li class="media d-flex m-b-15">
								<?php if($dosyatur=="fa-file-image"){ ?>
									<img class="mr-3" src="<?php echo site_url('uploads/'. $d); ?>" width="64px" height="64px" >
									<?php }else{ ?>
                                <div class="m-r-20 file-attach">
										<i class="far <?php echo $dosyatur; ?> f-28 text-muted"></i>
                                </div>
								<?php } ?>
                                <div class="media-body">
                                    <a href="#!" class="m-b-5 d-block text-secondary">
									<?php echo $d; ?></a>
                                    <div class="text-muted">
                                        <small>
										Boyut :<?php
										$dosyaurl='uploads/'. $d;
										$dosyabyte=filesize("$dosyaurl");
										echo formatBytes($dosyabyte);?>
										</small>
                                        <small>
                                           Ekleyen <a href="#!" class="text-secondary"><?php echo $ekleyen; ?></a>
                                        </small>
                                    </div>
                                </div>
                                <div class="float-right text-muted">
								   <a href="<?php echo site_url('uploads/'. $d); ?>" data-lightbox="image-1" > <i class="fas fa-eye f-18"></i></a>
                                   <a href="<?php echo site_url('uploads/'. $d); ?>" download > <i class="fas fa-download f-18"></i></a>
								
								<?php if($silme=="silmeli"){ ?>
								
								<a href="#" data-target="#sil<?php echo md5($d); ?>" data-toggle="modal"  > <i class="fas fa-trash-alt f-18"></i></a>
								
								<div class="modal fade modal-primary" id="sil<?php echo md5($d); ?>" aria-hidden="true" role="dialog" tabindex="-1">
									<div class="modal-dialog">
									  <div class="modal-content modal-simple modal-center">
										<div class="modal-header">
										  <h5 class="modal-title">Dosyayı  Silmek İstediğinize Emin misiniz ?</h5>
										</div>
										<div class="modal-body">
										<center>
											</br>
										<?php if(strstr($d, "jpg") || strstr($d, "png")){ 	?>
										<img src="<?php echo site_url('uploads/'. $d); ?>" width="500px" ><br>
										<?php }; ?>
										 <?php echo $d; ?>
										 </br>
										 </center>
										</div>
										<div class="modal-footer">
										  <button type="button" class="btn btn-default btn-pure" data-dismiss="modal">Kapat</button>
										  <a href="<?php echo site_url($silmelink.'/'.$d); ?>" class="btn btn-success btn-sm waves-effect waves-classic"><span class="fa fa-trash"></span> Sil</a>
										</div>
									  </div>
									</div>
								  </div>
									
								<?php } ?>	
									
								</div>
                        </li>
			

						<?php  

						}else{
							//dosya silinmiş
							?>
							
							<li class="media d-flex m-b-15">
									
									<div class="m-r-20 file-attach">
											<i class="far fa-file f-28 text-muted"></i>
									</div>
									<div class="media-body">
										<a href="#!" class="m-b-5 d-block text-secondary">
										<?php echo $d; ?></a>
										<div class="text-muted">
											<small>Dosya Silinmiş</small>
										</div>
									</div>
								   
							</li>
							
						<?php	
						};
					
					} //foreach bitti
					?>
					
			       </ul>
                    </div>
               </div>
					<?php	
			}else{ echo "Dosya Yüklenmemiş";}
			}
		}

	//Sayfalama 1 2 3		

	function sayfalama_yazdir($aktifsayfa,$yon,$sayfagetiradet,$kayitsayi) {  ?>

			

						<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">

							<ul class="pagination">

							 <li class="paginate_button page-item previous disabled" id="DataTables_Table_0_previous"><a href="#" class="page-link">Önceki</a></li>

							<?php   

							$sayfasayi=$kayitsayi/$sayfagetiradet;

							$sayfasayi=ceil($sayfasayi);

							

							for($sayi = 0; $sayi < $sayfasayi; $sayi++) {

							?>

							<li class="paginate_button page-item  <?php if($aktifsayfa==$sayi){ echo"active";} ?>">

								<a href="<?php echo site_url($yon.$sayi); ?>"  class="page-link"><?php echo $sayi+1; ?></a>

							</li>

							<?php 

							}

							?>

								<li class="paginate_button page-item next disabled" id="DataTables_Table_0_next"><a href="#"   class="page-link">Sonraki</a></li>

							</ul>

						</div>

				

	<?php  }

	function musteriyaz($id)

	{  

			$ci =& get_instance();

			$ci->db->where('id', $id);

			$query = $ci->db->get('musteri')->row_array();

			$ad= $query['ad'];
			$logo= $query['logo'];


?>
			
					<img src="<?php echo site_url('uploads/'. $logo); ?>"  class="rounded mr-3" height="48" data-toggle="tooltip" data-placement="top" title="<?php echo $ad; ?>" />
					 <p class="m-0 d-inline-block align-middle font-16"> </p>
			

<?php  } 

	function calisanyaz($id)

	{  

			$ci =& get_instance();

			$ci->db->where('id', $id);

			$query = $ci->db->get('calisan')->row_array();

			$ad= $query['ad'];
			$profil= $query['profil'];


?>
			
					<img src="<?php echo site_url('uploads/'. $profil); ?>"  class="rounded mr-3" height="48" data-toggle="tooltip" data-placement="top" title="<?php echo $ad; ?>" />
					 <p class="m-0 d-inline-block align-middle font-16"> </p>
			
			


<?php  } ?>