HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/apklausos/application/extensions/yiiwheels/widgets/grid/operations/WhOperation.php
<?php
/**
 *
 * WhOperation class
 *
 * Abstract class where all types of column operations extend from
 *
 * @author Antonio Ramirez <amigo.cobos@gmail.com>
 * @copyright Copyright &copy; 2amigos.us 2013-
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @package YiiWheels.widgets.grid.operations
 */
abstract class WhOperation extends CWidget
{
	/**
	 * @var string $template the template to display label and value of the operation at the summary
	 */
	public $template = '{label}: {value}';

	/**
	 * @var int $value the resulted value of operation
	 */
	public $value = 0;

	/**
	 * @var string $label the label of the calculated value
	 */
	public $label;

	/**
	 * @var WhDataColumn $column
	 */
	public $column;

	/**
	 * Widget initialization
	 * @throws CException
	 */
	public function init()
	{
		if (null == $this->column) {
			throw new CException(Yii::t(
				'zii',
				'"{attribute}" attribute must be defined',
				array('{attribute}' => 'column')
			));
		}

		$this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
	}

	/**
	 * Widget's run method
	 */
	public function run()
	{
		$this->displaySummary();
	}

	/**
	 * Process the row data value
	 * @param $value
	 * @return mixed
	 */
	abstract public function processValue($value);

	/**
	 * Displays the resulting summary
	 * @return mixed
	 */
	abstract public function displaySummary();

}