Add methods to retrieve incident status history and available statuses
This commit is contained in:
@@ -13,6 +13,7 @@ class StatusBoard_Incident extends StatusBoard_DatabaseObject {
|
|||||||
protected $_db_actual_end_time;
|
protected $_db_actual_end_time;
|
||||||
|
|
||||||
protected $current_status = null;
|
protected $current_status = null;
|
||||||
|
protected $statuses = null;
|
||||||
|
|
||||||
public static function open_for_site(StatusBoard_Site $site) {
|
public static function open_for_site(StatusBoard_Site $site) {
|
||||||
return static::all_for('site', $site->id, 'incident_open');
|
return static::all_for('site', $site->id, 'incident_open');
|
||||||
@@ -54,6 +55,14 @@ class StatusBoard_Incident extends StatusBoard_DatabaseObject {
|
|||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function statusChanges($ignore_cache = false) {
|
||||||
|
if ($this->statuses === null || $ignore_cache) {
|
||||||
|
$this->statuses = StatusBoard_IncidentStatus::all_for('incident', $this->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->statuses;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -9,6 +9,9 @@ class StatusBoard_IncidentStatus extends StatusBoard_DatabaseObject {
|
|||||||
protected $_db_status;
|
protected $_db_status;
|
||||||
protected $_db_ctime;
|
protected $_db_ctime;
|
||||||
|
|
||||||
|
protected function all_for_incident(StatusBoard_Incident $incident) {
|
||||||
|
return static::all_for('incident', $incident->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -24,6 +24,16 @@ class StatusBoard_Status {
|
|||||||
self::STATUS_Major => 'The service is exeriencing a major outage affecting all customers.',
|
self::STATUS_Major => 'The service is exeriencing a major outage affecting all customers.',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public function available() {
|
||||||
|
return array(
|
||||||
|
self::STATUS_Resolved,
|
||||||
|
self::STATUS_Maintenance,
|
||||||
|
self::STATUS_Minor,
|
||||||
|
self::STATUS_Significant,
|
||||||
|
self::STATUS_Major,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static function name($status) {
|
public static function name($status) {
|
||||||
if ( ! StatusBoard_Main::isClassConstantValue(get_called_class(), 'STATUS_', $status)) {
|
if ( ! StatusBoard_Main::isClassConstantValue(get_called_class(), 'STATUS_', $status)) {
|
||||||
throw new StatusBoard_Exception_InvalidParameters($status);
|
throw new StatusBoard_Exception_InvalidParameters($status);
|
||||||
|
|||||||
Reference in New Issue
Block a user