TableName=$TableName; $this->Where=$Where; $this->OrderBy=$OrderBy; $this->Limit=$Limit; $this->conn=$conn; $this->Border=0; $this->cellpadding=2; $this->cellspacing=1; $this->width=750; $this->ColNum=18; $this->DataForm="array"; $this->Find=$Find; $this->FindField=$FindField;$this->FindString=$FindString; $this->Paged=$Paged;$this->RowsOnPage=(int)$RowsOnPage;$this->Odkud=(int)$Odkud; $this->FontFace="Arial CE"; $this->http_query=$http_query; if ($Fields=="")$Fields="*"; $this->Fields=$Fields; if ($SpoctiOdkud!="") $this->SpoctiOdkud(); global $akce; $this->akce=$akce; $this->AccessNumber=$AccessNumber; $this->CurrentUser = GetCurrentUser ($conn,$AccessNumber); $this->FindFields = $FindFields; prepareMouseGIF ("new","graphics",23,22); prepareMouseGIF ("save","graphics",23,22); prepareMouseGIF ("cut","graphics",23,22); prepareMouseGIF ("edit","graphics",23,22); } function SpoctiOdkud() { { $sql = "SELECT count($this->Fields) FROM $this->TableName"; if ($this->Where!="") $sql.=" where $this->Where and"; else $sql.=" where"; $sql.=" $this->FindField<'$this->FindString'"; if ($this->OrderBy!="") $sql.=" order by $this->OrderBy,$this->FindField"; else $sql.=" order by $this->FindField"; //print$sql."
"; $this->Odkud=db_query_scalar($this->conn,$sql); } } function GetRowsNumber() { $sql = "SELECT count($this->Fields) FROM $this->TableName"; if ($this->Where!="") $sql.=" where $this->Where"; return db_query_scalar($this->conn,$sql); } // ---- table ---- function printTableTop ($properties) { global $table_head_bgcolor; print "cellpadding\" cellspacing=\"$this->cellspacing\" width=\"$this->width\" $properties>\n"; $this->printTableFindPages("top"); $this->printTableHeader (); } function printTableHeader () { global $table_head_bgcolor; print "\n"; $res = db_query($this->conn,"SELECT $this->Fields FROM $this->TableName limit 0,1"); $num_fields=mysql_num_fields($res); for ($i=0;$i<$num_fields;$i++) print "\n"; print ""; } function printTableFindPages($topbottom) { $kolik_celkem=$this->GetRowsNumber(); global $table_head_bgcolor; if ($this->Paged ||$this->Find) { print ""; } } function printTableBottom () { $this->printTableFindPages("bottom");print "
".mysql_field_name($res, $i)."
ColNum>
\n"; if ($this->Find) printFormEdit ("FindString",$this->FindString,20); if ($this->FindFields) print " podle: ".makeSelectArray ("FindField",$this->FindFields,$this->FindField); if ($this->Find) print makeFormEdit ("RowsOnPage",$this->RowsOnPage,2)." "; print ""; if ($this->Paged) { if ($topbottom=="top")print "$this->Odkud/$kolik_celkem "; $qs=$this->http_query;//getenv("QUERY_STRING"); if ($qs!="")$qs.="&"; $odkud_priste=max(0,$this->Odkud-3*$this->RowsOnPage); print "RowsOnPage\"><<< "; $kolik_priste=$this->RowsOnPage;$odkud_priste=max(0,$this->Odkud-$this->RowsOnPage); print "RowsOnPage\">< "; $odkud_priste=max(0,min($this->Odkud+$this->RowsOnPage,$kolik_celkem-$this->RowsOnPage)); print "RowsOnPage\">> "; $odkud_priste=max(0,min($this->Odkud+3*$this->RowsOnPage,$kolik_celkem-$this->RowsOnPage)); print "RowsOnPage\">>>>"; } print "
";} function printTable ($TableProperties="",$RowProperties="") { global $table_bgcolor; $sql = "SELECT $this->Fields FROM $this->TableName"; if ($this->Where!="") $sql.=" where $this->Where"; if ($this->Find && $this->FindString!="" && !$this->Paged) { if ($this->Where!="") $sql.=" and";else $sql.=" where"; $sql.=" $this->FindField>='$this->FindString'"; } if ($this->OrderBy!="") $sql.=" order by $this->OrderBy"; if ($this->Limit!="") $sql.=" limit $this->Limit"; else if ($this->Paged) $sql.=" limit $this->Odkud,$this->RowsOnPage"; //print$sql; $res = db_query($this->conn,$sql); $this->printTableTop ($TableProperties); if ($res) if (!db_num_rows($res)) print "ColNum\" bgcolor=\"$table_bgcolor\" align=center>Nebyly nalezeny žádné záznamy"; else switch ($this->DataForm) { case "array": while ($row = db_fetch_array($res)) $this->printRow ($RowProperties,$row); break; case "object": while ($row = db_fetch_object($res)) $this->printRow ($RowProperties,$row); break; } $this->printTableBottom (); } // ---- table row ---- function printRowTop ($properties) { global $table_bgcolor;global $table_bgcolor2; if (floor($this->ActualRowIndex/2)==$this->ActualRowIndex/2) $bgcolor=$table_bgcolor;else $bgcolor=$table_bgcolor2; print "";$this->ActualRowIndex++; } function printRowBottom () { print "\n";} function printRowData ($row) { switch ($this->DataForm) { case "array": for ($field_i=0;$field_i".$row[$field_i]."\n"; break; case "object": while (list($key,$val) = each ($row)) { if(($id++)%2==0)continue;print "".$val."";} break; } } function printRow ($properties,$row) { $this->printRowTop ($properties); $this->printRowData ($row); $this->printRowBottom (); } } ?>