*/ /** * Klasa stProgressBarActions * * @package stProgressBarPlugin * @subpackage actions */ class stProgressBarActions extends sfActions { /** * Akcja Process */ public function executeProcess() { $this->msg = ''; $this->fatal_msg = ''; $this->title = ''; $this->setLayout(false); $this->name = $this->getRequestParameter('name'); $this->progressBarInformation = $this->getUser()->getAttribute($this->name, array(), 'soteshop/stProgressBarPlugin'); $this->class = $this->progressBarInformation['class']; $this->method = $this->progressBarInformation['method']; $this->steps = $this->progressBarInformation['steps']; $this->step = $this->getRequestParameter('step',0); if ($this->steps == 0) { $this->complete = 100; } $class = new $this->class($this->getContext()); if (method_exists($class, 'initialize')) { $class->initialize($this->step); } if ($this->step == 0) { if (method_exists($class,"init")) { $class->init(); } elseif (method_exists($class, "started")) { $class->started(); } } if ($this->step < $this->steps) { $this->makeNextProgress = true; if (is_callable(array($class,$this->method))) { $this->step = $class->{$this->method}($this->step); } else { $this->step = $this->steps; } } else { $this->makeNextProgress = false; $this->step = $this->steps; if (method_exists($class,"close")) { $class->close(); } elseif (method_exists($class, "finished")) { $class->finished(); } if ($class instanceof stProgressBarTaskInterface) { $class->clearParameters(); } } $this->complete = $this->steps ? number_format(100*$this->step/$this->steps, 1) : 100; if (method_exists($class,"getMessage")) { $this->msg = $class->{"getMessage"}(); } if (method_exists($class,"getTitle")) { $this->title = $class->{"getTitle"}(); } if (method_exists($class,"getFatalMessage")) { $this->fatal_msg = $class->{"getFatalMessage"}(); } } }