public function getDataCellContent($row) { /* @var $data Ipaddress */ $data = $this->grid->dataProvider->data[$row]; //build the url expression if ($data->status == Ipaddress::IP_ADDRESS_STATUS_WHITELIST) { $this->urlExpression = 'Yii::app()->createUrl("/ipaddress/block",array("ip" => $data->ip_address))'; $this->linkHtmlOptions = array_merge($this->linkHtmlOptions, array("confirm" => "Are you sure you want to block this IP address ?")); $this->label = "block ?"; } else { $this->urlExpression = 'Yii::app()->createUrl("/ipaddress/allow",array("ip" => $data->ip_address))'; $this->linkHtmlOptions = array_merge($this->linkHtmlOptions, array("confirm" => "Are you sure you want to allow this IP address ?")); $this->label = "allow ?"; } return parent::getDataCellContent($row); }
/** * Initializes the column. */ public function init() { parent::init(); if ($this->name === null) { throw new CException(Yii::t('zii', '"name" must be specified for BooleanButtonColumn.')); } if ($this->label === null) { $this->label = $this->name; } if ($this->baseScriptUrl === null) { $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.assets.booleanButtonColumn')); } if ($this->trueImageUrl === null) { $this->trueImageUrl = $this->baseScriptUrl . '/enabled.png'; } if ($this->falseImageUrl === null) { $this->falseImageUrl = $this->baseScriptUrl . '/disabled.png'; } }