Wiki

Articles in category "tips"X
Displaying 11-20 of 103 result(s).

Adding a date range search for CGridView the easy way

Created 3 months ago by mikewalenTips2 comments – viewed 4,548 times – ( +7 )
After a lot of research, everything I found on adding date range searching to a CGridView advanced search form seemed to involve adding two new public variables (e.g. $date_from, $date_to), 'safe' rules for the new variables, and a rather chunky if/elseif/else check in the search() method. This probably isn't a hassle for most, but because many of the tables in my database contain two or three and sometimes four date columns (e.g. date_created, date_modified, date_deleted etc.), it meant I was having to add up to eight public variables, the corresponding safe rules, and modifying the search() criteria for each date attribute. So, I set about creating a better way and I thought I'd share my work with the community.

Adding a link to a CDataColumn

Created 3 months ago by le_topTips4 comments – viewed 3,069 times – ( +3 )
Backoffice Grid Views often list information like Posts for a blog while showing at the same time linked information like the User who wrote that post. For more efficiency, it is appropriate that the User is displayed as a link to the User detail page.

Patching PHP code (used as a library) without changing the original code!

Created 3 months ago by le_topTips0 comments – viewed 1,872 times – ( +3 )
The article Fixing extensions without modifying their code reminded me of another patching technique that I used. My conviction and a hard look on the web had led me to an article Redefine PHP class methods or class giving me a head start to do what I wanted: patching third party code without touching the original to allow easy upgrades.
tags: patch, patching

Fixing extensions without modifying their code

Created 3 months ago by schmunkTips3 comments – viewed 2,467 times – ( +5 )
If you're working a lot with extensions you often stumble upon problems, when you want to include them into your custom web application, like hardcoded or absolute path aliases or classes extended from core application components, which implement addiditonal features.

PHPStorm & NetBeans autocomplete problem

Created 3 months ago by StagelineTips0 comments – viewed 3,389 times – ( +16 )
The problem: If you type Yii::app()->user<ctrl+space> code completion didn't work. This solve it.

Assigning dynamic roles to a user Using yii Rights module at the time of user creation and using some special advanced features of yii rights

Created 4 months ago by Rajith RTips0 comments – viewed 6,516 times – ( +6 )
After Installing Yii Users and Rights to Newly Created Yii app we have to assign dynamic roles to a user at the time of user creation .

Speedup unit tests by moving MySql data to memory (in Ubuntu)

Created 6 months ago by sebTips0 comments – viewed 3,019 times – ( +1 / -1 )
Speedup unit tests by moving MySql data to memory [Ubuntu]
tags: mysql, unit test

An Easy Solution for Dependent dropDownList Using AJAX

Created 6 months ago by mrsTips6 comments – viewed 16,267 times – ( +7 )
Sometimes new Yii guys face problem to manage dependent dropDownList using AJAX. I am going to discuss an easy solution about this issue.

Adding 'disabled' to CCheckBoxColumn and support for yiigridview.js

Created 7 months ago by Xgamer99Tips3 comments – viewed 4,346 times – ( +1 )
I recently had to have a checkbox column in my grid view that supported the 'disabled' attribute. This was easy enough to do by extending the CCheckBoxColumn. However, I also wanted the checkbox to be selected when clicking on the table's row (supported via CGridView's selectableRows option). I discovered I had to tweak yiigridview.js so that it would not select disabled rows when clicking on it or on the 'select all' checkbox.

Yii shorten common functions with OOP style

Created 7 months ago by pdtkameTips3 comments – viewed 3,867 times – ( +9 / -14 )
This article will show how you can use Yii common functions as shorten OOP function. These functions will help you work with Yii common functions is easier as OOP style.