function get_all_alerts($criteria = 'creation_date', $order = 'desc', $begin = 0, $number = 20) { global $Sql; $array_result = array(); $result = $Sql->query_while("SELECT id, entitled, fixing_url, current_status, creation_date, identifier, id_in_module, type, priority, description\n\t\tFROM " . DB_TABLE_EVENTS . "\n\t\tWHERE contribution_type = " . ADMINISTRATOR_ALERT_TYPE . "\n\t\tORDER BY " . $criteria . " " . strtoupper($order) . " " . $Sql->limit($begin, $number), __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $alert = new AdministratorAlert(); $alert->build($row['id'], $row['entitled'], $row['description'], $row['fixing_url'], $row['current_status'], new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['creation_date']), $row['id_in_module'], $row['identifier'], $row['type'], $row['priority']); $array_result[] = $alert; } $Sql->query_close($result); return $array_result; }
/** * @desc Lists all the alerts of the site. You can order them. You can also choose how much alerts you want. * @param string $criteria The criteria according to which you want to order. It can be id, entitled, fixing_url, * current_status, creation_date, identifier, id_in_module, type, priority, description. * @param string $order asc or desc. * @param int $begin You want all the alert from the ($begin+1)(th). * @param int $number The number of alerts you want. * @return AdministratorAlerts[] The list of the alerts. */ public static function get_all_alerts($criteria = 'creation_date', $order = 'desc', $begin = 0, $number = 20) { $array_result = array(); //On liste les alertes $result = self::$db_querier->select("SELECT id, entitled, fixing_url, current_status, creation_date, identifier, id_in_module, type, priority, description\n\t\tFROM " . DB_TABLE_EVENTS . "\n\t\tWHERE contribution_type = " . ADMINISTRATOR_ALERT_TYPE . "\n\t\tORDER BY " . $criteria . " " . strtoupper($order) . "\n\t\tLIMIT :pagination_number OFFSET :display_from", array('pagination_number' => $number, 'display_from' => $begin)); while ($row = $result->fetch()) { $alert = new AdministratorAlert(); $alert->build($row['id'], $row['entitled'], $row['description'], $row['fixing_url'], $row['current_status'], new Date($row['creation_date'], Timezone::SERVER_TIMEZONE), $row['id_in_module'], $row['identifier'], $row['type'], $row['priority']); $array_result[] = $alert; } $result->dispose(); return $array_result; }