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


PHP Time::getInstance方法代码示例

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


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

示例1: Create

 public function Create($accountid, $orderid = -1, $amount = 0, $duedate, $status = 'Unpaid', $comment = '', $datecreated = '', $datepaid = '', $transactionid = '-1')
 {
     $time = Time::getInstance();
     if (!is_numeric($accountid) || !is_numeric($transactionid) || !is_numeric($orderid)) {
         throw new Exception("problems with invoice data");
     }
     $amount = floatval($amount);
     if ($datecreated == '') {
         $datecreated = $time->UtoM(time());
     } elseif (!$time->validateTime($datecreated)) {
         throw new Exception("Date of creation in wrong format!");
     }
     if (!$time->validateTime($duedate) && $duedate != '0000-00-00 00:00:00') {
         throw new Exception("Due date in wrong format");
     }
     if (!preg_match('/^(Paid|Unpaid|Cancelled)$/i', $status)) {
         throw new Exception("Invoice status in wrong format");
     }
     if ($datepaid != '' && !$time->validateTime($datepaid)) {
         throw new Exception("Date of payment in wrong format");
     }
     $this->data = array('accountid' => $accountid, 'orderid' => $orderid, 'amount' => $amount, 'status' => $status, 'datecreated' => $datecreated, 'datedue' => $duedate, 'datepaid' => $datepaid, 'comment' => $comment, 'transactionid' => $transactionid);
     $this->raw = $this->db->query_insert('Invoice', $this->data);
     if (is_numeric($this->raw)) {
         $this->invid = $this->raw;
         return $this->raw;
     } else {
         return false;
     }
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:30,代码来源:class.Invoice.php

示例2: Create

 public function Create($invoiceid, $gatewayid, $amount, $date = NULL, $comments = '', $userid = NULL)
 {
     if (!is_numeric($invoiceid) && !is_float($amount)) {
         throw new Exception("Invoice ID or amount in wrong format");
     }
     $inv = Invoice::getInstance();
     $invdata = $inv->FetchData($invoiceid);
     $time = Time::getInstance();
     if ($date == NULL) {
         $date = $time->UtoM(time());
     }
     $this->raw = $this->db->query_insert('Transaction', array('invoiceid' => $invoiceid, 'customerid' => $invdata['accountid'], 'date' => $date, 'amount' => $amount, 'gatewayid' => $gatewayid, 'comments' => $comments));
     $inv->Update('status', 'Paid', $invoiceid);
     $inv->Update('transactionid', $this->raw, $invoiceid);
     $inv->Update('datepaid', $date, $invoiceid);
     return $this->raw;
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:17,代码来源:class.Transaction.php

示例3: Create

 public function Create($ticketid, $userid, $message, $type = "reply", $date = '')
 {
     $time = Time::getInstance();
     if (!is_numeric($ticketid) || !is_numeric($userid)) {
         throw new Exception("Ticket or User ID is not numeric");
     }
     if (!preg_match('/^(status|reply)$/i', $type)) {
         throw new Exception("change type in wrong format");
     }
     if ($date == '') {
         $date = $time->UtoM(time());
     } elseif (!$time->validateTime($date)) {
         throw new Exception("Date in wrong format");
     }
     $array = array("userid" => $userid, "message" => $message, "type" => $type, "ticketid" => $ticketid, "date" => $date);
     $this->raw = $this->db->query_insert("TicketChange", $array);
     return $this->raw;
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:18,代码来源:class.TicketChange.php

示例4: properties

 public static function properties()
 {
     $time = Time::getInstance();
     return array('required' => array('depid', 'userid', 'subject'), 'values' => array('date' => $time->UtoM(time()), 'status' => 'Support'));
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:5,代码来源:class.Ticket.php

示例5: properties

 public static function properties()
 {
     $time = Time::getInstance();
     return array('required' => array('name', 'shortname'));
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:5,代码来源:class.NotificationModule.php

示例6: EditInvoice

 public static function EditInvoice($invid)
 {
     $xtpl = self::$xtpl;
     $xtpl->assign('FINCURR', 'current');
     $xtpl->assign('MANAGEINVCURR', 'current');
     $order = Order::getInstance();
     $invoice = Invoice::getInstance();
     $user = User::getInstance();
     $time = Time::getInstance();
     $gm = GatewayModule::getInstance();
     $gmodules = $gm->GetButch();
     $setting = Settings::getInstance();
     $defgw = $setting->Get('system.paygateway.default');
     $invdata = $invoice->FetchData($invid);
     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.editinv.paygw');
     }
     if ($invdata['status'] == 'Paid' && $invdata['transactionid'] != '-1') {
         $trans = Transaction::getInstance();
         $xtpl->assign('TRANS', $trans->FetchData($invdata['transactionid']));
         $xtpl->parse('main.editinv.invoice.transaction');
     }
     $xtpl->assign('CURRDATE', $time->UtoM(time()));
     $xtpl->assign('Status' . $invdata['status'], 'selected="selected"');
     $xtpl->assign('USER', $user->FetchData($invdata['accountid']));
     $xtpl->assign('ORDER', $order->FetchData($invdata['orderid']));
     $xtpl->assign('INV', $invdata);
     $xtpl->parse('main.editinv.invoice');
     $xtpl->parse('main.editinv');
     $xtpl->parse('main');
     $xtpl->out('main');
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:41,代码来源:class.Page.php

示例7: 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

示例8: newPayment

 public function newPayment($invid)
 {
     if (!is_numeric($this->invid) && !is_numeric($invid)) {
         throw new Exception("Invoice ID is not set or set incorrectly");
     } elseif (is_numeric($this->invid) && !is_numeric($invid)) {
         $invid = $this->invid;
     }
     $error = 0;
     $sm = ServerModule::getInstance();
     $user = User::getInstance();
     $order = Order::getInstance();
     $invoice = Invoice::getInstance();
     $time = Time::getInstance();
     $nt = Notification::getInstance();
     $invdata = $invoice->FetchData($invid);
     $users = $user->GetButch(1, '`id` = "' . $invdata['accountid'] . '"');
     $orderdata = $order->FetchData($invdata['orderid']);
     $ntarray = array('USER' => $users[0], 'INV' => $invdata, 'ORDER' => $orderdata);
     switch ($orderdata['status']) {
         case 'Active':
             $nt->Send($users, $ntarray, 'usernewpayment');
             $order->Update('nextdue', $time->add_date($orderdata['nextdue'], 0, $orderdata['cycle']), $orderdata['id']);
             break;
         case 'Pending':
             //Making all this shit for creating new account; sendmail email with access data
             try {
                 $this->Create($orderdata['id']);
             } catch (Exception $e) {
                 $admins = $user->GetButch('', '`status` = "Admin"');
                 $nterarray = array('USER' => $users[0], 'INV' => $invdata, 'MESSAGE' => $e->getMessage(), 'DEBUG' => $e);
                 $nt->Send($admins, $nterarray, 'adminservicesetuperror');
                 $error = 1;
             }
             if ($error > 0) {
                 //we need to refetch order data as we updated accessdata when created new service
                 $orderdata = $order->FetchData($invdata['orderid']);
                 $accessdata = unserialize($orderdata['accessdata']);
                 $order->orderid = $invdata['orderid'];
                 $sm->id = $order->FindModuleID();
                 $modulecreatearray = $sm->getArray('Create');
                 $acdata_to_mail = '';
                 for ($i = 0; $i < count($modulecreatearray); $i++) {
                     if (array_key_exists($modulecreatearray[$i]['name'], $accessdata)) {
                         $acdata_to_mail .= $modulecreatearray[$i]['label'] . ": " . $accessdata[$modulecreatearray[$i]['name']] . "\n";
                     }
                 }
                 $ntarray['ACCESSDATA'] = $acdata_to_mail;
                 //there email should me sent
                 $nt->Send($admins, $ntarray, 'usernewservicedetails');
                 $order->Update('status', 'Active', $invdata['orderid']);
             } else {
                 die("Error");
             }
             break;
         case 'Suspended':
             $this->Unsuspend($order->orderid);
             $order->Update('', 'status', 'Active');
             break;
         case 'Terminated':
             //there are should be some notification for admin and user about payment for terminated service or money should be returned back to the balance
             //$this->Create($order->orderid);
             //$order->Update('','status', 'Active');
             break;
         default:
             throw new Exception("Unknown order status!");
     }
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:67,代码来源:class.Service.php

示例9: properties

 public static function properties()
 {
     $time = Time::getInstance();
     return array('required' => array('text', 'subject', 'moduleid', 'address', 'status'), 'values' => array('date' => $time->UtoM(time())));
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:5,代码来源:class.Notification.php

示例10: GetOverdue

 public function GetOverdue()
 {
     $time = Time::getInstance();
     $oneday = $time->rem_date($time->UtoM(time()), 1);
     return $this->GetButch('', '`time` < "' . $oneday . '"', 'name');
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:6,代码来源:class.TempOrder.php

示例11: elseif

         Page::message('attention', 'Wrong data entered. Try again');
         Page::Database();
     } else {
         $config->set('DATABASE_HOST', $_POST['host']);
         $config->set('DATABASE_USER', $_POST['dbuser']);
         $config->set('DATABASE_PASSWORD', $_POST['dbpassword']);
         $config->set('DATABASE_NAME', $_POST['dbname']);
         Page::PerformDBinstall();
     }
     break;
 case 5:
     Page::AddAdmin();
     break;
 case 6:
     $db = DB::getInstance();
     $time = Time::getInstance();
     if (!preg_match('/^[a-zA-Z0-9]+$/', $_POST['username']) || !preg_match('/\\b[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b/i', $_POST['email'])) {
         Page::message('attention', 'Admin username or email in wrong format. Go back and try again');
         Page::AddAdmin();
     } elseif ($_POST['password'] != $_POST['password2']) {
         Page::message('attention', 'Passwords do not match');
         Page::AddAdmin();
     } else {
         if ($db->query_insert('User', array('username' => $_POST['username'], 'password' => md5($_POST['password']), 'email' => $_POST['email'], 'opentime' => $time->UtoM(time()), 'status' => 'Admin'))) {
             Page::message('success', 'Success! Installation completed. We recommend you to remove /install/ folder from the server');
         } else {
             Page::message('attention', 'Error! Installation not completed. Please, try again');
         }
         $config->set('IS_INSTALLED', 1);
         Page::Done();
     }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:31,代码来源:install.php


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