<?php
/* $Id: overview.inc.php,v 1.9 2003/11/21 16:47:51 leyeti Exp $ */

// adding file revision into global array
if(function_exists("revisionInit")) revisionInit("\$Revision: 1.9 $", __FILE__);

// =============================================================
// NEWS fuer Uebersicht holen
// =============================================================
function getnotes() {
    global $smarty, $conn, $myEnv;

    if(!query_access_module('notes'))
 	return '';

    $notes_list = '';
    $sql = "SELECT id, title, content FROM mgw_notes WHERE (ispublic=1 OR owner=".$_SESSION["MGW"]->userid.") AND lu_update>".$conn->DBTimeStamp($_SESSION["lastin"])." ORDER BY title";
    if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
    $i=0;
    while (($row = $res->FetchRow()) && $i++ < $_SESSION["MGW"]->settings["overview_notes"]){
	$notes_list[] = array("id" => $row["id"],
			    "title" => htmlspecialchars($row["title"]),
			    "content" => htmlspecialchars($row["content"]));
    }
    $smarty->assign("nl" , $notes_list);
    return $smarty->fetch("file:".ROOTPATH."/modules/notes/templates/default/".$myEnv["output"]."/notes_overview.tpl");
}
?>
