include_once(JPATH_BASE."/components/com_vxc/helpers/siteoptionshelper.php"); class OrderBallsHelper { var $_currentStep = 0; var $_numCompletedStep = 0; var $_options = array(); function __construct() { $this->_options = array(); $initDatas = SiteOptionsHelper::getBallDatas(); foreach ($initDatas as $initData) { $option = array(); $option['text']= JText::_($initData[0]); $option['completed'] = false; $option['view'] = $initData[1]; $this->_options[] = $option; $orderNumber ++; } } function SetCurrentStep($step) { $this->_currentStep = $step; } function SetCompletedStep($numCompletedStep) { $this->_numCompletedStep = $numCompletedStep; } function _isStepCompleted($step) { return $step< $this->_numCompletedStep; } function setOptions($options) { $this->_options = $options; } function _addJavascript() { $currentController = JRequest::getVar('controller'); $document =& JFactory::getDocument(); $js = " function StepSelection(step) { document.mainForm.task.value = 'gotoStep'; document.mainForm.step.value = step; document.mainForm.submit(); } function PreviousStep() { StepSelection(".($this->_currentStep-1)."); } function NextStep() { StepSelection(".($this->_currentStep+1)."); }"; $document->addScriptDeclaration($js); } function _addStyleSheet() { $document = &JFactory::getDocument(); $css = " td.balltd { font-size:12px; font-style:normal; font-weight: normal; color: black; }"; $document->addStyleDeclaration($css); } function render() { $this->_addJavascript(); $this->_addStyleSheet(); $html =''; $html.="
| ";
if ($this->_currentStep > 0 )
$html .= "";
else
$html .= " << ".JText::_('Previous')." ";
$html .= " | ";
for ($i = 0 ; $i < count($this->_options); $i++)
{
$event = '';
if ($i > ($this->_numCompletedStep) || $i < 0)
{
if ($this->_isStepCompleted($i))
$imgSrc= "components/com_vxc/assets/images/step_completed_disabled.png";
else
$imgSrc = "components/com_vxc/assets/images/step_disabled.png";
}
else
{
if ($i == $this->_currentStep)
{
if ($this->_isStepCompleted($i))
$imgSrc = "components/com_vxc/assets/images/step_selected_completed.png";
else
$imgSrc = "components/com_vxc/assets/images/step_selected.png";
}
else
{
$event = "onclick=\"StepSelection(" . $i . ");return false;\"";
if ($this->_isStepCompleted($i))
$imgSrc = "components/com_vxc/assets/images/step_completed.png";
else
$imgSrc = "components/com_vxc/assets/images/step.png";
}
}
$html.="";
if ($event!='')
$html.="";
if ($imgSrc!="")
$html.=" "; $html.= JText::_($this->_options[$i]['text']); if ($event!='') $html.=""; $html .=" | ";
}
$html.="";
if ($this->_currentStep != count($this->_options)-1 && $this->_currentStep<=$this->_numCompletedStep)
$html.="";
else
$html.=" ".JText::_('Next')." >> ";
$html .=" | ";
$html .="
| ".($_options[$i]['text'])." | "; $html .="