
<?php

require_once("ajax_preload.php");

if ($httpreferer){
  if ($ajax_db->getErrorCode()==1){
    die;
  }else{                

  $group=$_REQUEST["group"];
  $from=$_REQUEST["from"];
  
  if ($from=='') {    
    if ($group!=''){
      $sql="SELECT id_pg_dolgozok,nev
  	      FROM pg_dolgozok
  	      WHERE id_pg_dolgozoktipus='".$group."'";
  
    	$query=$ajax_db->getAll($sql);
    	$dolgarray=array();
      foreach ($query as &$value) {
        $one = array($value["id_pg_dolgozok"], $value["nev"]);
        array_push($dolgarray, $one);
      }   
    }
  }else{
    $sql="SELECT id_pg_dolgozok,nev
  	      FROM pg_dolgozok
  	      WHERE id_pg_dolgozok='".$from."'";
  
    $query=$ajax_db->getAll($sql);   
    $dolgarray=array($query[0], $query[1]);
    unset($dolgarray[1]);  
  }
  
	$oszlopoksz=4;
	$ov = 0;		
	$content='<table align="left" class="function_table" >
			    <tr>
			      <td valign="top" align="left" class="td_big_title">
			      '.$config->getValue("get_forgalmiban","title").'
			      </td>
			      <td>
			      </td>
			      <td class="td_medium" align="right" valign="top" >
				    '.date("Y-m-d H:i:s").'
			      </td>
			    </tr>';
	foreach ($dolgarray as &$value) {
	      if ($ov==$oszlopoksz){
		      $content.="<tr>";
	      }
	      $geplista=getGepszamTmpl($ajax_db,"WHERE id_pg_dolgozok=".$value[0]);
	      $content.='<td valign="top" align="center" style="width: 230px; ">	      

			    <table align="left" class="content_table" style="width: 220px; ">
			    <tr>
			      <td valign="top" align="left" class="td_title">
			      '.iconv_iso88592_utf8($value[1]).'
			      </td>
			    </tr>
			    <tr>
			      <td valign="top" align="left">
			      '.$geplista.'
			      </td>
			    </tr>
			    </table>

			</td>';
	      $ov++;
	      if ($ov==$oszlopoksz){
		      $content.='</tr>
				<tr>
				<td style="height: 20px; ">
				</td>
				</tr>  
				<tr>';
		      $ov=0;
	      }
      }
      $content.="</table>";
      
    $ajax_page->AppendTag("content", $content);
    $ajax_page->out();
    			    
  }
  }

?>
