当前位置: 首页>>代码示例>>PHP>>正文


PHP Package::getInstance方法代码示例

本文整理汇总了PHP中Package::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::getInstance方法的具体用法?PHP Package::getInstance怎么用?PHP Package::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Package的用法示例。


在下文中一共展示了Package::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: OrderPkg

 public static function OrderPkg($pkgid)
 {
     $xtpl = self::$xtpl;
     $product = Package::getInstance();
     $products = $product->GetOrderable();
     if (count($products) < 1) {
     } else {
         for ($i = 0; $i < count($products); $i++) {
             if ($products[$i]['id'] == $pkgid) {
                 $xtpl->assign('DEFAULT', 'selected="selected"');
             } else {
                 $xtpl->assign('DEFAULT', '');
             }
             $xtpl->assign('PKGR', $products[$i]);
             $xtpl->parse('main.orderpkg.pkgrow');
         }
     }
     if ($pkgdata = $product->FetchData($pkgid)) {
         $xtpl->assign('PKG', $pkgdata);
         switch ($pkgdata['paytype']) {
             case 'Free':
                 $xtpl->assign('PRICE', 'Free');
                 $xtpl->assign('CYCLEDISABLED', "disabled");
                 break;
             case 'Onetime':
                 $xtpl->assign('PRICE', $pkgdata['price']);
                 $xtpl->assign('CYCLEDISABLED', "disabled");
             case 'Recurring':
                 $xtpl->assign('PRICE', $pkgdata['price']);
                 break;
         }
         $xtpl->parse('main.orderpkg.pkgorder');
     } else {
         $xtpl->assign('ID', $pkgid);
         $xtpl->parse('main.orderpkg.pkginfo');
     }
     $xtpl->parse('main.orderpkg');
     $xtpl->parse('main');
     $xtpl->out('main');
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:40,代码来源:class.Page.php

示例2: generateLastInv

 public function generateLastInv($orderid = '')
 {
     $time = Time::getInstance();
     $inv = Invoice::getInstance();
     $pkg = Package::getInstance();
     $setting = Settings::getInstance();
     if (!is_numeric($orderid) && !is_numeric($this->orderid)) {
         $result = array();
         $days = $time->add_date($time->UtoM(time()), $setting->Get('system.cron.daystonewinv'));
         $this->raw = $this->db->fetch_all_array('SELECT * FROM `Order` WHERE `status` = "Active" AND `nextdue` < "' . $days . '" AND `cycle` > 0');
         for ($i = 0; $i < count($this->raw); $i++) {
             $invdata = $inv->FetchData($this->raw[$i]['lastinv']);
             if ($time->MtoU($invdata['datedue']) < $time->MtoU($this->raw[$i]['nextdue'])) {
                 //new invoice should be generated
                 $pkgdata = $pkg->FetchData($this->raw[$i]['productid']);
                 $nextdue = $time->add_date($this->raw[$i]['nextdue'], '', $this->raw[$i]['cycle']);
                 $comment = "Order for package " . $pkgdata['name'] . " (" . $this->raw[$i]['nextdue'] . " - " . $nextdue . ")";
                 $lastinv = $inv->Create($this->raw[$i]['accountid'], $this->raw[$i]['id'], $this->raw[$i]['recuramount'], $this->raw[$i]['nextdue'], 'Unpaid', $comment);
                 $result[] = array('invoice' => $lastinv, 'order' => $this->raw[$i]['id']);
                 $this->Update('lastinv', $lastinv, $this->raw[$i]['id']);
             }
         }
         return $result;
     } else {
         if (!is_numeric($orderid)) {
             $orderid = $this->orderid;
         }
         $orderdata = $this->FetchData($orderid);
         $lastinvdata = $inv->FetchData($orderdata['lastinv']);
         if ($orderdata['status'] == 'Active' && $orderdata['cycle'] > 0 && $time->MtoU($orderdata['nextdue']) > $time->MtoU($lastinvdata['datedue'])) {
             $pkgdata = $pkg->FetchData($orderdata['productid']);
             $nextdue = $time->add_date($orderdata['nextdue'], '', $orderdata['cycle']);
             $comment = "Order for package " . $pkgdata['name'] . " (" . $orderdata['nextdue'] . " - " . $nextdue . ")";
             $lastinv = $inv->Create($orderdata['accountid'], $orderdata['id'], $orderdata['recuramount'], $orderdata['nextdue'], '', $comment);
             $this->Update($orderdata['id'], 'lastinv', $lastinv);
         }
     }
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:38,代码来源:class.Order.php

示例3: Create

 public function Create($orderid)
 {
     $order = Order::getInstance();
     $sm = ServerModule::getInstance();
     $preset = Preset::getInstance();
     $order->orderid = $orderid;
     $orderdata = $order->FetchData($orderid);
     $pkg = Package::getInstance()->FetchData($orderdata['productid']);
     $preset->presetid = $pkg['presetid'];
     $sm->id = $order->FindModuleID();
     $presetdata = $preset->FetchData($preset->presetid);
     if (!is_array($orderdata['accessdata'])) {
         $orderdata['accessdata'] = serialize($this->FillCreateArray($sm->getArray('Create'), $orderdata['accountid']));
         $order->Update('accessdata', $orderdata['accessdata'], $orderid);
     }
     if (!is_numeric($orderdata['serverid']) || $orderdata['serverid'] == '-1') {
         $serverdata = $this->selectServerFromGroup($presetdata['groupid']);
         $order->Update('serverid', $serverdata['ServerID'], $orderid);
     } else {
         $server = Server::getInstance();
         $serverdata = $server->FetchData($orderdata['serverid']);
     }
     if (strlen($serverdata['accessdata']) < 5) {
         throw new Exception("Server #" . $orderdata['serverid'] . " is not configured");
     }
     return $sm->CreateService(unserialize($serverdata['accessdata']), unserialize($orderdata['accessdata']), $preset->getOptions());
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:27,代码来源:class.Service.php

示例4: Exception

<?php

if (!Package::isLoaded('auth')) {
    throw new Exception('The package `default` requires the package `auth` to be enabled');
}
Router::addRoutes((array) Package::getInstance('default')->config()->getValues('routes'));
开发者ID:aidenfoxx,项目名称:foxxmvc,代码行数:6,代码来源:bootstrap.php

示例5: define

<?php

define('DIR_BASE', realpath(dirname(__FILE__) . '/..'));
define('DIR_CORE', DIR_BASE . '/core');
define('DIR_CACHE', DIR_BASE . '/cache');
define('DIR_PACKAGES', DIR_BASE . '/packages');
define('DIR_URI', substr(dirname($_SERVER['PHP_SELF']), 1));
require '../core/autoload.php';
require '../vendor/autoload.php';
use Whoops\Run;
use Whoops\Handler\PrettyPageHandler;
new AutoLoad();
if ((int) Config::getInstance()->getValues('default')->DEBUG) {
    error_reporting(-1);
    ini_set('display_errors', 1);
    $whoops = new Whoops\Run();
    $whoops->pushHandler(new Whoops\Handler\PrettyPageHandler());
    $whoops->register();
} else {
    error_reporting(0);
    ini_set('display_errors', 0);
}
foreach ((array) Config::getInstance()->getValues('package') as $package) {
    Package::getInstance($package)->execute($package);
}
if (!($response = Router::forge(Tools::getValue('route'))->execute()->response())) {
    $response = Router::forge('_404_')->execute()->response();
    header("HTTP/1.0 404 Not Found");
}
echo $response;
开发者ID:aidenfoxx,项目名称:foxxmvc,代码行数:30,代码来源:index.php

示例6: catch

     $setting->Update('system.cron.daystosuspend', $_POST['daystosuspend']);
     $setting->Update('system.cron.daystoterminate', $_POST['daystoterminate']);
     Page::EditCron();
     break;
 case 'editpkg':
     $pkg = Package::getInstance();
     try {
         $pkg->BatchUpdate($_POST, $_POST['pkgid']);
     } catch (Exception $e) {
         Page::$messages[] = array('type' => 'attention', 'message' => 'Fatal error catched during update. Error dump: ' . nl2br($e));
         Page::message();
     }
     Page::EditPkg($_POST['pkgid']);
     break;
 case 'delpkg':
     $pkg = Package::getInstance();
     $order = Order::getInstance();
     if (!is_numeric($_REQUEST['pkgid'])) {
         throw new Exception("No package ID specified to delete");
     } elseif ($order->Calculate('', $_REQUEST['pkgid']) > 0) {
         Page::$messages[] = array('type' => 'attention', 'message' => 'You cannot remove this package because there are still existing orders for that package');
     } else {
         $pkg->Delete($_REQUEST['pkgid']);
         Page::$messages[] = array('type' => 'success', 'message' => 'Package successfully removed');
     }
     Page::Package();
     break;
 case 'delcustomer':
     if (!is_numeric($_REQUEST['userid']) && !isset($_REQUEST['username'])) {
         Page::$messages[] = array('type' => 'attention', 'message' => 'User ID is not set');
     } else {
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:31,代码来源:index.php


注:本文中的Package::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。