Merge branch 'master' into loading-information-from-different-steps

This commit is contained in:
Peter Thaleikis 2016-01-06 12:47:02 +13:00
commit e5f2b55b8b
3 changed files with 21 additions and 7 deletions

View File

@ -1,6 +1,10 @@
# MultiForm Module
[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-multiform.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-multiform)
[![Build Status](https://api.travis-ci.org/silverstripe/silverstripe-multiform.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-multiform)
[![Latest Stable Version](https://poser.pugx.org/silverstripe/multiform/version.svg)](https://github.com/silverstripe/silverstripe-multiform/releases)
[![Latest Unstable Version](https://poser.pugx.org/silverstripe/multiform/v/unstable.svg)](https://packagist.org/packages/silverstripe/multiform)
[![Total Downloads](https://poser.pugx.org/silverstripe/multiform/downloads.svg)](https://packagist.org/packages/silverstripe/multiform)
[![License](https://poser.pugx.org/silverstripe/multiform/license.svg)](https://github.com/silverstripe/silverstripe-multiform/blob/master/license.md)
## Introduction

View File

@ -54,6 +54,7 @@ abstract class MultiForm extends Form {
* @var string
*/
private static $get_var = 'MultiFormSessionID';
/**
* These fields are ignored when saving the raw form data into session.
* This ensures only field data is saved, and nothing else that's useless
@ -205,9 +206,15 @@ abstract class MultiForm extends Form {
// Determine whether we use the current step, or create one if it doesn't exist
$currentStep = null;
if(isset($_GET['StepID'])) {
$stepID = (int)$_GET['StepID'];
$currentStep = DataObject::get_one('MultiFormStep', "\"SessionID\" = {$this->session->ID} AND \"ID\" = {$stepID}");
$StepID = $this->controller->request->getVar('StepID');
if(isset($StepID)) {
$currentStep = DataObject::get_one(
'MultiFormStep',
array(
'SessionID' => $this->session->ID,
'ID' => $StepID
)
);
} elseif($this->session->CurrentStepID) {
$currentStep = $this->session->CurrentStep();
}
@ -594,12 +601,15 @@ abstract class MultiForm extends Form {
$firstStep = DataObject::get_one(static::$start_step, "\"SessionID\" = {$this->session->ID}");
$firstStep->LinkingMode = ($firstStep->ID == $this->getCurrentStep()->ID) ? 'current' : 'link';
$firstStep->addExtraClass('completed');
$firstStep->setForm($this);
$stepsFound->push($firstStep);
// mark the further steps as non-completed if the first step is the current
if ($firstStep->ID == $this->getCurrentStep()->ID) $this->currentStepHasBeenFound = true;
if ($firstStep->ID == $this->getCurrentStep()->ID) {
$this->currentStepHasBeenFound = true;
} else {
$firstStep->addExtraClass('completed');
}
$this->getAllStepsRecursive($firstStep, $stepsFound);

View File

@ -1,4 +1,4 @@
Copyright (c) 2015, SilverStripe Limited
Copyright (c) 2016, SilverStripe Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: