HEX
Server: Apache
System: Linux clpupre 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64
User: undanet (1000)
PHP: 7.4.3
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/undanet/www/PortalEmpleo/src/Views/reports/candidateAcessInfo.php
<div class="table-responsive" id="candidateacessinfo">
<table class="table table-striped table-hover table-export table-export-acessinfo" id="candidate-acess-info-table">
	<thead class="table-secondary input-container">
		<tr>
			<th scope="col" class="input-group-large">
				<span class="col-title"><?php echo __( 'Name', 'panoramic_child' ); ?></span>
				<div class="input-group mb-3 input-group-large">
					<input type="text" name="name-field" class="form-control text-filter-field" placeholder="<?php echo __( 'Name', 'panoramic_child' ); ?>" aria-label="Name" aria-describedby="basic-addon1">
					<span class="col_ordened col_0_order"></span>
				</div>
			</th>
			<th scope="col" class="input-group-litle">
				<span class="col-title"><?php echo __( 'DNI', 'panoramic_child' ); ?></span>
				<div class="input-group mb-3">
					<input type="text" name="dni-field" class="form-control text-filter-field" placeholder="<?php echo __( 'DNI', 'panoramic_child' ); ?>" aria-label="DNI" aria-describedby="basic-addon1">
					<span class="col_ordened col_1_order"></span>
				</div>
			</th>
			<th scope="col" class="input-group-large">
				<span class="col-title"><?php echo __( 'Email', 'panoramic_child' ); ?></span>
				<div class="input-group mb-3 input-group-large">
					<input type="text" name="email-field" class="form-control text-filter-field" placeholder="<?php echo __( 'Email', 'panoramic_child' ); ?>" aria-label="Email" aria-describedby="basic-addon1">
					<span class="col_ordened col_2_order"></span>
				</div>
			</th>
			<th scope="col" class="col-empty col_3_order">
				<span class="col-title"><?php echo __( 'Motivation', 'panoramic_child' ); ?></span>
			</th>
			<th scope="col" class="col-centered">
				<span class="col-title"><?php echo __( 'Another selection process?', 'panoramic_child' ); ?></span>				
				 <div class="input-group mb-3">
					<input type="checkbox" value="" name="selection-field" id="selection-field" onchange="chkbox_selection_field()" class="form-control text-filter-field checkpicker selection-field" aria-label="Selection" aria-describedby="basic-addon1">
					<span class="col_ordened col_4_order"></span>
				</div> 
			</th>
			<th scope="col" class="input-group-medium">
				<span class="col-title"><?php echo __( 'How did you meet us?', 'panoramic_child' ); ?></span>
				<div class="input-group mb-3">
					<select class="selectpicker multiple-select-filter-field know-field" multiple name="know-field" data-live-search="true" title="<?php echo __('Select', 'panoramic_child')?>">
						<?php foreach(array_unique(array_column($data, 'conocido')) as $conocido) { ?>
							<option value="<?php echo strtolower($conocido); ?>"><?php echo $conocido; ?></option>
						<?php } ?>
					</select>
					<span class="col_ordened col_5_order"></span>
				</div>
			</th>
			<th scope="col" class="col-centered">
				<span class="col-title"><?php echo __( 'More Info?', 'panoramic_child' ); ?></span>
				<div class="input-group mb-3 check-content">
					<input type="checkbox" name="moreinfo-field" value="" id="moreinfo-field" onchange="chkbox_moreinfo_field()" class="form-control text-filter-field checkpicker moreinfo-field" aria-label="Selection" aria-describedby="basic-addon1">
					<input type="checkbox" name="moreinfo-field_no" value="" id="moreinfo-field_no" onchange="chkbox_moreinfo_field()" class="form-control text-filter-field checkpicker moreinfo-field_no" aria-label="Selection" aria-describedby="basic-addon1">
					<span class="col_ordened col_6_order"></span>
				</div>
			</th>
		</tr>
	</thead>
	<tbody>
		<?php 
		foreach ($data as $user) { ?>
			<tr class="tr-row"> 
				<td scope="row"><?php echo $user['nombre']; ?></td>
				<td scope="row"><?php echo $user['dni']; ?></td>
				<td scope="row"><?php echo $user['correo']; ?></td> 
				<td scope="row" class="row-fixed"><?php echo $user['motivacion']; ?></td>
				<td scope="row" class="center-field center-field-check"><?php if($user['seleccion']){echo __( 'Yes', 'panoramic_child' );} else{echo __( 'No', 'panoramic_child' );}  ?></td>
				<td scope="row"><?php echo $user['conocido']; ?></th>
				<td scope="row" class="center-field center-field-check"><?php if($user['masinfo']){echo __( 'Yes', 'panoramic_child' );} else{echo __( 'No', 'panoramic_child' );} ?></td>
			</tr>
		<?php } ?>
	</tbody>
