function lastExport($default = '-')
 {
     if ($this->lastExport === null) {
         $qry = 'SELECT exportdate FROM ' . TBL_EXCEL_EXPORT . ' WHERE tbl_name="' . $this->name . '" ORDER BY id DESC';
         $this->sql->setQuery($qry);
         $result = $this->sql->get_array();
         $exportdate = $result[0]['exportdate'];
         if ($exportdate != 0) {
             $format = '<a href="%s">%s</a>';
             $lastexport = dirname($_SERVER['PHP_SELF']) . '/include/addons/excel_export/files/' . $this->name . '/' . xlsFilename($this->name, $exportdate);
             $this->lastExport = sprintf($format, $lastexport, date('d.m.Y - H:i', $exportdate));
         } else {
             $this->lastExport = $default;
         }
     }
     return $this->lastExport;
 }
function xlsLocation($table, $timestamp = null)
{
    global $REX;
    $location = dirname(__FILE__) . '/../files/' . $table . '/';
    if (!is_dir($location)) {
        mkdir($location);
    }
    return $location . xlsFilename($table, $timestamp);
}