getViewConfig(); $oUser = oxSuperCfg::getUser(); $shopUrl = $oConfig->getShopUrl(); $resUrl = $oViewConf->getResourceUrl(); $imgUrl = $oViewConf->getImageUrl(); // init tpl system raintpl::configure("base_url", $shopUrl . WEBROOT ); raintpl::configure("tpl_dir", BASE . "/tpl/" ); raintpl::configure("cache_dir", BASE . "/tmp/" ); raintpl::configure("path_replace_list", array( 'input' )); // init configurator $WindowConfig = new edgWindowConfigurator(); $act = (isset($_POST['act']) && is_numeric($_POST['act'])) ? $_POST['act'] : 0; $WindowConfig->setActiveConfId($act); $conf = $WindowConfig->InitBaseData(); // rpc call handling (here because weird session problems in rpc.php and no time to improve this.) if( !empty($_POST['do']) ) { $do = $_POST['do']; $json = true; $output = ''; switch($do) { case 'getsizes': $variant_id = (!empty($_POST['vid'])) ? $_POST['vid'] : '1-1'; $output = $WindowConfig->querySizes($variant_id); break; case 'inscol': case 'outcol': $color_id = (!empty($_POST['id'])) ? $_POST['id'] : 1; $output = $WindowConfig->queryColors($color_id); break; case 'struct': $struct_id = (!empty($_POST['id'])) ? $_POST['id'] : 1; $output = $WindowConfig->queryStructures($struct_id); break; case 'setconf': $output = (!empty($_POST['data']) && is_numeric($_POST['id'])) ? $WindowConfig->setUserConf( $_POST['data'], $_POST['id'] ) : ''; break; case 'loadconf': $output = (!is_numeric($_POST['id'])) ? $WindowConfig->getUserConf() : $WindowConfig->getUserConf($_POST['id']); break; case 'sidebar': $output = (is_numeric($_POST['id'])) ? $WindowConfig->getSidebar($_POST['id']) : ''; break; case 'setcount': $output = (!empty($_POST['count']) && is_numeric($_POST['id'])) ? $WindowConfig->setCount( $_POST['count'], $_POST['id'] ) : ''; break; case 'delete': $output = (is_numeric($_POST['id'])) ? $WindowConfig->deleteConf($_POST['id']) : ''; break; case 'add': $output = $WindowConfig->getNextInsertId(); break; case 'overview': $output = $WindowConfig->getOverview(); $json = false; break; case 'submit': $mailTpl = file_get_contents(BASE . '/tpl/email.html'); $output = (!empty($_POST['userdata'])) ? $WindowConfig->sendInquiry($mailTpl, $_POST['userdata']) : false; $json = false; break; default: break; } header('content-type:text/plain'); echo ($json) ? json_encode($output) : $output; exit; } // init tpl vars $tpl = new RainTPL; $tpl->assign('resUrl', $resUrl); $tpl->assign('imgUrl', $imgUrl); $tpl->assign('shopUrl', $shopUrl); $tpl->assign('confImgUrl', WEBROOT . '/res/img/details'); $tpl->assign('baseUrl', WEBROOT); $tpl->assign('filetime', filemtime(BASE . '/res/css/konfigurator.css')); $tpl->assign('sitetitle', 'Fensterkonfigurator | EnergieDirekt'); $confCounter = $WindowConfig->getConfigCount(); // assign init data $tpl->assign('profiles', $conf['profiles']); $tpl->assign('basetypes', $conf['basetypes']); $tpl->assign('basevariants', $conf['basevariants']); $tpl->assign('variants', $conf['variants']); $tpl->assign('colors', $conf['colors']); $tpl->assign('glazing', $conf['glazing']); $tpl->assign('structure', $conf['structure']); $tpl->assign('bars', $conf['bars']); $tpl->assign('extras', $conf['extras']); $tpl->assign('details', $conf['details']); $tpl->assign('countArray', $confCounter); // try to assign user data if user is already registered in the shop. $tpl->assign('name', trim($oUser->oxuser__oxfname . ' ' . $oUser->oxuser__oxlname)); $tpl->assign('adress', trim($oUser->oxuser__oxstreet . ' ' . $oUser->oxuser__oxstreetnr)); $tpl->assign('zip', $oUser->oxuser__oxzip); $tpl->assign('city', $oUser->oxuser__oxcity); $tpl->assign('phone', $oUser->oxuser__oxfon); $tpl->assign('email', $oUser->oxuser__oxusername); // sets an active JS flag $tpl->assign('activeConf', $WindowConfig->getActiveConfId()); // output $tpl->draw( 'konfigurator' ); ?>