/** * @param float $percent 0 <= percent <= 100. * @param string $type * @param string $content */ public function __construct($percent, $type = self::TYPE_DEFAULT, $content = null) { if ($percent > 100) { $percent = 100; } if ($percent < 0) { $percent = 0; } $this->addClass('progress'); if (empty($content)) { $content = new GenericTag('span'); $content->addClass('sr-only'); $content->setContent($percent . '%'); } $this->content = new GenericTag('div'); $this->content->addClass('progress-bar'); if (!in_array($type, $this->types)) { $type = self::TYPE_DEFAULT; } if ($type !== self::TYPE_DEFAULT) { $this->content->addClass('progress-bar-' . $type); } $this->content->setAttribute('role', 'progress'); $this->content->setAttribute('aria-valuenow', $percent); $this->content->setAttribute('aria-valuemin', 0); $this->content->setAttribute('aria-valuemax', 100); $this->content->setAttribute('style', 'width="' . $percent . '%"'); parent::__construct('div', $content); }
/** * @param string $id * @param string $title * @param string $content Tab content or url. * @param bool $isAjax * @param bool $withCache */ public function __construct($id, $title = null, $content = null, $isAjax = false, $withCache = false) { $this->setAttribute('id', $id); $this->addClass('tab-pane'); $this->addClass('fade'); $this->setTitle($title); $this->setAjax($isAjax, $withCache); $this->loadingText = self::$defaultAjaxTabLoadingText; parent::__construct('div', $content); }
/** * @param string $content */ public function __construct($content) { $this->addClass('well'); parent::__construct('div', $content); }
/** * @param string $content * @param string $type Const Label::TYPE_. */ public function __construct($content, $type = self::TYPE_DEFAULT) { $this->addClass('label'); $this->changeType($type); parent::__construct('span', $content); }
/** * @param string $content */ public function __construct($content = null) { $this->addClass('badge'); parent::__construct('span', $content); }