/** * Get the client's area alert level. * * @return Dodona\Alert */ public function areaStatus($check_category_id) { $result = Alert::find(Alert::BLUE); $services = $this->enabledServices(); foreach ($services as $service) { $status = $this->_pickStatusArea($service, $check_category_id); if ($status->id === Alert::RED) { $result = Alert::find(Alert::RED); break; } if ($status->id === Alert::AMBER) { $result = Alert::find(Alert::AMBER); } if ($status->id === Alert::GREEN && $result->id === Alert::BLUE) { $result = Alert::find(Alert::GREEN); } } return $result; }
/** * Run the alerts table seeds. * * @return void */ public function run() { Alert::truncate(); Alert::create(['id' => 'R', 'name' => 'Red', 'css' => 'danger', 'css_i' => 'danger']); Alert::create(['id' => 'A', 'name' => 'Amber', 'css' => 'warning', 'css_i' => 'warning']); Alert::create(['id' => 'G', 'name' => 'Green', 'css' => 'success', 'css_i' => 'default']); Alert::create(['id' => 'B', 'name' => 'Blue', 'css' => 'info', 'css_i' => 'info']); }
/** * Initialise the result for the areaStatus. * * @param integer $count * @return Dodona\Alert */ private function _initializeAreaResult($count) { if ($count > 0) { $result = Alert::find(Alert::GREEN); } else { $result = Alert::find(Alert::BLUE); } return $result; }