| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Fields;
- use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\BaseField;
- /**
- *
- * Created by PhpStorm.
- * User: Tomasz Bielecki ( tomasz.bi@thurdata.com )
- * Date: 12.11.19
- * Time: 10:49
- * Class EnabledField
- */
- class EnabledField extends BaseField
- {
- protected $id = 'enabledField';
- protected $name = 'enabledField';
- protected $title = 'field_enabled_';
- const TYPE_SUCCESS = 'success';
- const TYPE_DEFAULT = 'default';
- protected $enabled = false;
- protected $rawType = false;
- /**
- * @return bool
- */
- public function isEnabled()
- {
- return $this->enabled;
- }
- /**
- * @param bool $enabled
- */
- public function setEnabled($enabled)
- {
- $this->enabled = $enabled;
- }
- /**
- * @return string
- */
- public function getType()
- {
- if($this->getRawType())
- {
- return $this->getRawType();
- }
- if($this->isEnabled())
- {
- $type = self::TYPE_SUCCESS;
- }else{
- $type = self::TYPE_DEFAULT;
- }
- return $type;
- }
- /**
- * @return string|null
- */
- public function getTitle()
- {
- /**
- * if raw return raw
- */
- if($this->titleRaw)
- {
- return $this->titleRaw;
- }
- /**
- * return type depending on status
- */
- if($this->isEnabled())
- {
- $title = $this->title.self::TYPE_SUCCESS;
- }else{
- $title = $this->title.self::TYPE_DEFAULT;
- }
- /**
- *
- */
- return $title;
- }
- /**
- * @return bool
- */
- public function getRawType()
- {
- return $this->rawType;
- }
- /**
- * @param bool $rawType
- */
- public function setRawType($rawType)
- {
- $this->rawType = $rawType;
- }
- }
|