Back to PhocacartRenderAdminview class

Method renderWizardButton

public static
renderWizardButton
(mixed $type = 'enable', mixed $idMd = '', mixed $url = '', mixed $w = '', mixed $h = '')

Method renderWizardButton - Source code

public static function renderWizardButton($type = 'enable', $idMd = '', $url = '', $w = '', $h = '')
{
    $s = PhocacartRenderStyle::getStyles();
    $paramsC = PhocacartUtils::getComponentParameters();
    $enable_wizard = $paramsC->get('enable_wizard', 1);
    // We have two evens when clicking on start wizard button
    // Only applies to start wizard not on back wizard as this is not ajaxed - so controller will switch on the info
    $id = 'phStartWizdard';
    // wizard will be enabled in system - in options, so other parts of website know it
    $class = 'button-options btn btn-warning ' . $idMd . 'ModalButton';
    // modal window with wizard will be popuped
    if ($type == 'back' && $enable_wizard > 0) {
        // BACK TO WIZARD (can be called everywhere)
        $bar = Toolbar::getInstance('toolbar');
        $dhtml = '<joomla-toolbar-button><button onclick="Joomla.submitbutton(\'phocacartwizard.backtowizard\');" class="btn btn-small btn-warning">
	<span id="ph-icon-wizard" class="icon-dummy ' . $s['i']['edit'] . ' ph-icon-wizard fas fa fa-hat-wizard"></span>' . Text::_('COM_PHOCACART_BACK_TO_WIZARD') . '</button></joomla-toolbar-button>';
        $bar->appendButton('Custom', $dhtml, 'wizard');
    } else {
        if ($type == 'start') {
            // START WIZARD (can be called only in control panel) - to start in ohter place, back to wizard format needs to be copied
            // this button is starded by javascript in function modalWindowDynamic libraries\phocacart\render\adminview.php
            $bar = Toolbar::getInstance('toolbar');
            $dhtml = '<joomla-toolbar-button><a href="' . $url . '" id="' . $id . '" class="' . $class . '" data-bs-target="#' . $idMd . '" data-bs-toggle="modal" data-src="' . $url . '" data-width="' . $w . '" data-heigth="' . $h . '">
	<span id="ph-icon-wizard" class="icon-dummy ' . $s['i']['edit'] . ' ph-icon-wizard fas fa fa-hat-wizard"></span>' . Text::_('COM_PHOCACART_START_WIZARD') . '</a></joomla-toolbar-button>';
            $bar->appendButton('Custom', $dhtml, 'wizard');
            // We have displayed the modal with wizard
            // but we need to enable it in system so if we go from wizad to each task, it is enabled
            $urlAjaxEnableWizard = 'index.php?option=com_phocacart&task=phocacartwizard.enablewizard&format=json&' . Session::getFormToken() . '=1';
            PhocacartRenderAdminjs::renderAjaxDoRequestWizardController($urlAjaxEnableWizard, $id, false);
        }
    }
}