Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.89 KB | None | 0 0
  1. <html>
  2.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  3.     <head>
  4.         <script type="text/JavaScript">
  5.             function sortUnicode(a,b){return a[0].toLowerCase().localeCompare(b[0].toLowerCase());}
  6.             function sortIt(o,s,r,n,t,i) {
  7.                 o.ord=!o.ord;
  8.                 n=o.parentNode.cellIndex;
  9.                 r=o.offsetParent.offsetParent.rows;
  10.                 var rows=[],cols=[];s=s||1;
  11.                 for(i=0;t=r[s+i];i++){
  12.                     rows.push(t.cloneNode(true));
  13.                     cols.push([t.cells[n].firstChild.nodeValue,i]);
  14.                 }
  15.                 cols.sort(sortUnicode);
  16.                 if(o.ord)cols.reverse()
  17.                 for(i=0;t=r[s+i];i++){
  18.                     var j = rows[cols[i][1]];
  19.                     t.parentNode.replaceChild(j,t);
  20.                     j.className=i%2?'odd':'even';
  21.                 }
  22.             }
  23.             function toggleClass(o,s){
  24.                 o.oldClassName=o.className
  25.                 o.className=s
  26.                 o.onmouseout=function(){o.className=o.oldClassName;}
  27.             }
  28.         </script>
  29.         <style>
  30.             table {
  31.               border-collapse: collapse;
  32.               width: 1000px;
  33.             }
  34.  
  35.             th, td {
  36.               text-align: left;
  37.               padding: 8px;
  38.             }
  39.  
  40.             tr:nth-child(even) {background-color: #f2f2f2;}
  41.         </style>
  42.     </head>
  43. </html>
  44.  
  45. <?php
  46. $plik = fopen('kiero.txt','r');
  47.  
  48. $zawartosc = '';
  49.  
  50. $c = 0;
  51. echo "<table border = 1><tr>
  52.    <th><a href='#' onclick='sortIt(this);return false;'>Data</a></th>
  53.    <th><a href='#' onclick='sortIt(this);return false;'>SSI</a></th>
  54.    <th><a href='#' onclick='sortIt(this);return false;'>Nr</a></th>
  55.    <th><a href='#' onclick='sortIt(this);return false;'>Dzień</a></th>
  56.    <th><a href='#' onclick='sortIt(this);return false;'>Co robi?</a></th>
  57.    <th><a href='#' onclick='sortIt(this);return false;'>Linia</a></th>
  58.    <th><a href='#' onclick='sortIt(this);return false;'>Brygada</a></th>
  59.    <th><a href='#' onclick='sortIt(this);return false;'>Początek</a></th>
  60.    <th><a href='#' onclick='sortIt(this);return false;'>Koniec</a></th>
  61.  </tr>";
  62. while(!feof($plik))
  63. {  
  64.     $liniax = fgets($plik);
  65.     if(strlen($liniax) < 100) continue;
  66.     $linia[$c] = $liniax;
  67.     $praca = strrpos($linia[$c],"praca");
  68.     $tb = explode(' ', $linia[$c]);
  69.     echo "<tr>";
  70.     for($x = 0; $x < 17; $x++)
  71.     {
  72.         if($x == 0) echo "<td>".$tb[$x]."</td>"; //Data
  73.         else if($x == 1 || $x == 2) continue;
  74.         else if($x == 3) {
  75.             $tc = explode(':',$tb[$x]);
  76.             echo "<td>".$tc[1]."</td>"; //SSI
  77.         }
  78.         else if($x >= 4 && $x <= 11) continue;
  79.         else if($x == 12) {
  80.             $tc = explode(":'",$tb[$x]);
  81.             echo "<td>".$tc[1]."</td>"; //Nr
  82.         }
  83.         else if($x == 13) continue;
  84.         else if($x == 14) echo "<td>".$tb[$x]."</td>";
  85.         else if($x == 15) echo "<td>".$tb[$x]."</td>"; //wolne, praca
  86.         if($praca > 0){
  87.             if($x == 16){
  88.                 $tc = explode("praca",$linia[$c]);
  89.                 $td = explode(' ',$tc[1]);
  90.                 echo "<td>".$td[1]."</td>";
  91.                 echo "<td>".$td[2]."</td>";
  92.                 if(ctype_upper($td[6]))
  93.                 {
  94.                     echo "<td>".$td[4]." - ".$td[5]."&nbsp".$td[6]."</td>";
  95.                     if(strlen($td[10]) > 0) {
  96.                         $td[10] = str_replace("'", '', $td[10]);
  97.                         echo "<td>".$td[8]." - ".$td[9]."&nbsp".$td[10]."</td>";
  98.                     }else{
  99.                         $td[9] = str_replace("'", '', $td[9]);
  100.                         echo "<td>".$td[8]." - ".$td[9]."</td>";
  101.                     }
  102.                 }
  103.                 else
  104.                 {
  105.                     echo "<td>".$td[4]." - ".$td[5]."</td>";
  106.                     if(strlen($td[9]) > 0) {
  107.                         $td[9] = str_replace("'", '', $td[9]);
  108.                         echo "<td>".$td[7]." - ".$td[8]."&nbsp".$td[9]."</td>";
  109.                     }else{
  110.                         $td[8] = str_replace("'", '', $td[8]);
  111.                         echo "<td>".$td[7]." - ".$td[8]."</td>";
  112.                     }
  113.                 }
  114.             }
  115.         }else{
  116.             if($x == 16) {
  117.                 $tb[$x] = str_replace("'", '', $tb[$x]);
  118.                 echo "<td colspan='4'>".$tb[$x]."</td>";
  119.             }
  120.         }
  121.     }
  122.    
  123.    
  124.     echo "</tr>";
  125.     $c = $c+1;
  126. }
  127.  
  128. echo $c;
  129.  
  130. //echo $zawartosc;
  131.  
  132. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement