<?PHP
/* Class extender for presell ostatnie files
 *
 */
 
/* jak na razie ostatnie jest dziwnym plikiem
    - posiada dwa rodzaje rekordów i pierwsze
      pole w rekordzie określa rodzaj
      a od rodzaju zależy długość rekordu
      i rozkład pól
       - bardzo, bardzo nieefektywne
 */
//define('PDB_OFFSET_OSTATNIE_TYP',0);
//define('PDB_SIZE_OSTATNIE_TYP',4);

define('PDB_OFFSET_OSTATNIE_NAG_TYP_DOK',0);
define('PDB_SIZE_OSTATNIE_NAG_TYP_DOK',8);

define('PDB_OFFSET_OSTATNIE_NAG_NUMER',8);
define('PDB_SIZE_OSTATNIE_NAG_NUMER',44);

define('PDB_OFFSET_OSTATNIE_NAG_ID_KL',52);
define('PDB_SIZE_OSTATNIE_NAG_ID_KL',32);

define('PDB_OFFSET_OSTATNIE_NAG_DATA_WYST',84);
define('PDB_SIZE_OSTATNIE_NAG_DATA_WYST',28);

define('PDB_OFFSET_OSTATNIE_NAG_POZ_UID',112);
define('PDB_SIZE_OSTATNIE_NAG_POZ_UID',8);

define('PDB_OFFSET_OSTATNIE_NAG_IL_POZY',120);
define('PDB_SIZE_OSTATNIE_NAG_IL_POZY',2);

define('PDB_OFFSET_OSTATNIE_ID_TOW',0);
define('PDB_SIZE_OSTATNIE_ID_TOW',32);

define('PDB_OFFSET_OSTATNIE_ILOSC',32);
define('PDB_SIZE_OSTATNIE_ILOSC',8);

define('PDB_OFFSET_OSTATNIE_CENA',40);
define('PDB_SIZE_OSTATNIE_CENA',8);



class presellOstNag extends PalmDB {
   // Constructor -- initialize the default values
   function presellOstatnie () {
      PalmDB::PalmDB('DATA', 'zaba', 'ostnag');
   }

   // Overrides the GetRecord method.  We store data in associative arrays.
   // Just convert the data into the proper format and then return the
   // generated string.
   function GetRecord($num = false) {
      if ($num === false)
         $num = $this->CurrentRecord;
	 
      if (! isset($this->Records[$num]) /*|| ! is_array($this->Records[$num])*/)
         return PalmDB::GetRecord($num);
      
      $RecordString = '';
      
      include(sprintf("./include/ostnagl-%s",$GLOBALS["WEBSYNC_OUTPUT_MODULE"]));

      return $RecordString;
   }
}


class presellOstatnie extends PalmDB {
   // Constructor -- initialize the default values
   function presellOstatnie () {
      PalmDB::PalmDB('DATA', 'zaba', 'ostatnie');
   }

   // Overrides the GetRecord method.  We store data in associative arrays.
   // Just convert the data into the proper format and then return the
   // generated string.
   function GetRecord($num = false) {
      if ($num === false)
         $num = $this->CurrentRecord;
	 
      if (! isset($this->Records[$num]) /*|| ! is_array($this->Records[$num])*/)
         return PalmDB::GetRecord($num);
      
      $RecordString = '';
      
      include(sprintf("./include/ostatnie-%s",$GLOBALS["WEBSYNC_OUTPUT_MODULE"]));

      return $RecordString;
   }
}
?>
