* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry * @internal * @since 2.8.0 */ class TransitionEntry extends ActivityEntry { // Overloaded constants const BLOCK_CODE = 'ibo-transition-entry'; const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/transition-entry'; const DEFAULT_TYPE = 'transition'; const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-map-signs'; /** @var string $sOriginStateCode Code of the state before the transition */ protected $sOriginStateCode; /** @var string $sOriginStateLabel Label of the $sOriginStateCode state */ protected $sOriginStateLabel; /** @var string $sTargetStateCode Code of the state after the transition */ protected $sTargetStateCode; /** @var string $sTargetStateLabel Label of the $sTargetStateCode state */ protected $sTargetStateLabel; /** * TransitionEntry constructor. * * @param \DateTime $oDateTime * @param \User $sAuthorLogin * @param string $sObjectClass Class of the object which made the transition * @param string $sOriginStateCode * @param string $sTargetStateCode * @param string $sId * * @throws \CoreException * @throws \OQLException */ public function __construct(DateTime $oDateTime, $sAuthorLogin, $sObjectClass, $sOriginStateCode, $sTargetStateCode, $sId = null) { parent::__construct($oDateTime, $sAuthorLogin, null, $sId); $this->SetOriginalState($sObjectClass, $sOriginStateCode); $this->SetTargetState($sObjectClass, $sTargetStateCode); } /** * Set the code / label of the state before the transition * * @param string $sObjectClass Class of the object the state is from * @param string $sStateCode * * @return $this * @throws \CoreException */ public function SetOriginalState($sObjectClass, $sStateCode) { $this->sOriginStateCode = $sStateCode; $this->sOriginStateLabel = \MetaModel::GetStateLabel($sObjectClass, $sStateCode); return $this; } /** * Return the code of the state before the transition * * @return string */ public function GetOriginalStateCode() { return $this->sOriginStateCode; } /** * Return the label of the state before the transition * * @return string */ public function GetOriginalStateLabel() { return $this->sOriginStateLabel; } /** * Set the code / label of the state after the transition * * @param string $sObjectClas * @param string $sStateCode * * @return $this * @throws \CoreException */ public function SetTargetState($sObjectClas, $sStateCode) { $this->sTargetStateCode = $sStateCode; $this->sTargetStateLabel = \MetaModel::GetStateLabel($sObjectClas, $sStateCode); return $this; } /** * Return the code of the state after the transition * * @return string */ public function GetTargetStateCode() { return $this->sTargetStateCode; } /** * Return the label of the state after the transition * * @return string */ public function GetTargetStateLabel() { return $this->sTargetStateLabel; } }