<?
define('maxtitlelength', 40);

class feedback extends db_object {

var $table_name = "feedback";

    function getFeedbackList($start) {
        $res = array();
        $res["count"] = $this->find("count");
        if($res["count"] > 0) {
            $res["data"] = $this->findAll("id, addtime, email, message", null, $start, "addtime DESC");
            for($i=0; $i<count($res["data"]); $i++) {
                // format time
                $res["data"][$i]["addtime"] = date("H:i:s, F j, Y", $res["data"][$i]["addtime"]);
                // format title
                if (strlen($res["data"][$i]["message"])>maxtitlelength) {
                    $res["data"][$i]["full"] = '0';
                    $res["data"][$i]["title"] = substr($res["data"][$i]["message"], 0, maxtitlelength-3)."...";
		}
		else {
                    $res["data"][$i]["full"] = '1';
                    $res["data"][$i]["title"] = $res["data"][$i]["message"];
                }
            }
        }
        return $res;
    }

}
?>