Exemplo n.º 1
0
 public static function init()
 {
     self::$xtpl = XTemplate::getInstance();
     self::$xtpl->restart('template/install.tpl');
     self::$xtpl->assign('VERSION', iVersion);
 }
Exemplo n.º 2
0
 public static function Invoice($invdata, $defgw = NULL)
 {
     $currency = NULL;
     $oparray = array();
     $xtpl = XTemplate::getInstance();
     $gm = GatewayModule::getInstance();
     $setting = Settings::getInstance();
     $curr = Currency::getInstance();
     $user = User::getInstance();
     $xtpl->restart("themes/simpla/invoice.tpl");
     if (count($invdata) < 2) {
         $xtpl->parse('inverror');
     } else {
         $gmodules = $gm->GetButch();
         if ($defgw == NULL) {
             $defgw = $setting->Get('system.paygateway.default');
         }
         $prov = call_user_func(array($gm->GetName($defgw) . "PaymentGateway", 'getInstance'));
         $gwdata = $gm->FetchData($defgw);
         if (strlen($gwdata['currency']) != 3) {
             $currs = $curr->GetButch();
             for ($i = 0; $i < count($currs); $i++) {
                 if (in_array($currs[$i]['name'], $prov->Currency())) {
                     if ($setting->Get('system.currency') == $currs[$i]['name'] || $currency == NULL) {
                         $currency = $currs[$i];
                     }
                 }
             }
         } else {
             $currency = $curr->FetchData($curr->GetID($gwdata['currency'], 'name'));
             //$currency = $curr->GetCurrency('', $gwdata['currency']);
         }
         $xtpl->assign('CURR', $currency);
         $xtpl->assign('AMOUNT', $curr->FormatCurrency($invdata['amount'], $currency['id']));
         $data_array['userdata'] = $user->FetchData($invdata['accountid']);
         $data_array['invoice'] = $invdata;
         $data_array['currency'] = $currency['name'];
         $data_array['invoice']['amount'] = $curr->FormatCurrency($invdata['amount'], $currency['id'], -1, true);
         $oparray = unserialize($gwdata['data']);
         $xtpl->assign('FORM', $prov->Form($oparray, $data_array));
         for ($i = 0; $i < count($gmodules); $i++) {
             $prov = call_user_func(array($gmodules[$i]['modulename'] . "PaymentGateway", 'getInstance'));
             if ($defgw == $gmodules[$i]['id']) {
                 $xtpl->assign('DEFAULT', 'selected="selected"');
             } else {
                 $xtpl->assign('DEFAULT', '');
             }
             $xtpl->assign('GM', $gmodules[$i]);
             $ginfo = $prov->Info();
             $xtpl->assign('GNAME', $ginfo['name']);
             $xtpl->parse('main.gwlist');
         }
     }
     $xtpl->assign('INV', $invdata);
     $xtpl->parse('main');
     $xtpl->out('main');
 }