Created
December 19, 2012 06:43
-
-
Save konnoyosuke/4334879 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UsersController extends AppController { | |
public $components = array('Search.Prg'); | |
public $presetVars = array( | |
array('model' => 'User', 'field' => 'name', 'type' => 'value'), | |
array('model' => 'User', 'field' => 'state', 'type' => 'value'), | |
array('model' => 'User', 'field' => 'tel', 'type' => 'value'), | |
); | |
function index() { | |
$this->Prg->commonProcess(); | |
$this->paginate = Set::Merge($this->User->options(), | |
array('conditions' => array($this->User->parseCriteria($this->passedArgs)))); | |
$this->set('users', $this->paginate()); | |
//Chosenヘルパーのオプション値を取得 | |
//ここでは県名を取得してリスト化しています。 | |
//サンプルのためにフィールドがstate,stateになっていますが、実際はid, stateとかになるかと思います。 | |
$states = Classregistry::init('State')->find('list', array('fields' => array('state', 'state'))); | |
$this->set(compact('states')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment