Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <head>
- <script type="text/JavaScript">
- function sortUnicode(a,b){return a[0].toLowerCase().localeCompare(b[0].toLowerCase());}
- function sortIt(o,s,r,n,t,i) {
- o.ord=!o.ord;
- n=o.parentNode.cellIndex;
- r=o.offsetParent.offsetParent.rows;
- var rows=[],cols=[];s=s||1;
- for(i=0;t=r[s+i];i++){
- rows.push(t.cloneNode(true));
- cols.push([t.cells[n].firstChild.nodeValue,i]);
- }
- cols.sort(sortUnicode);
- if(o.ord)cols.reverse()
- for(i=0;t=r[s+i];i++){
- var j = rows[cols[i][1]];
- t.parentNode.replaceChild(j,t);
- j.className=i%2?'odd':'even';
- }
- }
- function toggleClass(o,s){
- o.oldClassName=o.className
- o.className=s
- o.onmouseout=function(){o.className=o.oldClassName;}
- }
- </script>
- <style>
- table {
- border-collapse: collapse;
- width: 1000px;
- }
- th, td {
- text-align: left;
- padding: 8px;
- }
- tr:nth-child(even) {background-color: #f2f2f2;}
- </style>
- </head>
- </html>
- <?php
- $plik = fopen('kiero.txt','r');
- $zawartosc = '';
- $c = 0;
- echo "<table border = 1><tr>
- <th><a href='#' onclick='sortIt(this);return false;'>Data</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>SSI</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>Nr</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>Dzień</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>Co robi?</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>Linia</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>Brygada</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>Początek</a></th>
- <th><a href='#' onclick='sortIt(this);return false;'>Koniec</a></th>
- </tr>";
- while(!feof($plik))
- {
- $liniax = fgets($plik);
- if(strlen($liniax) < 100) continue;
- $linia[$c] = $liniax;
- $praca = strrpos($linia[$c],"praca");
- $tb = explode(' ', $linia[$c]);
- echo "<tr>";
- for($x = 0; $x < 17; $x++)
- {
- if($x == 0) echo "<td>".$tb[$x]."</td>"; //Data
- else if($x == 1 || $x == 2) continue;
- else if($x == 3) {
- $tc = explode(':',$tb[$x]);
- echo "<td>".$tc[1]."</td>"; //SSI
- }
- else if($x >= 4 && $x <= 11) continue;
- else if($x == 12) {
- $tc = explode(":'",$tb[$x]);
- echo "<td>".$tc[1]."</td>"; //Nr
- }
- else if($x == 13) continue;
- else if($x == 14) echo "<td>".$tb[$x]."</td>";
- else if($x == 15) echo "<td>".$tb[$x]."</td>"; //wolne, praca
- if($praca > 0){
- if($x == 16){
- $tc = explode("praca",$linia[$c]);
- $td = explode(' ',$tc[1]);
- echo "<td>".$td[1]."</td>";
- echo "<td>".$td[2]."</td>";
- if(ctype_upper($td[6]))
- {
- echo "<td>".$td[4]." - ".$td[5]." ".$td[6]."</td>";
- if(strlen($td[10]) > 0) {
- $td[10] = str_replace("'", '', $td[10]);
- echo "<td>".$td[8]." - ".$td[9]." ".$td[10]."</td>";
- }else{
- $td[9] = str_replace("'", '', $td[9]);
- echo "<td>".$td[8]." - ".$td[9]."</td>";
- }
- }
- else
- {
- echo "<td>".$td[4]." - ".$td[5]."</td>";
- if(strlen($td[9]) > 0) {
- $td[9] = str_replace("'", '', $td[9]);
- echo "<td>".$td[7]." - ".$td[8]." ".$td[9]."</td>";
- }else{
- $td[8] = str_replace("'", '', $td[8]);
- echo "<td>".$td[7]." - ".$td[8]."</td>";
- }
- }
- }
- }else{
- if($x == 16) {
- $tb[$x] = str_replace("'", '', $tb[$x]);
- echo "<td colspan='4'>".$tb[$x]."</td>";
- }
- }
- }
- echo "</tr>";
- $c = $c+1;
- }
- echo $c;
- //echo $zawartosc;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement