1: <?php
2:
3: /**
4: * TbDetailView class file.
5: * @author Sam Stenvall <[email protected]>
6: * @author Christoffer Niska <[email protected]>
7: * @copyright Copyright © Sam Stenvall 2013-
8: * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
9: * @package bootstrap.widgets
10: */
11: Yii::import('zii.widgets.CDetailView');
12:
13: /**
14: * Bootstrap Zii detail widget.
15: */
16: class TbDetailView extends CDetailView
17: {
18: /**
19: * @var string|array the detail view style.
20: * Valid values are TbHtml::DETAIL_STRIPED, TbHtml::DETAIL_BORDERED, TbHtml::DETAIL_CONDENSED and/or TbHtml::DETAIL_HOVER.
21: */
22: public $type = array(TbHtml::DETAIL_TYPE_STRIPED, TbHtml::DETAIL_TYPE_CONDENSED);
23: /**
24: * @var string the URL of the CSS file used by this grid view.
25: * Defaults to false, meaning that no CSS will be included.
26: */
27: public $cssFile = false;
28:
29: /**
30: * Initializes the widget.
31: */
32: public function init()
33: {
34: parent::init();
35: $classes = array('table');
36: if (!empty($this->type)) {
37: if (is_string($this->type)) {
38: $this->type = explode(' ', $this->type);
39: }
40:
41: foreach ($this->type as $type) {
42: $classes[] = 'table-' . $type;
43: }
44: }
45: TbHtml::addCssClass($classes, $this->htmlOptions);
46: }
47: }
48: