public static function &getNotices($id, $limit = 50, $timestamp = FALSE)
{
$dbo =& Pommo::$_dbo;
$limit = intval($limit);
if ($limit == 0) {
$limit = false;
}
if (!$timestamp) {
$query = "\n SELECT notice FROM " . $dbo->table['mailing_notices'] . "\n WHERE mailing_id = %i ORDER BY touched DESC, id DESC [LIMIT %I]";
$query = $dbo->prepare($query, array($id, $limit));
return $dbo->getAll($query, 'assoc', 'notice');
}
$o = array();
$query = "\n SELECT touched,notice FROM " . $dbo->table['mailing_notices'] . "\n WHERE mailing_id = %i ORDER BY touched DESC, id DESC [LIMIT %I]";
$query = $dbo->prepare($query, array($id, $limit));
while ($row = $dbo->getRows($query)) {
if (!isset($o[$row['touched']])) {
$o[$row['touched']] = array();
}
array_push($o[$row['touched']], $row['notice']);
}
return $o;
}