00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Install_Model_Wizard
00035 {
00036
00037
00038
00039
00040
00041 protected $_steps = array();
00042
00043 public function __construct()
00044 {
00045 $this->_steps = Mage::getSingleton('install/config')->getWizardSteps();
00046
00047 foreach ($this->_steps as $index => $step) {
00048 $this->_steps[$index]->setUrl(
00049 $this->_getUrl($this->_steps[$index]->getController(), $this->_steps[$index]->getAction())
00050 );
00051
00052 if (isset($this->_steps[$index+1])) {
00053 $this->_steps[$index]->setNextUrl(
00054 $this->_getUrl($this->_steps[$index+1]->getController(), $this->_steps[$index+1]->getAction())
00055 );
00056 $this->_steps[$index]->setNextUrlPath(
00057 $this->_getUrlPath($this->_steps[$index+1]->getController(), $this->_steps[$index+1]->getAction())
00058 );
00059 }
00060 if (isset($this->_steps[$index-1])) {
00061 $this->_steps[$index]->setPrevUrl(
00062 $this->_getUrl($this->_steps[$index-1]->getController(), $this->_steps[$index-1]->getAction())
00063 );
00064 $this->_steps[$index]->setPrevUrlPath(
00065 $this->_getUrlPath($this->_steps[$index-1]->getController(), $this->_steps[$index-1]->getAction())
00066 );
00067 }
00068 }
00069 }
00070
00071
00072
00073
00074
00075
00076
00077 public function getStepByRequest(Zend_Controller_Request_Abstract $request)
00078 {
00079 foreach ($this->_steps as $step) {
00080 if ($step->getController() == $request->getControllerName() && $step->getAction() == $request->getActionName()) {
00081 return $step;
00082 }
00083 }
00084 return false;
00085 }
00086
00087
00088
00089
00090
00091
00092
00093 public function getStepByName($name)
00094 {
00095 foreach ($this->_steps as $step) {
00096 if ($step->getName() == $name) {
00097 return $step;
00098 }
00099 }
00100 return false;
00101 }
00102
00103
00104
00105
00106
00107
00108 public function getSteps()
00109 {
00110 return $this->_steps;
00111 }
00112
00113 protected function _getUrl($controller, $action)
00114 {
00115 return Mage::getUrl($this->_getUrlPath($controller, $action));
00116 }
00117
00118
00119
00120
00121
00122
00123
00124
00125 protected function _getUrlPath($controller, $action)
00126 {
00127 return 'install/'.$controller.'/'.$action;
00128 }
00129 }