$expired = strtotime($metaUser->objSubscription->expiration); $trial = strcmp($metaUser->objSubscription->status, 'Trial') === 0; if (!$trial) { $params = $metaUser->objSubscription->params; if (isset($params['trialflag'])) { $trial = 1; } } } $invoices = aecInvoiceHelper::InvoiceCountbyUserID($metaUser->userid); if ($invoices) { $invoice = aecInvoiceHelper::lastUnclearedInvoiceIDbyUserID($metaUser->userid); } else { $invoice = null; } $expiration = AECToolbox::formatDate($expired); $tmpl->setTitle(JText::_('EXPIRED_TITLE')); $continue = false; if ($tmpl->cfg['continue_button'] && $metaUser->hasSubscription) { $status = SubscriptionPlanHandler::PlanStatus($metaUser->focusSubscription->plan); if (!empty($status)) { $continue = true; } } $intro = 0; if ($metaUser->hasSubscription) { if ($metaUser->objSubscription->status == "Expired") { $intro = !$tmpl->cfg['intro_expired']; } } $tmpl->defaultHeader();
static function date($SQLDate, $check = false, $display = false, $trial = false) { if ($SQLDate == '') { return JText::_('AEC_EXPIRE_NOT_SET'); } else { $retVal = AECToolbox::formatDate($SQLDate); if ($check) { $timeDif = strtotime($SQLDate) - (int) gmdate('U'); if ($timeDif < 0) { $retVal = ($trial ? JText::_('AEC_EXPIRE_TRIAL_PAST') : JText::_('AEC_EXPIRE_PAST')) . ': <strong>' . $retVal . '</strong>'; } elseif ($timeDif >= 0 && $timeDif < 86400) { $retVal = $trial ? JText::_('AEC_EXPIRE_TRIAL_TODAY') : JText::_('AEC_EXPIRE_TODAY'); } else { $retVal = ($trial ? JText::_('AEC_EXPIRE_TRIAL_FUTURE') : JText::_('AEC_EXPIRE_FUTURE')) . ': ' . $retVal; } } return $retVal; } }
public function getPrintout($InvoiceFactory, $forcecleared = false, $forcecounter = null) { global $aecConfig; if (is_null($forcecounter)) { $this->counter = $forcecounter; } if ($this->transaction_date == '0000-00-00 00:00:00' && $forcecleared) { $this->transaction_date = date('Y-m-d H:i:s', (int) gmdate('U')); } $data = $this->getWorkingData($InvoiceFactory); $data['invoice_id'] = $this->id; $data['invoice_number'] = $this->invoice_number; $data['invoice_date'] = aecTemplate::date($InvoiceFactory->invoice->created_date); $data['itemlist'] = array(); foreach ($InvoiceFactory->items->itemlist as $iid => $item) { if (isset($item['obj'])) { $amt = $item['terms']->nextterm->cost[0]->cost['amount']; $data['itemlist'][] = '<tr id="invoice_content_item">' . '<td>' . $item['name'] . '</td>' . '<td>' . AECToolbox::formatAmount($amt, $InvoiceFactory->invoice->currency) . '</td>' . '<td>' . $item['quantity'] . '</td>' . '<td>' . AECToolbox::formatAmount($amt * $item['quantity'], $InvoiceFactory->invoice->currency) . '</td>' . '</tr>'; foreach ($item['terms']->nextterm->cost as $cid => $cost) { if ($cid != 0) { if ($cost->type == 'discount') { if (!empty($cost->cost['details'])) { $ta = ' (' . $cost->cost['details'] . ')'; } else { $ta = ""; } $data['itemlist'][] = '<tr id="invoice_content_item">' . '<td>' . JText::_('AEC_CHECKOUT_DISCOUNT') . $ta . '</td>' . '<td></td>' . '<td></td>' . '<td>' . AECToolbox::formatAmount($cost->cost['amount'], $InvoiceFactory->invoice->currency) . '</td>' . '</tr>'; } elseif ($cost->type == 'cost') { if (!empty($cost->cost['details'])) { $ta = ' (' . $cost->cost['details'] . ')'; } else { $ta = ""; } $data['itemlist'][] = '<tr id="invoice_content_item">' . '<td>' . $ta . '</td>' . '<td></td>' . '<td></td>' . '<td>' . AECToolbox::formatAmount($cost->cost['amount'], $InvoiceFactory->invoice->currency) . '</td>' . '</tr>'; } } } } } $data['totallist'][] = '<tr id="invoice_content_item_separator">' . '<td colspan="4"></td>' . '</tr>'; if (isset($InvoiceFactory->items->tax)) { if (isset($InvoiceFactory->items->total)) { $data['totallist'][] = '<tr id="invoice_content_item_total">' . '<td>' . JText::_('INVOICEPRINT_TOTAL') . '</td>' . '<td></td>' . '<td></td>' . '<td>' . AECToolbox::formatAmount($InvoiceFactory->items->total->cost['amount'], $InvoiceFactory->invoice->currency) . '</td>' . '</tr>'; } foreach ($InvoiceFactory->items->tax as $item) { $details = null; foreach ($item['terms']->terms[0]->cost as $citem) { if ($citem->type == 'tax') { $details = $citem->cost['details']; } } $data['totallist'][] = '<tr id="invoice_content_item_tax">' . '<td>Tax' . ' ( ' . $details . ' )' . '</td>' . '<td></td>' . '<td></td>' . '<td>' . AECToolbox::formatAmount($item['cost'], $InvoiceFactory->invoice->currency) . '</td>' . '</tr>'; } } if (isset($InvoiceFactory->items->grand_total)) { $data['totallist'][] = '<tr id="invoice_content_item_total">' . '<td>' . JText::_('INVOICEPRINT_GRAND_TOTAL') . '</td>' . '<td></td>' . '<td></td>' . '<td>' . AECToolbox::formatAmount($InvoiceFactory->items->grand_total->cost['amount'], $InvoiceFactory->invoice->currency) . '</td>' . '</tr>'; } if ($this->transaction_date == '0000-00-00 00:00:00') { if (!$this->active) { $data['paidstatus'] = JText::_('INVOICEPRINT_PAIDSTATUS_CANCEL'); } else { $data['paidstatus'] = JText::_('INVOICEPRINT_PAIDSTATUS_UNPAID'); } } else { if (!$this->active) { $data['paidstatus'] = JText::_('INVOICEPRINT_PAIDSTATUS_CANCEL'); } else { $date = AECToolbox::formatDate($this->transaction_date); $data['paidstatus'] = sprintf(JText::_('INVOICEPRINT_PAIDSTATUS_PAID'), $date); } } $pplist = array(); if ($this->method != 'none') { $pp = new PaymentProcessor(); if ($pp->loadName($this->method)) { $pp->init(); $pp->getInfo(); if (!empty($InvoiceFactory->plan->id)) { $pp->exchangeSettingsByPlan($InvoiceFactory->plan->id, $InvoiceFactory->plan->params); } } } else { $pp = null; } $pplist[$this->method] = $pp; $recurring = false; if (!empty($pp)) { $recurring = $pplist[$this->method]->is_recurring(); } $data['recurringstatus'] = ""; if ($recurring) { $data['recurringstatus'] = JText::_('INVOICEPRINT_RECURRINGSTATUS_RECURRING'); } elseif (!empty($InvoiceFactory->plan->id)) { if (!empty($InvoiceFactory->plan->params['trial_amount']) && $InvoiceFactory->plan->params['trial_period']) { $data['recurringstatus'] = JText::_('INVOICEPRINT_RECURRINGSTATUS_ONCE'); } } $data['invoice_billing_history'] = ""; if (!empty($this->transactions)) { if (count($this->transactions) > 0 && !empty($data['recurringstatus']) && $this->method != 'none') { $data['paidstatus'] = sprintf(JText::_('INVOICEPRINT_PAIDSTATUS_PAID'), ""); foreach ($this->transactions as $transaction) { if (!isset($pplist[$transaction->processor])) { $pp = new PaymentProcessor(); if ($pp->loadName($transaction->processor)) { $pp->getInfo(); $pplist[$transaction->processor] = $pp; } } $data['invoice_billing_history'] .= '<tr><td>' . AECToolbox::formatDate($transaction->timestamp) . '</td><td>' . $transaction->amount . ' ' . $transaction->currency . '</td><td>' . $pplist[$transaction->processor]->info['longname'] . '</td></tr>'; } } } $s = array("before_header", "header", "after_header", "address", "before_content", "after_content", "before_footer", "footer", "after_footer"); foreach ($s as $k) { if (empty($data[$k])) { $data[$k] = ""; } } return $data; }
"> <h4><?php echo $subscription->name; ?> </h4> <?php if ($showExpiration) { ?> <p> <?php if (empty($subscription->expiration) || $subscription->lifetime) { echo JText::_('ACCOUNT_UNLIMIT'); } elseif ($recurring) { echo JText::_('ACCOUNT_RENEWAL') . ": " . AECToolbox::formatDate(strtotime($subscription->expiration)); } else { echo JText::_('ACCOUNT_EXPIRES') . ": " . AECToolbox::formatDate(strtotime($subscription->expiration)); } ?> </p> <?php } ?> </div> <?php } } ?> <?php if ($displaypipeline) { $dph = new displayPipelineHandler();
public function armRewrite() { global $aecConfig; $this->rewrite = array(); $this->rewrite['system_timestamp'] = AECToolbox::formatDate((int) gmdate('U'), false, false); $this->rewrite['system_timestamp_backend'] = AECToolbox::formatDate((int) gmdate('U'), true, false); $this->rewrite['system_serverstamp_time'] = AECToolbox::formatDate((int) gmdate('U')); $this->rewrite['system_server_timestamp_backend'] = AECToolbox::formatDate((int) gmdate('U'), true); $this->rewrite['cms_absolute_path'] = JPATH_SITE; $this->rewrite['cms_live_site'] = JURI::root(); if (empty($this->data['invoice'])) { $this->data['invoice'] = null; } if (!empty($this->data['metaUser'])) { if (is_object($this->data['metaUser'])) { if (isset($this->data['metaUser']->cmsUser->id)) { $this->rewrite['user_id'] = $this->data['metaUser']->cmsUser->id; } else { $this->rewrite['user_id'] = 0; } if (!empty($this->data['metaUser']->cmsUser->username)) { $this->rewrite['user_username'] = $this->data['metaUser']->cmsUser->username; } else { $this->rewrite['user_username'] = ""; } if (!empty($this->data['metaUser']->cmsUser->name)) { $this->rewrite['user_name'] = $this->data['metaUser']->cmsUser->name; } else { $this->rewrite['user_name'] = ""; } $name = $this->data['metaUser']->explodeName(); $this->rewrite['user_first_name'] = $name['first']; $this->rewrite['user_first_first_name'] = $name['first_first']; $this->rewrite['user_last_name'] = $name['last']; if (!empty($this->data['metaUser']->cmsUser->email)) { $this->rewrite['user_email'] = $this->data['metaUser']->cmsUser->email; } else { $this->rewrite['user_name'] = ""; } if (defined('JPATH_MANIFESTS')) { if (empty($this->data['metaUser']->hasJProfile)) { $this->data['metaUser']->loadJProfile(); } if (!empty($this->data['metaUser']->hasJProfile)) { foreach ($this->data['metaUser']->jProfile as $field => $value) { $this->rewrite['user_' . $field] = $value; } } } if (aecComponentHelper::detect_component('JOMSOCIAL')) { if (!$this->data['metaUser']->hasJSprofile) { $this->data['metaUser']->loadJSuser(); } if (!empty($this->data['metaUser']->hasJSprofile)) { foreach ($this->data['metaUser']->jsUser as $k => $v) { $this->rewrite['user_js_' . $k] = $v; } } } if (aecComponentHelper::detect_component('anyCB')) { if (!$this->data['metaUser']->hasCBprofile) { $this->data['metaUser']->loadCBuser(); } if (!empty($this->data['metaUser']->hasCBprofile)) { $fields = get_object_vars($this->data['metaUser']->cbUser); if (!empty($fields)) { foreach ($fields as $fieldname => $fieldcontents) { $this->rewrite['user_' . $fieldname] = $fieldcontents; } } if (isset($this->data['metaUser']->cbUser->cbactivation)) { $this->rewrite['user_activationcode'] = $this->data['metaUser']->cbUser->cbactivation; $this->rewrite['user_activationlink'] = JURI::root() . "index.php?option=com_comprofiler&task=confirm&confirmcode=" . $this->data['metaUser']->cbUser->cbactivation; } else { $this->rewrite['user_activationcode'] = ""; $this->rewrite['user_activationlink'] = ""; } } else { if (isset($this->data['metaUser']->cmsUser->activation)) { $this->rewrite['user_activationcode'] = $this->data['metaUser']->cmsUser->activation; $v = new JVersion(); if ($v->isCompatible('1.6')) { $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_users&task=registration.activate&token=' . $this->data['metaUser']->cmsUser->activation; } else { $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_user&task=activate&activation=' . $this->data['metaUser']->cmsUser->activation; } } else { $this->rewrite['user_activationcode'] = ""; $this->rewrite['user_activationlink'] = ""; } } } else { if (isset($this->data['metaUser']->cmsUser->activation)) { $this->rewrite['user_activationcode'] = $this->data['metaUser']->cmsUser->activation; $v = new JVersion(); if ($v->isCompatible('1.6')) { $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_users&task=registration.activate&token=' . $this->data['metaUser']->cmsUser->activation; } else { $this->rewrite['user_activationlink'] = JURI::root() . 'index.php?option=com_user&task=activate&activation=' . $this->data['metaUser']->cmsUser->activation; } } } if (!empty($this->data['metaUser']->meta->custom_params)) { foreach ($this->data['metaUser']->meta->custom_params as $k => $v) { if (is_array($v)) { foreach ($v as $xk => $xv) { if (is_array($xv)) { foreach ($xv as $xyk => $xyv) { $this->rewrite['user_' . $k . '_' . $xk . '_' . $xyk] = $xyv; } } else { $this->rewrite['user_' . $k . '_' . $xk] = $xv; } } } else { $this->rewrite['user_' . $k] = $v; } } } if ($this->data['metaUser']->hasSubscription) { $this->rewrite['subscription_id'] = $this->data['metaUser']->focusSubscription->id; $this->rewrite['subscription_type'] = $this->data['metaUser']->focusSubscription->type; $this->rewrite['subscription_status'] = $this->data['metaUser']->focusSubscription->status; $this->rewrite['subscription_signup_date'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->signup_date); $this->rewrite['subscription_signup_date_backend'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->signup_date, true); $this->rewrite['subscription_lastpay_date'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->lastpay_date); $this->rewrite['subscription_lastpay_date_backend'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->lastpay_date, true); $this->rewrite['subscription_plan'] = $this->data['metaUser']->focusSubscription->plan; if (!empty($this->data['metaUser']->focusSubscription->previous_plan)) { $this->rewrite['subscription_previous_plan'] = $this->data['metaUser']->focusSubscription->previous_plan; } else { $this->rewrite['subscription_previous_plan'] = ""; } $this->rewrite['subscription_recurring'] = $this->data['metaUser']->focusSubscription->recurring; $this->rewrite['subscription_lifetime'] = $this->data['metaUser']->focusSubscription->lifetime; $this->rewrite['subscription_expiration_date'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->expiration); $this->rewrite['subscription_expiration_date_backend'] = AECToolbox::formatDate($this->data['metaUser']->focusSubscription->expiration, true); $this->rewrite['subscription_expiration_daysleft'] = round((strtotime($this->data['metaUser']->focusSubscription->expiration) - (int) gmdate('U')) / 86400); if (!empty($this->data['metaUser']->focusSubscription->customparams['notes'])) { $this->rewrite['subscription_notes'] = $this->data['metaUser']->focusSubscription->customparams['notes']; } else { $this->rewrite['subscription_notes'] = ''; } } if (empty($this->data['invoice']) && !empty($this->data['metaUser']->cmsUser->id)) { $lastinvoice = aecInvoiceHelper::lastClearedInvoiceIDbyUserID($this->data['metaUser']->cmsUser->id); $this->data['invoice'] = new Invoice(); $this->data['invoice']->load($lastinvoice); } } } if (is_object($this->data['invoice'])) { if (!empty($this->data['invoice']->id)) { $this->rewrite['invoice_id'] = $this->data['invoice']->id; $this->rewrite['invoice_number'] = $this->data['invoice']->invoice_number; $this->rewrite['invoice_created_date'] = $this->data['invoice']->created_date; $this->rewrite['invoice_transaction_date'] = $this->data['invoice']->transaction_date; $this->rewrite['invoice_method'] = $this->data['invoice']->method; $this->rewrite['invoice_amount'] = $this->data['invoice']->amount; $this->rewrite['invoice_currency'] = $this->data['invoice']->currency; if (!empty($this->data['invoice']->coupons) && is_array($this->data['invoice']->coupons)) { $this->rewrite['invoice_coupons'] = implode(';', $this->data['invoice']->coupons); } else { $this->rewrite['invoice_coupons'] = ''; } if (!empty($this->data['metaUser']) && !empty($this->data['invoice'])) { if (!empty($this->data['invoice']->id)) { $this->data['invoice']->formatInvoiceNumber(); $this->rewrite['invoice_number_format'] = $this->data['invoice']->invoice_number; $this->data['invoice']->deformatInvoiceNumber(); } } } } if (!empty($this->data['plan'])) { if (is_object($this->data['plan'])) { $this->rewrite['plan_name'] = $this->data['plan']->getProperty('name'); $this->rewrite['plan_desc'] = $this->data['plan']->getProperty('desc'); if (!empty($this->data['plan']->params['notes'])) { $this->rewrite['plan_notes'] = $this->data['plan']->params['notes']; } else { $this->rewrite['plan_notes'] = ''; } } } }
/** * Formats a given date * * @param string $SQLDate * @return string formatted date */ static function DisplayDateInLocalTime($SQLDate) { if ($SQLDate == '' || $SQLDate == '-' || $SQLDate == '0000-00-00 00:00:00') { return JText::_('AEC_CMN_NOT_SET'); } else { return AECToolbox::formatDate($SQLDate, true); } }