YiiWheels
  • Package
  • Class
  • Tree

Packages

  • None
  • yiiwheels
    • behaviors
    • widgets
    • widgets
      • ace
      • box
      • datepicker
      • daterangepicker
      • datetimepicker
      • detail
      • fileupload
      • fileuploader
      • gallery
      • google
      • grid
        • behaviors
        • operations
      • highcharts
      • maskInput
      • maskmoney
      • modal
      • multiselect
      • rangeslider
      • redactor
      • select2
      • sparklines
      • switch
      • timeago
      • timepicker
      • toggle
      • typeahead

Classes

  • WhDetailView
 1 <?php
 2 /**
 3  * WhDetailView widget class
 4  *
 5  * @author Antonio Ramirez <amigo.cobos@gmail.com>
 6  * @copyright Copyright &copy; 2amigos.us 2013-
 7  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 8  * @package YiiWheels.widgets.detail
 9  * @uses YiiStrap.helpers.TbHtml
10  */
11 
12 Yii::import('bootstrap.helpers.TbHtml');
13 Yii::import('zii.widgets.CDetailView');
14 
15 class WhDetailView extends CDetailView
16 {
17 
18     /**
19      * @var string|array the table type.
20      * Valid values are TbHtml::GRID_STRIPED, TbHtml::GRID_BORDERED and/or TbHtml::GRID_CONDENSED.
21      */
22     public $type = array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_CONDENSED);
23 
24     /**
25      * @var string the URL of the CSS file used by this detail view.
26      * Defaults to false, meaning that no CSS will be included.
27      */
28     public $cssFile = false;
29 
30     /**
31      * Initializes the widget.
32      */
33     public function init()
34     {
35         parent::init();
36 
37         $classes = array('table');
38 
39         if (isset($this->type) && !empty($this->type)) {
40             if (is_string($this->type)) {
41                 $this->type = explode(' ', $this->type);
42             }
43 
44             $validTypes = array(
45                 TbHtml::GRID_TYPE_BORDERED,
46                 TbHtml::GRID_TYPE_CONDENSED,
47                 TbHtml::GRID_TYPE_STRIPED,
48                 TbHtml::GRID_TYPE_HOVER
49             );
50 
51             foreach ($this->type as $type) {
52                 if (in_array($type, $validTypes)) {
53                     $classes[] = 'table-' . $type;
54                 }
55             }
56         }
57 
58         TbHtml::addCssClass(implode(' ', $classes), $this->htmlOptions);
59     }
60 }
61 
YiiWheels API documentation generated by ApiGen 2.8.0