Integration of CKEditor in Yii Framework

1. Download CKEditor extension here

2. Put it in your app/protected/extensions/

3. In your form, write this code

<?php   $this->widget(‘application.extensions.ckeditor.CKEditor’, array(                          ‘model’=>$model,                          ‘attribute’=>’filed name’,                          ‘language’=>’english’,                          ‘editorTemplate’=>’full’,               ));?>

Export Gridview Filtered Result To Excel in Yii framework

public function actionAdmin() {
                $model=new Customer('search');
                $model->unsetAttributes();  // clear any default values
                if(isset($_GET['Customer']))
                        $model->attributes=$_GET['Customer'];
                
                Yii::app()->user->setState('exportModel',$model); //this can be any other storage

                $this->render('admin',array(
                        'model'=>$model,
                ));
        }

public function actionExportToFile() {
                //echo 'test';
                header('Content-type: text/csv');
                header('Content-Disposition: attachment; filename="report-customers-' . date('YmdHi') .'.csv"');

                $model=new Customer('search');
                $model->unsetAttributes();  // clear any default values
                
                if(Yii::app()->user->getState('exportModel'))
                      $model=Yii::app()->user->getState('exportModel');

                $dataProvider = $model->search(false);
                
                // csv header
                echo    Customer::model()->getAttributeLabel("Id").",". 
                                Customer::model()->getAttributeLabel("Country_Id").",". 
                                Customer::model()->getAttributeLabel("Gender_Id").",".
                                Customer::model()->getAttributeLabel("First_Name").",".
                                Customer::model()->getAttributeLabel("Last_Name").
                                " \r\n";
                // csv data
                foreach ($dataProvider->getData() as $data) {
                        echo "$data->Id, $data->Country_Id, $data->Gender_Id, $data->First_Name, $data->Last_Name \r\n";
                }
                
                exit; 
        }

Installing PHPUnit Test on Ubuntu

Type following command on your terminal.
i) pear

ii) sudo pear channel-discover pear.phpunit.de

iii) sudo pear channel-discover components.ez.no

iv) sudo pear channel-discover pear.symfony-project.com

v) sudo pear install phpunit/PHPUnit

The above outlined the normal procedural steps necessary to get PHPUnit installed on your system.

To check your PHPUnit installation type:

vi) phpunit

If installation is successful, you will see:

PHPUnit 3.5.15 by Sebastian Bergmann.

Set up Yii-Bootstrap in Yii Framework

Download the latest release from Yii extensions by following the link below:

http://www.yiiframework.com/extension/bootstrap/

Unzip the extension under protected/extensions/bootstrap and modify your application configuration accordingly:

If you wish to use the provided Bootstrap theme copy the theme directory to your themes directory.

 

// Define a path alias for the Bootstrap extension as it's used internally.
// In this example we assume that you unzipped the extension under protected/extensions.
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

return array(
    'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
    'modules'=>array(
        'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),
        ),
    ),
    'components'=>array(
        'bootstrap'=>array(
            'class'=>'bootstrap.components.Bootstrap',
        ),
    ),
);