Permalink
Browse files

* CButtonColumnEx: removed templateExpression property. Now template …

…property can be php expression

* CButtonColumnEx: added readme.md and readme_ru.md
* CImageHandler: added readme.md and readme_ru.md
* Common: corrected copyright
* Common: added empty readme
  • Loading branch information...
1 parent 59c0f0e commit 3821436e0e9625c5b162c7bda9805176f20841a0 @tokolist committed Aug 12, 2012
@@ -1,7 +1,7 @@
<?php
/**
* Behaviour for converting date formats between the DB and model
- * @author Pelesh Yaroslav aka Tokolist http://tokolist.com
+ * @author Yaroslav Pelesh aka Tokolist http://tokolist.com
* @link https://github.com/tokolist/yii-components
* @version 1.0
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
@@ -1,7 +1,7 @@
<?php
/**
* Controller behaviour for tree comments functionality
- * @author Pelesh Yaroslav aka Tokolist http://tokolist.com
+ * @author Yaroslav Pelesh aka Tokolist http://tokolist.com
* @link https://github.com/tokolist/yii-components
* @version 1.0
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
@@ -1,7 +1,7 @@
<?php
/**
* Active Record behaviour for tree comments functionality
- * @author Pelesh Yaroslav aka Tokolist http://tokolist.com
+ * @author Yaroslav Pelesh aka Tokolist http://tokolist.com
* @link https://github.com/tokolist/yii-components
* @version 1.0
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
@@ -1,24 +1,20 @@
<?php
/**
- * Extended CButtonColumn, that can be used with dynamic templates
- * @author Pelesh Yaroslav aka Tokolist http://tokolist.com
+ * Extended CButtonColumn, in which template and button options can be php expressions.
+ * @author Yaroslav Pelesh aka Tokolist http://tokolist.com
* @link https://github.com/tokolist/yii-components
- * @version 1.0
+ * @version 1.2
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
class CButtonColumnEx extends CButtonColumn
{
- public $templateExpression;
-
protected function renderDataCellContent($row,$data)
{
$tmpTemplate = $this->template;
$tmpButtons = $this->buttons;
- if($this->templateExpression !== null) {
- $this->template = $this->evaluateExpression($this->templateExpression,array('data'=>$data,'row'=>$row));
- }
+ $this->template = $this->evaluateExpression($this->template,array('data'=>$data,'row'=>$row));
foreach($this->buttons as $buttonIndex => $button)
{
@@ -0,0 +1,54 @@
+CButtonColumnEx
+===============
+
+CButtonColumnEx - extended CButtonColumn, in which template and button options
+can be php expressions.
+
+Installation
+------------
+
+1. Copy ButtonColumnEx directory to Yii `components` directory
+
+2. Add import path
+
+~~~php
+'import'=>array(
+
+ ...
+
+ 'application.components.ButtonColumnEx.CButtonColumnEx',
+
+ ...
+
+)
+~~~
+
+3. Use component in CGridView columns configuration
+
+~~~php
+'columns'=>array(
+
+ ...
+
+ array(
+ 'class' => 'CButtonColumnEx',
+ 'template' => '"{view}" . ($data->isCancelable() ? " / {cancel}" : "")',
+ 'buttons' => array(
+ 'cancel' => array(
+
+ ...
+
+ 'options' => array(
+ 'data-title'=>'$data->title',
+ ),
+
+ ...
+
+ ),
+ ),
+ ),
+
+ ...
+
+),
+~~~
@@ -0,0 +1,54 @@
+CButtonColumnEx
+===============
+
+CButtonColumnEx - потомок CButtonColumn, в котором свойство template и свойства options
+кнопок могут быть php-выражениями.
+
+Installation
+------------
+
+1. Скопируйте папку ButtonColumnEx в паку `components`
+
+2. Добавте путь в импорт
+
+~~~php
+'import'=>array(
+
+ ...
+
+ 'application.components.ButtonColumnEx.CButtonColumnEx',
+
+ ...
+
+)
+~~~
+
+3. Используйте компонент в конфигурации CGridView
+
+~~~php
+'columns'=>array(
+
+ ...
+
+ array(
+ 'class' => 'CButtonColumnEx',
+ 'template' => '"{view}" . ($data->isCancelable() ? " / {cancel}" : "")',
+ 'buttons' => array(
+ 'cancel' => array(
+
+ ...
+
+ 'options' => array(
+ 'data-title'=>'$data->title',
+ ),
+
+ ...
+
+ ),
+ ),
+ ),
+
+ ...
+
+),
+~~~
@@ -1,9 +1,9 @@
<?php
/**
* Image handler
- * @author Pelesh Yaroslav aka Tokolist http://tokolist.com
+ * @author Yaroslav Pelesh aka Tokolist http://tokolist.com
* @link https://github.com/tokolist/yii-components
- * @version 1.0
+ * @version 1.1
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
Oops, something went wrong.

0 comments on commit 3821436

Please sign in to comment.