Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIInfoView.php
| <?php | <?php | ||||
| final class PHUIInfoView extends AphrontTagView { | final class PHUIInfoView extends AphrontTagView { | ||||
| const SEVERITY_ERROR = 'error'; | const SEVERITY_ERROR = 'error'; | ||||
| const SEVERITY_WARNING = 'warning'; | const SEVERITY_WARNING = 'warning'; | ||||
| const SEVERITY_NOTICE = 'notice'; | const SEVERITY_NOTICE = 'notice'; | ||||
| const SEVERITY_NODATA = 'nodata'; | const SEVERITY_NODATA = 'nodata'; | ||||
| const SEVERITY_SUCCESS = 'success'; | const SEVERITY_SUCCESS = 'success'; | ||||
| const SEVERITY_PLAIN = 'plain'; | const SEVERITY_PLAIN = 'plain'; | ||||
| const SEVERITY_MFA = 'mfa'; | |||||
| private $title; | private $title; | ||||
| private $errors = array(); | private $errors = array(); | ||||
| private $severity = null; | private $severity = null; | ||||
| private $id; | private $id; | ||||
| private $buttons = array(); | private $buttons = array(); | ||||
| private $isHidden; | private $isHidden; | ||||
| private $flush; | private $flush; | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | final class PHUIInfoView extends AphrontTagView { | ||||
| private function getIcon() { | private function getIcon() { | ||||
| if ($this->icon) { | if ($this->icon) { | ||||
| return $this->icon; | return $this->icon; | ||||
| } | } | ||||
| switch ($this->getSeverity()) { | switch ($this->getSeverity()) { | ||||
| case self::SEVERITY_ERROR: | case self::SEVERITY_ERROR: | ||||
| $icon = 'fa-exclamation-circle'; | $icon = 'fa-exclamation-circle'; | ||||
| break; | break; | ||||
| case self::SEVERITY_WARNING: | case self::SEVERITY_WARNING: | ||||
| $icon = 'fa-exclamation-triangle'; | $icon = 'fa-exclamation-triangle'; | ||||
| break; | break; | ||||
| case self::SEVERITY_NOTICE: | case self::SEVERITY_NOTICE: | ||||
| $icon = 'fa-info-circle'; | $icon = 'fa-info-circle'; | ||||
| break; | break; | ||||
| case self::SEVERITY_PLAIN: | case self::SEVERITY_PLAIN: | ||||
| case self::SEVERITY_NODATA: | case self::SEVERITY_NODATA: | ||||
| return null; | return null; | ||||
| break; | |||||
| case self::SEVERITY_SUCCESS: | case self::SEVERITY_SUCCESS: | ||||
| $icon = 'fa-check-circle'; | $icon = 'fa-check-circle'; | ||||
| break; | break; | ||||
| case self::SEVERITY_MFA: | |||||
| $icon = 'fa-lock'; | |||||
| break; | |||||
| } | } | ||||
| $icon = id(new PHUIIconView()) | $icon = id(new PHUIIconView()) | ||||
| ->setIcon($icon) | ->setIcon($icon) | ||||
| ->addClass('phui-info-icon'); | ->addClass('phui-info-icon'); | ||||
| return $icon; | return $icon; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines | |||||