|
14 | 14 | * @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
15 | 15 | */
|
16 | 16 | class WizardComponent extends Component {
|
| 17 | + |
| 18 | +/** |
| 19 | + * Controller $controller variable. |
| 20 | + * |
| 21 | + * @var string |
| 22 | + * @access public |
| 23 | + */ |
| 24 | + public $controller = null; |
17 | 25 | /**
|
18 | 26 | * The Component will redirect to the "expected step" after a step has been successfully
|
19 | 27 | * completed if autoAdvance is true. If false, the Component will redirect to
|
@@ -117,57 +125,70 @@ class WizardComponent extends Component {
|
117 | 125 | * @var string
|
118 | 126 | * @access protected
|
119 | 127 | */
|
120 |
| - public $_currentStep = null; |
| 128 | + protected $_currentStep = null; |
121 | 129 | /**
|
122 | 130 | * Holds the session key for data storage.
|
123 | 131 | *
|
124 | 132 | * @var string
|
125 | 133 | * @access protected
|
126 | 134 | */
|
127 |
| - public $_sessionKey = null; |
| 135 | + protected $_sessionKey = null; |
128 | 136 | /**
|
129 | 137 | * Other session keys used.
|
130 | 138 | *
|
131 | 139 | * @var string
|
132 | 140 | * @access protected
|
133 | 141 | */
|
134 |
| - public $_configKey = null; |
135 |
| - public $_branchKey = null; |
| 142 | + protected $_configKey = null; |
| 143 | + protected $_branchKey = null; |
136 | 144 | /**
|
137 | 145 | * Holds the array based url for redirecting.
|
138 | 146 | *
|
139 | 147 | * @var array
|
140 | 148 | * @access protected
|
141 | 149 | */
|
142 |
| - public $_wizardUrl = array(); |
| 150 | + protected $_wizardUrl = array(); |
143 | 151 | /**
|
144 | 152 | * Other components used.
|
145 | 153 | *
|
146 | 154 | * @var array
|
147 | 155 | * @access public
|
148 | 156 | */
|
149 | 157 | public $components = array('Session');
|
| 158 | + |
| 159 | +/** |
| 160 | + * WizardComponent Constructor |
| 161 | + * |
| 162 | + * @param ComponentCollection $collection A ComponentCollection this component can use to lazy-load its components |
| 163 | + * @param array $settings Array of configuration settings |
| 164 | + * @access public |
| 165 | + */ |
| 166 | + public function __construct(ComponentCollection $collection, $settings = array()) { |
| 167 | + parent::__construct($collection, $settings); |
| 168 | + $this->_set($settings); |
| 169 | + } |
| 170 | + |
150 | 171 | /**
|
151 | 172 | * Initializes WizardComponent for use in the controller
|
152 | 173 | *
|
153 | 174 | * @param object $controller A reference to the instantiating controller object
|
154 | 175 | * @access public
|
| 176 | + * @return void |
155 | 177 | */
|
156 |
| - public function initialize($controller, $settings = array()) { |
| 178 | + public function initialize(Controller $controller) { |
157 | 179 | $this->controller = $controller;
|
158 |
| - $this->_set($settings); |
159 | 180 |
|
160 | 181 | $this->_sessionKey = $this->controller->Session->check('Wizard.complete') ? 'Wizard.complete' : 'Wizard.' . $controller->name;
|
161 | 182 | $this->_configKey = 'Wizard.config';
|
162 | 183 | $this->_branchKey = 'Wizard.branches.' . $controller->name;
|
163 | 184 | }
|
164 | 185 | /**
|
165 | 186 | * Component startup method.
|
166 |
| - * |
| 187 | + * Called after the Controller::beforeFilter() and before the controller action |
167 | 188 | * @param object $controller A reference to the instantiating controller object
|
168 | 189 | * @access public
|
169 | 190 | */
|
170 |
| - public function startup(&$controller) { |
| 191 | + public function startup(Controller $controller) { |
171 | 192 | $this->steps = $this->_parseSteps($this->steps);
|
172 | 193 |
|
173 | 194 | $this->config('action', $this->action);
|
|
0 commit comments