_updateMethodName = $methodName;
return $this;
}
/**
* Set the finish method name
*
* @param string $methodName
* @return Zend_ProgressBar_Adapter_JsPush
*/
public function setFinishMethodName($methodName)
{
$this->_finishMethodName = $methodName;
return $this;
}
/**
* Defined by Zend_ProgressBar_Adapter_Interface
*
* @param float $current Current progress value
* @param float $max Max progress value
* @param float $percent Current percent value
* @param integer $timeTaken Taken time in seconds
* @param integer $timeRemaining Remaining time in seconds
* @param string $text Status text
* @return void
*/
public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text)
{
$arguments = array(
'current' => $current,
'max' => $max,
'percent' => ($percent * 100),
'timeTaken' => $timeTaken,
'timeRemaining' => $timeRemaining,
'text' => $text
);
$data = '';
// Output the data
$this->_outputData($data);
}
/**
* Defined by Zend_ProgressBar_Adapter_Interface
*
* @return void
*/
public function finish()
{
if ($this->_finishMethodName === null) {
return;
}
$data = '';
$this->_outputData($data);
}
/**
* Outputs given data the user agent.
*
* This split-off is required for unit-testing.
*
* @param string $data
* @return void
*/
protected function _outputData($data)
{
// 1024 padding is required for Safari, while 256 padding is required
// for Internet Explorer. The
is required so Safari actually
// executes the
echo str_pad($data . '
', 1024, ' ', STR_PAD_RIGHT) . "\n";
flush();
ob_flush();
}
}