Great extension! I made some changes to the menu, so after users go backward in steps, they can also go forward again using the menu. I made the following changes:
insert after line 66: public $forwardOnly = false;
/**
* @property boolean If true, the user will be able to go forward to any step
* that was already completed, plus the next incomplete one.
*/
public $forwardActive = true;
And replace the whole function generateMenuItems() starting on line 349 with:
private function generateMenuItems() {
$previous = true;
$items = array();
$url = array($this->owner->id.'/'.$this->getOwner()->getAction()->getId());
$expectedIndex = $this->_steps->indexOf($this->getExpectedStep());
// We should not have a url for later steps
// We should not have a url for earlier steps if forwards only
foreach ($this->_steps as $step) {
$item = array();
$item['label'] = $this->getStepLabel($step);
$item['active'] = $step===$this->_currentStep;
if (!$item['active'] && $previous && !empty($this->menuProperties['previousItemCssClass']))
$item['itemOptions'] = array('class'=>$this->menuProperties['previousItemCssClass']);
if (($previous && !$this->forwardOnly) || ($step===$this->_currentStep)) {
$item['url'] = $url + array($this->queryParam=>$step);
if ((!$this->forwardActive && $step===$this->_currentStep) OR
($this->forwardActive && $this->_steps->indexOf($step)===$expectedIndex+1))
$previous = false;
}
$items[] = $item;
}
if (!empty($this->menuLastItem))
$items[] = array(
'label'=>$this->menuLastItem,
'active'=>false
);
$this->_menu->items = $items;
}
profile table is related from user table by user_id
my question is how can i get user id to be populated on my profile user_id when the wizard is Finished below is my codeā¦
i only have error on my user_id
public function wizardFinished($event) {
if ($event->step===true){
//save data to database
Yii::log(json_encode($event->data),'error');
$user = new User();
$profile = new Profile();
$user->username = $event->data['user']['username'];
$user->password = $event->data['user']['password'];
$user->email = $event->data['user']['email'];
[b]$profile->user_id = $event->data['profile']['user_id'];[/b] //how can i get the id from user table
$profile->lname = $event->data['profile']['lname'];
$profile->fname = $event->data['profile']['fname'];
if($user->save() && $profile->save()){
$this->render('completed', compact('event'));
}
}
else
$this->render('finished', compact('event'));
$event->sender->reset();
Yii::app()->end();
}
Sorry to bump up this threadā¦ Iāve been googling for days but unable to find a working sample for Yii2. Anyone kind enough to lend a hand please? My final goal is to integrate this with Dynamic Form Widget.
Demo and documentation links are down. Can anyone upload the pdf document, if you have a copy? I thought to use its yii2 port, but couldnāt find the documentation on how to use it.