File: /home/imensosw/public_html/imenso.co/matrix/data_view.php
<?php include 'header_data.php';?>
<?php
error_reporting(0);
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
// assuming file.zip is in the same directory as the executing script.
// include('PHPExcel/Classes/PHPExcel/IOFactory.php');
$FileName = "docs/".$_GET['assignment_no']."/".$_GET['assignment_no'].".xls";
if(file_exists($FileName))
{
$inputFileName = $FileName;
$fileType = "Xls";
}
else{
$fileType = "Xlsx";
$inputFileName = "docs/".$_GET['assignment_no']."/".$_GET['assignment_no'].".xlsx";
}
/*$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$excel2 = PHPExcel_IOFactory::createReader($inputFileType);
$excel2 = $objPHPExcel = $excel2->load($inputFileName);
// Empty Sheet
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();*/
// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
// $spreadsheet = $reader->load($inputFileName);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$d=$spreadsheet->getSheet(0)->toArray();
$sheet = $spreadsheet->getActiveSheet();
// Get the highest row and column numbers referenced in the worksheet
$highestRow = $sheet->getHighestRow(); // e.g. 10
$highestColumn = $sheet->getHighestColumn(); // e.g 'F'
$rowData="";
?>
<div class="container-area">
<div class="container-fluid h-100">
<div class="row">
<div class="left-side border-right">
<ul class="list-group list-group-flush" >
<?php
for ($row = 1; $row <= $highestRow; $row++) {
// Read a row of data into an array
$rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
$check_data="";
if($rowData[0][0]!="Document ID"){
if($rowData[0][3]!=""){
$check_data = "done doubt";
}
else if($rowData[0][2]!="" || $rowData[0][1]!="")
{
$check_data = "done";
}
else{
$check_data = "default";
}
/*if($rowData[0][2]!="" || $rowData[0][3]!=""){
if($rowData[0][3]==""){
$check_data = "done";
}
else{
$check_data = "done doubt";
}
}
else{
$check_data = "default";
}*/
?>
<li class="list-group-item p-0 <?php echo $check_data; ?>" >
<a href="javascript:;" id="row_link" data-row_id="<?php echo $row; ?>" data-doc_id="<?php echo $rowData[0][0]; ?>"><?php echo $rowData[0][0]; ?></a>
</li>
<?php } } ?>
</ul>
</div>
<div class="right-side">
<div class="row h-100">
<div class="col-md-12 h-100">
<!-- <h2 class="m-0">View PDF</h2>
<hr /> -->
<iframe id="row_iframe" src="" width="100%" class="h-100"></iframe>
</div>
</div>
<!-- <div class="footer-right border-top">
</div> -->
</div>
</div>
</div>
</div>
<footer class="footer-area border-top">
<div class="container-fluid d-flex h-100">
<div class="row justify-content-end align-self-center w-100">
<div class="container-fluid">
<form class="form-inline w-100" id="formAddRow" >
<input type="hidden" name="rowId" id="rowId">
<input type="hidden" name="docId" id="docId">
<!--<label for="email">Title:</label>-->
<input name="title" id="title" onkeyup="var start = this.selectionStart; var end = this.selectionEnd; this.value = this.value.toUpperCase(); this.setSelectionRange(start, end); " style="width:45%" type="text" class="form-control" placeholder="Document Title">
<!--<label for="pwd">Date:</label>-->
<input type="text" class="form-control date-format" name="date" id="date" placeholder="Issue Date" style="width:115px" >
<span status="none" class="error" style="display: none">Invalid Date !!</span>
<!--<label for="pwd">Description:</label>-->
<input type="text" class="form-control" id="description" name="description" placeholder="Help Description" style="width:27%" >
</form>
</div>
</div>
</div>
</footer>
</body>
</html>