function getDocumentDetails($id, $full = 0) { /* Daten zum Dokument zurückgeben */ return sql_getDocument($id, $full); }
function sql_getDocument($id, $full = 0) { /* Dokument mit id zurückgeben (alle "wichtigen" Felder) * Wenn full = 1, dann auch Informationen zum originalDokument * returns: Object */ global $CFG; $out = array(); $qid = db_query("\n SELECT\n TextTID as textID,\n TextOTID as otextID,\n TextTitel as title,\n DATE_FORMAT(TextDatum,'%e.%b.%Y') as date,\n PersonKennung as author,\n PersonEmail as email,\n SpracheName as language,\n TextAbstract as abstract,\n TextStatus as status,\n FiletypeType as filetyp,\n FileTypeNote as filetypenote\n \n FROM {$CFG->tbl_text}\n LEFT JOIN {$CFG->tbl_person} ON PersonPID = TextAutor\n LEFT JOIN {$CFG->tbl_sprache} ON SpracheSID = TextSID\n LEFT JOIN {$CFG->tbl_filetype} ON FiletypeFID = TextFID\n WHERE TextTID = {$id}\n "); $out = db_fetch_object($qid); if ($full and !($out->otextID == $out->textID or $out->otextID == 0)) { /* originaltext informationen holen */ $otext = sql_getDocument($out->otextID); $out->original = $otext; } return $out; }