From facf2e38335a8a92f7d94fd5a0d87b78328e565c Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Sun, 20 Apr 2008 00:28:49 +0000 Subject: [PATCH] Docs, bug fixes in code --- code/MultiFormStep.php | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/code/MultiFormStep.php b/code/MultiFormStep.php index 6591b93..ee30136 100644 --- a/code/MultiFormStep.php +++ b/code/MultiFormStep.php @@ -32,8 +32,8 @@ class MultiFormStep extends DataObject { protected static $next_steps; /** - * Each {@link MultiForm} subclass - * needs at least one step which is marked as the "final" one + * Each {@link MultiForm} subclass needs at least + * one step which is marked as the "final" one * and triggers the {@link MultiForm->finish()} * method that wraps up the whole submission. * @@ -50,9 +50,11 @@ class MultiFormStep extends DataObject { protected $title; /** - * Formfields to be rendered with this step + * Form fields to be rendered with this step. * (Form object is created in {@link MultiForm}. - * This function needs to be implemented + * + * This function needs to be implemented on your + * subclasses of MultiFormStep * * @return FieldSet */ @@ -61,6 +63,11 @@ class MultiFormStep extends DataObject { } /** + * Additional form actions to be rendered with this step. + * (Form object is created in {@link MultiForm}. + * + * Note: This is optional, and is to be implemented + * on your subclasses of MultiFormStep * * @return FieldSet */ @@ -70,15 +77,17 @@ class MultiFormStep extends DataObject { /** * Get a validator specific to this form. - * + * * @return Validator */ public function getValidator() { - return null; + return false; } /** - * Accessor method for $this->title + * Accessor method for $this->title + * + * @return string Title of this step */ public function getTitle() { return $this->title; @@ -108,8 +117,6 @@ class MultiFormStep extends DataObject { /** * Save the data for this step into session, serializing it first. - * - * @TODO write a code snippet on how to overload this method! * * @param array $data The processed data from save() on MultiForm */ @@ -153,11 +160,11 @@ class MultiFormStep extends DataObject { public function getNextStepFromDatabase() { $nextSteps = $this->stat('next_steps'); if(is_string($nextSteps)) { - $step = DataObject::get($nextSteps, "SessionID = {$this->SessionID}", 'LastEdited DESC'); - if($step) return $step->First(); + $step = DataObject::get_one($nextSteps, "SessionID = {$this->SessionID}"); + if($step) return $step; } elseif(is_array($nextSteps)) { - $step = DataObject::get($nextSteps[0], "SessionID = {$this->SessionID}", 'LastEdited DESC'); - if($step) return $step->First(); + $step = DataObject::get_one($nextSteps[0], "SessionID = {$this->SessionID}"); + if($step) return $step; } else { return false; }