本文整理汇总了PHP中amDate函数的典型用法代码示例。如果您正苦于以下问题:PHP amDate函数的具体用法?PHP amDate怎么用?PHP amDate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了amDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _format
public function _format($d)
{
if (trim($d) == '') {
return '';
}
switch ($this->format) {
case self::DATE:
return amDate($d);
case self::TIME:
return amTime($d);
default:
return amDatetime($d);
}
}
示例2: _format
public function _format($d)
{
if (trim($d) == '') {
return '';
}
if ($d == Am_Period::MAX_SQL_DATE) {
return ___('Lifetime');
}
switch ($this->format) {
case self::DATE:
return amDate($d);
case self::TIME:
return amTime($d);
default:
return amDatetime($d);
}
}
示例3: init
function init()
{
$this->addElement('text', 'root_url', array('size' => 40))->setLabel(___("Root URL\nroot script URL, usually %s", '<i>http://www.yoursite.com/amember</i>'))->addRule('callback2', '-error-must-be-returned-', array($this, 'validateRootUrl'));
$this->addElement('text', 'root_surl', array('size' => 40))->setLabel(___("Secure Root URL\nsecure URL, usually %s", '<i>http<b>s</b>://www.yoursite.com/amember</i>'))->addRule('callback2', '-error-must-be-returned-', array($this, 'validateRootUrl'));
if ('==TRIAL==' == '==' . 'TRIAL==') {
$license = Am_Di::getInstance()->config->get('license');
$this->addElement('textarea', 'license', array('style' => 'width:95%', 'rows' => count(explode("\n", $license)) + 1))->setLabel(___("License Key"))->addRule('required')->addRule('notregex', ___('You have license keys from past versions of aMember, please replace it with latest, one-line keys'), '/====\\s+LICENSE/')->addRule('callback', ___('Valid license key are one-line string,starts with L and ends with X'), array($this, 'validateKeys'));
if ($domains = Am_License::getInstance()->getDomains()) {
$cnt = '<i>' . implode(",", Am_License::getInstance()->getDomains()) . '</i> ';
$cnt .= ___("expires") . ' ';
$cnt .= amDate(Am_License::getInstance()->getExpires());
} else {
$cnt = "No License Configured";
}
} else {
$cnt = "Using TRIAL Version - expires ==TRIAL_EXPIRES==";
}
$this->addElement('static')->setLabel(___('Configured License Keys'))->setContent($cnt);
parent::init();
$this->addSaveButton(___('Update License Information'));
}
示例4: resendPaymentLinkAction
public function resendPaymentLinkAction()
{
$this->getDi()->authAdmin->getUser()->checkPermission('grid_invoice', 'edit');
$invoice = $this->getDi()->invoiceTable->load($this->getParam('invoice_id'));
$form = new Am_Form_Admin('add-invoice');
$tm_due = $form->addDate('tm_due')->setLabel(___('Due Date'));
$tm_due->setValue($invoice->due_date < sqlDate('now') ? sqlDate('+7 days') : $invoice->due_date);
$message = $form->addTextarea('message', array('class' => 'el-wide'))->setLabel(___("Message\n" . 'will be included to email to user'));
$form->addElement('email_link', 'invoice_pay_link')->setLabel(___('Email Template with Payment Link'));
$form->setDataSources(array($this->getRequest()));
if ($form->isSubmitted() && $form->validate()) {
$vars = $form->getValue();
$invoice->due_date = $vars['tm_due'];
$invoice->save();
$et = Am_Mail_Template::load('invoice_pay_link', $invoice->getUser()->lang ? $invoice->getUser()->lang : null);
$et->setUser($invoice->getUser());
$et->setUrl(ROOT_SURL . sprintf('/pay/%s', $invoice->getSecureId('payment-link')));
$et->setMessage($vars['message']);
$et->setInvoice($invoice);
$et->setInvoice_text($invoice->render());
$et->send($invoice->getUser());
Am_Controller::ajaxResponse(array('ok' => true, 'msg' => ___('Invoice link has been sent to user again'), 'invoice_id' => $invoice->pk(), 'due_date_html' => amDate($invoice->due_date)));
} else {
echo $form;
}
}
示例5: formatPeriod
public function formatPeriod(Am_Period $period, $format = "%s", $skip_one_c = false)
{
switch ($period->getUnit()) {
case 'd':
$uu = $period->getCount() == 1 ? ___('day') : ___('days');
break;
case 'm':
$uu = $period->getCount() == 1 ? ___('month') : ___('months');
break;
case 'y':
$uu = $period->getCount() == 1 ? ___('year') : ___('years');
break;
case Am_Period::FIXED:
if ($period->getCount() == Am_Period::MAX_SQL_DATE) {
return " for lifetime";
}
return " up to " . amDate($period->getCount());
}
$cc = $period->getCount();
if ($period->getCount() == 1) {
$cc = $skip_one_c ? '' : 'one';
}
return sprintf($format, "{$cc} {$uu}");
}
示例6: renderAccess
public function renderAccess($page, $pointer)
{
$invoice = $this->invoice;
//if user is not approved there is no access records
$accessrecords = $invoice->getAccessRecords();
if (!$accessrecords) {
return $pointer;
}
$payment = $this->payment;
$padd = 20;
$width_date = 120;
$fontH = $this->getFontRegular();
$fontHB = $this->getFontBold();
$table = new Am_Pdf_Table();
$table->setMargin($padd, $padd, $padd, $padd);
$table->setStyleForRow(1, array('shape' => array('type' => Zend_Pdf_Page::SHAPE_DRAW_STROKE, 'color' => new Zend_Pdf_Color_Html("#cccccc")), 'font' => array('face' => $fontHB, 'size' => 10)));
$table->setStyleForColumn(2, array('width' => $width_date));
$table->setStyleForColumn(3, array('width' => $width_date));
$table->addRow(array(___('Subscription/Product Title'), ___('Begin'), ___('Expire')));
$get_product_ids = create_function('$access', 'return $access->product_id;');
$productOptions = $this->getDi()->productTable->getProductTitles(array_map($get_product_ids, $accessrecords));
foreach ($accessrecords as $a) {
/* @var $a Access */
if ($a->invoice_payment_id != $payment->pk()) {
continue;
}
$table->addRow(array($productOptions[$a->product_id], amDate($a->begin_date), $a->expire_date == Am_Period::MAX_SQL_DATE ? ___('Lifetime') : amDate($a->expire_date)));
}
$pointer = $page->drawTable($table, 0, $pointer);
return $pointer;
}
示例7: renderTitle
function renderTitle($noTags = false)
{
if ($noTags) {
return $this->title;
}
$total = $this->getDataSource()->getFoundRows();
$page = $this->getCurrentPage();
$count = $this->getCountPerPage();
$ret = "";
$ret .= '<h1>';
$ret .= Am_Controller::escape($this->title);
$msgs = array();
if ($total) {
$msgs[] = ___("displaying records %d-%d from %d", $page * $count + 1, min($total, ($page + 1) * $count), $total);
} else {
$msgs[] = ___("no records");
}
if ($this->filter && $this->filter->isFiltered()) {
$override = array();
$dates = $this->filter->getDates();
$msgs[] = sprintf("%s %s - %s", ___('period'), amDate($dates[0]), amDate($dates[1]));
}
if ($msgs) {
$ret .= ' (' . implode(", ", $msgs) . ')';
}
$ret .= "</h1>";
return $ret;
}
示例8: formatDate
protected function formatDate($tm)
{
return amDate($tm);
}
示例9: renderPayout
public function renderPayout(Am_Record $record, $f, $g)
{
$out = $record->payout_detail_id ? sprintf('<a href="%s" class="link" target="_top">%s</a>', $this->escape(REL_ROOT_URL . '/aff/admin-payout/view?payout_id=' . $record->payout_id), amDate($record->payout_date)) : '–';
return $g->renderTd($out, false);
}
示例10: render
public function render()
{
$invoice = $this->invoice;
$payment = $this->payment;
$user = $invoice->getUser();
$pdf = $this->createPdfTemplate();
$event = new Am_Event(Am_Event::PDF_INVOICE_BEFORE_RENDER, array('amPdfInvoice' => $this, 'pdf' => $pdf, 'invoice' => $invoice, 'payment' => $payment, 'user' => $user));
$event->setReturn(false);
$this->getDi()->hook->call($event);
// If event processing already rendered the Pdf.
if ($event->getReturn() === true) {
return $pdf->render();
}
$width_num = 30;
$width_qty = 40;
$width_price = 80;
$width_total = 120;
$padd = 20;
$left = $padd;
$right = $this->getPaperWidth() - $padd;
$fontH = $this->getFontRegular();
$fontHB = $this->getFontBold();
$styleBold = array('font' => array('face' => $fontHB, 'size' => 10));
$page = new Am_Pdf_Page_Decorator($pdf->pages[0]);
$page->setFont($fontH, 10);
$pointer = $this->getPointer();
$pointerL = $pointerR = $pointer;
$leftCol = new stdClass();
$leftCol->invoiceNumber = ___('Corrective Invoice Number: ') . $payment->getDisplayInvoiceId();
$leftCol->recInvoiceNumber = ___('Rectifies Invoice Number: ') . $this->getOrigPayment()->getDisplayInvoiceId();
$leftCol->date = ___('Date: ') . amDate($payment->dattm);
if ($user->tax_id) {
$leftCol->taxId = ___('EU VAT ID: ') . $user->tax_id;
}
$this->getDi()->hook->call(Am_Event::PDF_INVOICE_COL_LEFT, array('col' => $leftCol, 'invoice' => $invoice, 'payment' => $payment, 'user' => $user));
foreach ($leftCol as $line) {
$page->drawText($line, $left, $pointerL);
$page->nl($pointerL);
}
$rightCol = new stdClass();
$rightCol->name = $invoice->getName();
$rightCol->email = $invoice->getEmail();
$rightCol->address = implode(', ', array_filter(array($invoice->getStreet(), $invoice->getCity())));
$rightCol->country = implode(', ', array_filter(array($this->getState($invoice), $invoice->getZip(), $this->getCountry($invoice))));
$this->getDi()->hook->call(Am_Event::PDF_INVOICE_COL_RIGHT, array('col' => $rightCol, 'invoice' => $invoice, 'payment' => $payment, 'user' => $user));
foreach ($rightCol as $line) {
$page->drawText($line, $right, $pointerR, 'UTF-8', Am_Pdf_Page_Decorator::ALIGN_RIGHT);
$page->nl($pointerR);
}
$pointer = min($pointerR, $pointerL);
$p = new stdClass();
$p->value =& $pointer;
$this->getDi()->hook->call(Am_Event::PDF_INVOICE_BEFORE_TABLE, array('page' => $page, 'pointer' => $p, 'invoice' => $invoice, 'payment' => $payment, 'user' => $user));
$table = new Am_Pdf_Table();
$table->setMargin($padd, $padd, $padd, $padd);
$table->setStyleForRow(1, array('shape' => array('type' => Zend_Pdf_Page::SHAPE_DRAW_STROKE, 'color' => new Zend_Pdf_Color_Html("#cccccc")), 'font' => array('face' => $fontHB, 'size' => 10)));
$table->setStyleForColumn(1, array('align' => 'right', 'width' => $width_num));
$table->setStyleForColumn(3, array('align' => 'right', 'width' => $width_qty));
$table->setStyleForColumn(4, array('align' => 'right', 'width' => $width_price));
$table->setStyleForColumn(5, array('align' => 'right', 'width' => $width_total));
$table->addRow(array(___('#'), ___('Subscription/Product Title'), ___('Qty'), ___('Unit Price'), ___('Total Price')));
$num = 0;
foreach ($invoice->getItems() as $p) {
/* @var $p InvoiceItem */
$table->addRow(array(++$num . '.', $p->item_title, $p->qty, $invoice->getCurrency($this->isFirstPayment() ? $p->first_price : $p->second_price), $invoice->getCurrency($this->isFirstPayment() ? $p->getFirstSubtotal() : $p->getSecondSubtotal())));
}
$pointer = $page->drawTable($table, 0, $pointer);
$table = new Am_Pdf_Table();
$table->setMargin($padd, $padd, $padd, $padd);
$table->setStyleForColumn(2, array('align' => 'right', 'width' => $width_total));
$subtotal = $this->isFirstPayment() ? $invoice->first_subtotal : $invoice->second_subtotal;
$total = $this->isFirstPayment() ? $invoice->first_total : $invoice->second_total;
if ($subtotal != $total) {
$table->addRow(array(___('Subtotal'), $invoice->getCurrency($subtotal)))->addStyle($styleBold);
}
if ($this->isFirstPayment() && $invoice->first_discount > 0 || !$this->isFirstPayment() && $invoice->second_discount > 0) {
$table->addRow(array(___('Coupon Discount'), $invoice->getCurrency($this->isFirstPayment() ? $invoice->first_discount : $invoice->second_discount)));
}
$table->addRow(array(___('Total'), $invoice->getCurrency($total)))->addStyle($styleBold);
$table->addRow(array(___('Taxable Income'), "-" . $invoice->getCurrency($this->getOrigPayment()->amount - $this->getOrigPayment()->tax)))->addStyle($styleBold);
if ($this->getOrigPayment()->tax > 0) {
$table->addRow(array(___('Tax') . " " . $invoice->tax_rate . "%", "-" . $invoice->getCurrency($this->getOrigPayment()->tax)))->addStyle($styleBold);
}
$table->addRow(array(___('Amount Paid'), $invoice->getCurrency(sprintf("%.2f", $this->getOrigPayment()->amount - $this->payment->amount))))->addStyle(array('font' => array('face' => $fontHB, 'size' => 10)));
$x = $this->getPaperWidth() - ($width_qty + $width_price + $width_total) - 2 * $padd;
$pointer = $page->drawTable($table, $x, $pointer);
$page->nl($pointer);
$page->nl($pointer);
if (!$this->getDi()->config->get('invoice_do_not_include_terms')) {
$termsText = new Am_TermsText($invoice);
$page->drawTextWithFixedWidth(___('Subscription Terms') . ': ' . $termsText, $left, $pointer, $this->getPaperWidth() - 2 * $padd);
$page->nl($pointer);
}
$p = new stdClass();
$p->value =& $pointer;
$this->getDi()->hook->call(Am_Event::PDF_INVOICE_AFTER_TABLE, array('page' => $page, 'pointer' => $p, 'invoice' => $invoice, 'payment' => $payment, 'user' => $user));
if (!$this->getDi()->config->get('invoice_custom_template') || !$this->getDi()->uploadTable->load($this->getDi()->config->get('invoice_custom_template'))) {
if ($ifn = $this->getDi()->config->get('invoice_footer_note')) {
$tmpl = new Am_SimpleTemplate();
$tmpl->assignStdVars();
//.........这里部分代码省略.........
示例11: render
function render($indent = "", InvoicePayment $payment = null)
{
$prefix = !is_null($payment) && !$payment->isFirst() ? 'second' : 'first';
$tm_added = is_null($payment) ? $this->tm_added : $payment->dattm;
$newline = "\r\n";
$price_width = max(mb_strlen(Am_Currency::render($this->{$prefix . '_total'}, $this->currency)), 8);
$column_padding = 1;
$column_title_max = 60;
$column_title_min = 20;
$column_qty = 4 + $price_width;
$column_num = 3;
$column_amount = $price_width;
$space = str_repeat(' ', $column_padding);
$max_length = 0;
foreach ($this->getItems() as $item) {
$max_length = max(mb_strlen(___($item->item_title)), $max_length);
}
$column_title = max(min($max_length, $column_title_max), $column_title_min);
$row_width = $column_num + $column_padding + $column_title + $column_padding + $column_qty + $column_padding + $column_amount + $column_padding;
$column_total = $column_title + $column_qty + $column_padding;
$total_space = str_repeat(' ', $column_padding + $column_num + $column_padding);
$border = $indent . str_repeat('-', $row_width) . "{$newline}";
$out = $indent . ___("Invoice") . ' #' . $this->public_id . " / " . amDate($tm_added) . "{$newline}";
$out .= $border;
$num = 1;
foreach ($this->getItems() as $item) {
$title = explode("\n", $this->wordWrap(___($item->item_title), $column_title, "\n", true));
$out .= $indent . sprintf("{$space}%{$column_num}s{$space}%-{$column_title}s{$space}%{$column_qty}s{$space}%{$price_width}s{$newline}", $num . '.', $title[0], $item->qty . 'x' . Am_Currency::render($item->{$prefix . '_price'}, $this->currency), Am_Currency::render($item->{$prefix . '_total'}, $this->currency));
for ($i = 1; $i < count($title); $i++) {
$out .= $indent . sprintf("{$space}%{$column_num}s{$space}%-{$column_title}s{$newline}", ' ', $title[$i]);
}
$num++;
}
$out .= $border;
if ($this->{$prefix . '_subtotal'} != $this->{$prefix . '_total'}) {
$out .= $indent . sprintf("{$total_space}%-{$column_total}s{$space}%{$price_width}s{$newline}", ___('Subtotal'), Am_Currency::render($this->{$prefix . '_subtotal'}, $this->currency));
}
if ($this->{$prefix . '_discount'} > 0) {
$out .= $indent . sprintf("{$total_space}%-{$column_total}s{$space}%{$price_width}s{$newline}", ___('Discount'), Am_Currency::render($this->{$prefix . '_discount'}, $this->currency));
}
if ($this->{$prefix . '_shipping'} > 0) {
$out .= $indent . sprintf("{$total_space}%-{$column_total}s{$space}%{$price_width}s{$newline}", ___('Shipping'), Am_Currency::render($this->{$prefix . '_shipping'}, $this->currency));
}
if ($this->{$prefix . '_tax'} > 0) {
$out .= $indent . sprintf("{$total_space}%-{$column_total}s{$space}%{$price_width}s{$newline}", ___('Tax') . sprintf(' (%d%s)', $this->tax_rate, '%'), Am_Currency::render($this->{$prefix . '_tax'}, $this->currency));
}
$out .= $indent . sprintf("{$total_space}%-{$column_total}s{$space}%{$price_width}s{$newline}", ___('Total'), Am_Currency::render($this->{$prefix . '_total'}, $this->currency));
$out .= $border;
if ($this->rebill_times) {
$terms = explode("\n", $this->wordWrap(___($this->getTerms()), $row_width, "\n", true));
foreach ($terms as $term_part) {
$out .= $indent . $term_part . $newline;
}
$out .= $border;
}
return $out;
}
示例12: render
function render(&$out, $obj, $controller)
{
$field = $this->f;
$val = $field->valueFromTable($out);
switch ($field->getType()) {
case 'date':
$res = amDate($val);
break;
case 'select':
case 'radio':
case 'checkbox':
case 'multi_select':
$val = (array) $val;
foreach ($val as $k => $v) {
$val[$k] = @$field->options[$v];
}
$res = implode(", ", $val);
break;
default:
$res = $val;
}
$out = $controller->renderTd($res);
}
示例13: getRecordTitle
public function getRecordTitle(CouponBatch $batch = null)
{
return $batch ? sprintf('%s (#%d - %s)', ___('Coupon Batch'), $batch->pk(), $batch->comment ? $batch->comment : $batch->discount . ($batch->discount_type == 'percent' ? '%' : '$') . ($batch->begin_date ? ', ' . amDate($batch->begin_date) . '-' . amDate($batch->expire_date) : '')) : ___('Coupon Batch');
}
示例14: export
public function export(AffPayout $payout, Am_Query $details, Zend_Controller_Response_Http $response)
{
$q = $details->query();
while ($d = $payout->getDi()->db->fetchRow($q)) {
$d = $payout->getDi()->affPayoutDetailTable->createRecord($d);
/* @var $d AffPayoutDetail */
$aff = $d->getAff();
$rows[] = array($aff->data()->get('aff_bitcoin_wallet'), moneyRound($d->amount), Am_Currency::getDefault(), $aff->user_id, "Affiliate commission to " . amDate($payout->thresehold_date));
}
$this->sendCsv("bitcoint-commission-" . $payout->payout_id . ".txt", $rows, $response);
}
示例15: sendCronExpires
public function sendCronExpires()
{
$mails = $this->findBy(array('name' => EmailTemplate::EXPIRE));
if (!$mails) {
return;
}
// nothing to send
$byDate = array();
// templates by expiration date
foreach ($mails as $et) {
$et->_productIds = $et->findMatchingProductIds();
///
$day = -$et->day;
$string = $day . ' days';
if ($day >= 0) {
$string = "+{$string}";
}
if ($day == 0) {
$string = 'today';
}
$date = date('Y-m-d', strtotime($string, $this->getDi()->time));
$byDate[$date][] = $et;
}
$userTable = $this->getDi()->userTable;
// now query expirations
$q = $this->getDi()->accessTable->queryExpirations(array_keys($byDate));
$sent = array();
// user_id => array('tpl_id')
while ($row = $this->_db->fetchRow($q)) {
$user = $userTable->createRecord($row);
if ($user->unsubscribed || !$user->is_approved) {
continue;
}
foreach ($byDate[$row['_expire_date']] as $et) {
// do not send same template agian to the same user
if (!empty($sent[$user->user_id]) && array_search($et->pk(), $sent[$user->user_id]) !== false) {
continue;
}
if ($et->_productIds == ResourceAccess::ANY_PRODUCT || in_array($row['_product_id'], $et->_productIds)) {
// check if no matching not_conditions
if (!$et->checkNotConditions($user)) {
continue;
}
$recipients = array();
if ($et->recipient_user) {
$recipients[] = $user;
}
if ($et->recipient_aff && $user->aff_id && ($aff = $this->getDi()->userTable->load($user->aff_id, false))) {
$recipients[] = $aff;
}
if ($et->recipient_admin) {
$recipients[] = Am_Mail_Template::TO_ADMIN;
}
if ($et->recipient_emails) {
foreach (array_map('trim', explode(',', $et->recipient_emails)) as $email) {
if ($email) {
$recipients[] = $email;
}
}
}
foreach ($recipients as $recipient) {
$tpl = Am_Mail_Template::createFromEmailTemplate($et);
$tpl->setUser($user);
$tpl->setExpires(amDate($row['_expire_date']));
$tpl->setProduct_title($this->getDi()->productTable->load($row['_product_id'])->title);
$tpl->send($recipient);
}
$sent[$user->user_id][] = $et->pk();
}
}
}
}