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

  • WhCountOfTypeOperation
  • WhOperation
  • WhPercentOfTypeEasyPieOperation
  • WhPercentOfTypeGooglePieOperation
  • WhPercentOfTypeOperation
  • WhSumOperation
 1 <?php
 2 /**
 3  *
 4  * WhOperation class
 5  *
 6  * Abstract class where all types of column operations extend from
 7  *
 8  * @author Antonio Ramirez <amigo.cobos@gmail.com>
 9  * @copyright Copyright &copy; 2amigos.us 2013-
10  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
11  * @package YiiWheels.widgets.grid.operations
12  */
13 abstract class WhOperation extends CWidget
14 {
15     /**
16      * @var string $template the template to display label and value of the operation at the summary
17      */
18     public $template = '{label}: {value}';
19 
20     /**
21      * @var int $value the resulted value of operation
22      */
23     public $value = 0;
24 
25     /**
26      * @var string $label the label of the calculated value
27      */
28     public $label;
29 
30     /**
31      * @var WhDataColumn $column
32      */
33     public $column;
34 
35     /**
36      * Widget initialization
37      * @throws CException
38      */
39     public function init()
40     {
41         if (null == $this->column) {
42             throw new CException(Yii::t(
43                 'zii',
44                 '"{attribute}" attribute must be defined',
45                 array('{attribute}' => 'column')
46             ));
47         }
48 
49         $this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
50     }
51 
52     /**
53      * Widget's run method
54      */
55     public function run()
56     {
57         $this->displaySummary();
58     }
59 
60     /**
61      * Process the row data value
62      * @param $value
63      * @return mixed
64      */
65     abstract public function processValue($value);
66 
67     /**
68      * Displays the resulting summary
69      * @return mixed
70      */
71     abstract public function displaySummary();
72 
73 }
YiiWheels API documentation generated by ApiGen 2.8.0