Stackoverflow の誰かが Wizard Behavior 拡張機能の経験があることを願っています: http://www.yiiframework.com/extension/wizard-behavior/
問題は、最初のページ (ユーザー) で [送信] をクリックすると、請求ページに移動し、会社のページをスキップすることです...ヘルプ?
情報を収集するには、ユーザー、会社、請求ページの 3 つのステップがあります。これが私のコントローラのビヘイビア関数です:
public function behaviors() {
return array(
'wizard'=>array(
'class'=>'ext.WizardBehavior.WizardBehavior',
'steps'=>array(
'user','company','billing'
)
)
)
}
これは私のプロセスステップ関数です:
public function wizardProcessStep($event) {
$name = '_wizard'.ucfirst($event->step);
if (method_exists($this, $name)) {
call_user_func(array($this,$name), $event);
} else {
throw new CException(Yii::t('yii','{class} does not have a method named "{name}"', array('{class}'=>get_class($this), '{name}'=>$name)));
}
}
例として私の会社のステップを次に示します。
protected function _wizardCompany($event) {
echo 'called company';
exit();
$company=new Company;
if(isset($_POST['Company'])) {
$company->attributes=$_POST['Company'];
if($company->validate()) {
$event->sender->save($company->attributes);
$event->handled = true;
}
}
$this->render('new_company',array(
'company'=>$company,
'event'=>$event,
));
}