<?php

require_once 'modules/admin/views/SignupView.php';

/**
* @package Admin
*/
class Signup_0_ShowPackages extends SignupView
{
    var $permission     = '';

    function preHeaders()
    {
        $this->initialize();
    }
    
    function dispatch()
    {
        
        $this->templateInit();

        if ($this->clienttype == 0 && $this->package == 0) {
             $_SESSION['AllowStep0']=true;
        }

        if (!isset($this->currency)) {
            $this->currency = '';
        }

        $this->tpl->assign("CLIENTTYPE",$this->clienttype);
        $this->tpl->assign("CURRENCY",$this->currency);
        $this->tpl->assign("DOMAIN",$this->domain);
        $this->tpl->assign("COUPONCODE",$this->couponcode);

        if ($this->package > 0) {
            $this->tpl->assign("INPUTNAME","package");
            $this->tpl->assign("INPUTVALUE",$this->package);
            $this->tpl->parse("FORM_INPUTS", "form_hidden_inputs");
        }

        if ($this->clienttype == 0 && $this->package == 0) {
            //First Time through step 0
            require_once 'modules/admin/models/PackageTypeGateway.php';
            $packageTypes = PackageTypeGateway::getDefaultPackageTypes();
            $plancount = $packageTypes->getNumItems();

            $count=0;
            $row = 0;

            //Loop through all the packagetypes
            while($packageType = $packageTypes->fetch()) {
                $row = ($row + 1) % 2;
                $this->tpl->assign("SUBMITFUNCTION","SubmitStepZero");
                $this->tpl->assign("SIZEOFBOX","115");
                $this->tpl->assign("WIDTHOFBOX","326");
                $this->tpl->assign("INPUTNAME","clienttype");
                $this->tpl->assign("INPUTVALUE", $packageType->getId());
                $this->tpl->assign("PACKAGETYPENAME",$packageType->getName());
                $this->tpl->assign("PACKAGETYPEDESC",$packageType->getDescription());
                $this->tpl->assign('BOX_CLASS', ($row == 1)? 'categories_wrap' : 'categories_wrap second');
                $this->tpl->parse('signup_0_showpackages', '.signup_type');

            }
        }

        $this->tpl->parse("STEP_0_OUT", "signup_0_showpackages");
        $this->tpl->FastPrint("STEP_0_OUT");

        $this->tpl->FastPrint("FOOTER");
    }
}

?>
