Пример #1
0
 /**
  * Constructs a new install wizard
  * @param string $action URL where the wizard form will point to
  * @return null
  */
 public function __construct($action)
 {
     parent::__construct($action, self::NAME);
     $this->installer = new Installer();
     $this->addStep(InstallStepProfile::NAME, new InstallStepProfile());
     $this->addStep(InstallStepRequirement::NAME, new InstallStepRequirement());
     $this->addStep(InstallStepLocalization::NAME, new InstallStepLocalization());
     $this->addStep(InstallStepInstallation::NAME, new InstallStepInstallation());
     $this->addStep(InstallStepFinish::NAME, new InstallStepFinish());
     $steps = $this->getProfileSteps();
     foreach ($steps as $name => $step) {
         $this->addStep($name, $step);
     }
 }
Пример #2
0
 /**
  * Constructs a new model wizard
  * @param string $action URL where the wizard form will point to
  * @param string $modelName Name of a model to initialize the wizard with
  * @return null
  */
 public function __construct($action, $modelName = null)
 {
     parent::__construct($action, self::NAME);
     $this->addStep(ModelGeneralStep::NAME, new ModelGeneralStep());
     $this->addStep(FieldStep::NAME, new FieldStep());
     $this->addStep(DataFormatStep::NAME, new DataFormatStep());
     $this->addStep(IndexStep::NAME, new IndexStep());
     $this->addStep(FinishStep::NAME, new FinishStep());
     if (!$modelName) {
         return;
     }
     $this->reset();
     $model = ModelManager::getInstance()->getModel($modelName);
     $meta = $model->getMeta();
     $modelTable = clone $meta->getModelTable();
     $modelClass = get_class($model);
     $dataClass = $meta->getDataClassName();
     $this->setVariable(self::VARIABLE_MODEL_TABLE, $modelTable);
     $this->setVariable(self::VARIABLE_MODEL_CLASS, $modelClass);
     $this->setVariable(self::VARIABLE_DATA_CLASS, $dataClass);
     $this->setVariable(self::VARIABLE_MODEL_EXISTS, true);
 }