HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbDetailView.php
Go to the documentation of this file.
1 <?php
11 Yii::import('zii.widgets.CDetailView');
12 
18 class TbDetailView extends CDetailView
19 {
20  // Table types.
21  const TYPE_STRIPED = 'striped';
22  const TYPE_BORDERED = 'bordered';
23  const TYPE_CONDENSED = 'condensed';
24 
29  public $type = array(self::TYPE_STRIPED, self::TYPE_CONDENSED);
30 
35  public $cssFile = false;
36 
42  public function init()
43  {
44  parent::init();
45 
46  $classes = array('table');
47 
48  if (isset($this->type)) {
49  if (is_string($this->type)) {
50  $this->type = explode(' ', $this->type);
51  }
52 
53  $validTypes = array(self::TYPE_STRIPED, self::TYPE_BORDERED, self::TYPE_CONDENSED);
54 
55  if (!empty($this->type)) {
56  foreach ($this->type as $type) {
57  if (in_array($type, $validTypes)) {
58  $classes[] = 'table-' . $type;
59  }
60  }
61  }
62  }
63 
64  if (!empty($classes)) {
65  $classes = implode(' ', $classes);
66  if (isset($this->htmlOptions['class'])) {
67  $this->htmlOptions['class'] .= ' ' . $classes;
68  } else {
69  $this->htmlOptions['class'] = $classes;
70  }
71  }
72  }
73 }