</table>
<script>
 function chkbox_moreinfo_field() {
          let chkbox = document.querySelector("input#moreinfo-field")
		  let chkbox_no = document.querySelector("input#moreinfo-field_no")
          if ( (chkbox.checked) && (!chkbox_no.checked) ) {
            chkbox.value = "<?php echo __( 'Yes', 'panoramic_child' ); ?>";
			document.querySelector("input#moreinfo-field_no").style.color = "#495057";
			document.querySelector("input#moreinfo-field").style.color = "transparent";
          } 
		  else if ( (!chkbox.checked) && (chkbox_no.checked) ) {
            chkbox.value = "<?php echo __( 'No', 'panoramic_child' ); ?>";
			document.querySelector("input#moreinfo-field_no").style.color = "transparent";
			document.querySelector("input#moreinfo-field").style.color = "#495057";
          } 
		  else if ( (chkbox.checked) && (chkbox_no.checked) ) {
            chkbox.value = "";
			document.querySelector("input#moreinfo-field_no").style.color = "transparent";
			document.querySelector("input#moreinfo-field").style.color = "transparent";
          } 
		  else {
            chkbox.value = "";
			document.querySelector("input#moreinfo-field_no").style.color = "#495057";
			document.querySelector("input#moreinfo-field").style.color = "#495057";
          }
}
 function chkbox_selection_field() {
          let chkbox = document.querySelector("input#selection-field")
          if (chkbox.checked) {
            chkbox.value = "<?php echo __( 'Yes', 'panoramic_child' ); ?>"
          } else {
            chkbox.value = ""
          }
}

(function($) {	
	
	
	$(document).ready(function () {
		var table = $('#candidate-acess-info-table').DataTable({			
			initComplete: function(settings, json) {
				$('th.sorting').off();
			  },				
			dom: 'Bfrtlip',
			buttons: [{
				extend: "csv",
				charset: 'UTF-8',
				text: '<?php echo __( 'Export results to CSV file', 'panoramic_child' ); ?>',
				bom: true,
				filename: '<?php echo __( 'personal_access_candidates', 'panoramic_child' ); ?>',
				exportOptions: {
					format: {
						header: function (data) {
							return $('<span></span>').append(data).find('.col-title').text()
						}
					},   
					columns: ':visible:not(.notexport)'
				}
			}],
			language: {
				paginate: {
				  next: '<?php echo __( 'Next', 'panoramic_child' ); ?>', // &#8594; or '→'
				  previous: '<?php echo __( 'Previous', 'panoramic_child' ); ?>' //&#8592; or '←' 
				},
				'search':'<?php echo __( 'Search:', 'panoramic_child' ); ?>',
				"info":"<?php echo __( 'Showing', 'panoramic_child' ); ?> _START_ <?php echo __( 'to', 'panoramic_child' ); ?> _END_ <?php echo __( 'of', 'panoramic_child' ); ?> _TOTAL_ <?php echo __( 'entries', 'panoramic_child' ); ?>",
				"infoEmpty":"<?php echo __( 'Showing 0 to 0 of 0 entries', 'panoramic_child' ); ?>",
				"infoFiltered":"(<?php echo __( 'filtered', 'panoramic_child' ); ?> <?php echo __( 'from', 'panoramic_child' ); ?> _MAX_ total <?php echo __( 'entries', 'panoramic_child' ); ?>)",
				"zeroRecords":"<?php echo __( 'No matching records found', 'panoramic_child' ); ?>",
				"lengthMenu": "<?php echo __( 'Show', 'panoramic_child' ); ?> _MENU_ <?php echo __( 'entries', 'panoramic_child' ); ?>",
				"loadingRecords":"<?php echo __( 'Loading...', 'panoramic_child' ); ?>",
			  }
		});
		
		table.order.listener( '.col_0_order', 0 );
		table.order.listener( '.col_1_order', 1 );
		table.order.listener( '.col_2_order', 2 );
		table.order.listener( '.col_3_order', 3 );
		table.order.listener( '.col_4_order', 4 );
		table.order.listener( '.col_5_order', 5 );
		table.order.listener( '.col_6_order', 6 );
		table.order.listener( '.col_7_order', 7 );
		table.order.listener( '.col_8_order', 8 );
		table.order.listener( '.col_9_order', 9 );
		table.order.listener( '.col_10_order', 10 );
		table.order.listener( '.col_11_order', 11 );
		table.order.listener( '.col_12_order', 12 );
		table.order.listener( '.col_13_order', 13 );
		table.order.listener( '.col_14_order', 14 );
		table.order.listener( '.col_15_order', 15 );
		table.order.listener( '.col_16_order', 16 );
		table.order.listener( '.col_17_order', 17 );
		
		$('.input-container .selectpicker').on('change', function() {
			table.draw();
		});
		$('.input-container .checkpicker').on('change', function() {
			table.draw();
		});
		$('.input-container input[type="text"]').on('keyup', function() {
			table.draw();
		});	
			
		
	});
	
	$.fn.dataTable.ext.search.push(function (settings, data, dataIndex) {
		let namefield = $('.input-container input[name="name-field"]').val().toLowerCase();
		let dnifield = $('.input-container input[name="dni-field"]').val().toLowerCase();
		let emailfield = $('.input-container input[name="email-field"]').val().toLowerCase();
		let selectionfield = $('.input-container .checkpicker.selection-field').val().toLowerCase();
		let knowfield = $('.input-container .selectpicker.know-field').val().join(' ').toLowerCase();
		let moreinfofield = $('.input-container .checkpicker.moreinfo-field').val().toLowerCase();
		if (
			data[0].toLowerCase().indexOf(namefield) > -1 && 
			data[1].toLowerCase().indexOf(dnifield) > -1 && 
			data[2].toLowerCase().indexOf(emailfield) > -1 &&
			data[4].toLowerCase().indexOf(selectionfield) > -1 &&
			(knowfield == '' || knowfield.indexOf(data[5].toLowerCase()) > -1) &&
			data[6].toLowerCase().indexOf(moreinfofield) > -1
			
			
		) {
			return true;
		}
		return false;
	});	
	
})(jQuery); 

function exportTableToCSV(filename) {
	var csv = [];
	var rows = document.querySelectorAll('table.table-export tr:not([style*="display: none"])');
	
	for (var i = 0; i < rows.length; i++) {
		
		var row = [], cols = rows[i].querySelectorAll('th[scope="col"] .col-title ,th[scope="row"]:not(.not-export)');
		
		for (var j = 0; j < cols.length; j++){ 
			row.push(`"${cols[j].innerText}"`);
		}
		csv.push(row.join(","));   
	   
	}
	// Download CSV file
	downloadCSV(csv.join("\n"), filename);
}
            
function downloadCSV(csv, filename) {
	var csvFile;
	var downloadLink;
	// CSV file
	csvFile = new Blob(["\uFEFF"+csv], {type: "text/csv;charset=utf-8"});
	// Download link
	downloadLink = document.createElement("a");
	// File name
	downloadLink.download = filename;
	// Create a link to the file
	downloadLink.href = window.URL.createObjectURL(csvFile);
	// Hide download link
	downloadLink.style.display = "none";
	// Add the link to DOM
	document.body.appendChild(downloadLink);
	// Click download link
	downloadLink.click();
}

</script>
</div>