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


PHP TimeExpressionParser::getMonthList方法代码示例

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


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

示例1: Payment

 public function Payment()
 {
     if (!$this->opt_order->getPrimaryKey()) {
         $this->Edit();
         return;
     }
     $va_months = array();
     $o_tep = new TimeExpressionParser();
     foreach ($o_tep->getMonthList() as $vn_m => $vs_month) {
         $va_months[$vs_month] = $vn_m + 1;
     }
     $this->view->setVar('credit_card_exp_month_list', $va_months);
     $va_tmp = getDate();
     $vn_current_year = $va_tmp['year'];
     $vn_i = 0;
     $va_credit_card_exp_year_list = array();
     while ($vn_i < 8) {
         $va_credit_card_exp_year_list[$vn_current_year + $vn_i] = $vn_current_year + $vn_i;
         $vn_i++;
     }
     $this->view->setVar('credit_card_exp_year_list', $va_credit_card_exp_year_list);
     $this->render('order_payment_html.php');
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:23,代码来源:OrderEditorController.php

示例2: refine

 /**
  *
  */
 public function refine(&$pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options = null)
 {
     $o_log = isset($pa_options['log']) && is_object($pa_options['log']) ? $pa_options['log'] : null;
     $pm_value = $pa_source_data[$pa_item['source']];
     // not actually used
     $va_item_dest = explode(".", $pa_item['destination']);
     $vs_item_terminal = array_pop($va_item_dest);
     $vs_group_terminal = array_pop($va_item_dest);
     $o_tep = new TimeExpressionParser();
     $o_tep->setLanguage('en_US');
     switch ($vs_mode = $pa_item['settings']['dateJoiner_mode']) {
         default:
         case 'range':
             $vs_date_expression = $pa_item['settings']['dateJoiner_expression'];
             $vs_date_start = $pa_item['settings']['dateJoiner_start'];
             $vs_date_end = $pa_item['settings']['dateJoiner_end'];
             if ($vs_date_expression && ($vs_exp = BaseRefinery::parsePlaceholder($vs_date_expression, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 if ($o_tep->parse($vs_exp)) {
                     return $o_tep->getText();
                 } else {
                     if ($o_log) {
                         $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from range', $vs_exp));
                     }
                 }
             }
             $va_date = array();
             if ($vs_date_start = BaseRefinery::parsePlaceholder($vs_date_start, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' '))) {
                 if (!($vs_skip_start_exp = $pa_item['settings']['dateJoiner_skipStartIfExpression']) || !ExpressionParser::evaluate($vs_skip_start_exp, array_merge($pa_source_data, array('start' => $vs_date_start, 'end' => $vs_date_end, 'expression' => $ps_expression)))) {
                     $va_date[] = $vs_date_start;
                 } elseif ($vs_skip_start_replacement = $pa_item['settings']['dateJoiner_skipStartIfExpressionReplacementValue']) {
                     $va_date[] = $vs_skip_start_replacement;
                 }
             }
             if ($vs_date_end = BaseRefinery::parsePlaceholder($vs_date_end, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' '))) {
                 if (!($vs_skip_end_exp = $pa_item['settings']['dateJoiner_skipEndIfExpression']) || !ExpressionParser::evaluate($vs_skip_end_exp, array_merge($pa_source_data, array('start' => $vs_date_start, 'end' => $vs_date_end, 'expression' => $ps_expression)))) {
                     $va_date[] = $vs_date_end;
                 } elseif ($vs_skip_end_replacement = $pa_item['settings']['dateJoiner_skipEndIfExpressionReplacementValue']) {
                     $va_date[] = $vs_skip_end_replacement;
                 }
             }
             foreach ($va_date as $vn_i => $vs_date) {
                 $va_date[$vn_i] = preg_replace("![^\\d]+\$!", "", $vs_date);
             }
             $vs_date_expression = join(" - ", $va_date);
             if ($vs_date_expression && ($vs_exp = BaseRefinery::parsePlaceholder($vs_date_expression, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 if ($o_tep->parse($vs_exp)) {
                     return $o_tep->getText();
                 } else {
                     if ($o_log) {
                         $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from range', $vs_exp));
                     }
                 }
             }
             break;
         case 'multiColumnDate':
             $va_month_list = $o_tep->getMonthList();
             $va_date = array();
             if ($vs_date_month = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_month'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 if (($vn_m = array_search($vs_date_month, $va_month_list)) !== false) {
                     $vs_date_month = $vn_m + 1;
                 }
                 $va_date[] = $vs_date_month;
             }
             if ($vs_date_day = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_day'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 $va_date[] = $vs_date_day;
             }
             if ($vs_date_year = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_year'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 $va_date[] = $vs_date_year;
             }
             if (sizeof($va_date)) {
                 // TODO: this is assuming US-style dates for now
                 if ($o_tep->parse(join("/", $va_date))) {
                     return $o_tep->getText();
                 } else {
                     if ($o_log) {
                         $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from multiColumnDate', join("/", $va_date)));
                     }
                 }
             }
             break;
         case 'multiColumnRange':
             $va_dates = array();
             $va_month_list = $o_tep->getMonthList();
             // Process start date
             $va_date = array();
             if ($vs_date_month = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_startMonth'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 if (($vn_m = array_search($vs_date_month, $va_month_list)) !== false) {
                     $vs_date_month = $vn_m + 1;
                 }
                 $va_date[] = $vs_date_month;
             }
             if ($vs_date_day = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_startDay'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 $va_date[] = $vs_date_day;
             }
             if ($vs_date_year = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_startYear'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) {
                 $va_date[] = $vs_date_year;
             }
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:dateJoinerRefinery.php

示例3: ViewOrder

 /**
  * 
  */
 public function ViewOrder()
 {
     if (!$this->request->isLoggedIn()) {
         return;
     }
     $pn_order_id = $this->request->getParameter('order_id', pInteger);
     $t_order = new ca_commerce_orders($pn_order_id);
     if (!$t_order->userHasAccessToOrder($this->request->getUserID())) {
         $this->notification->addNotification(_t("Invalid order_id"), __NOTIFICATION_TYPE_ERROR__);
         $this->response->setRedirect(caNavUrl($this->request, '', 'Account', 'Index'), 302);
         return;
     } else {
         if (!in_array($t_order->get('order_status'), array('AWAITING_PAYMENT', 'PROCESSED', 'PROCESSED_AWAITING_DIGITIZATION', 'COMPLETED', 'REOPENED'))) {
             $this->notification->addNotification(_t("This order is not yet available for viewing"), __NOTIFICATION_TYPE_ERROR__);
             $this->response->setRedirect(caNavUrl($this->request, '', 'Account', 'Index'), 302);
             return;
         }
         $this->view->setVar('t_order', $t_order);
         $this->view->setVar('item_list', $t_order->getItems());
         if (!$t_order->getPrimaryKey()) {
             $this->notification->addNotification(_t("Invalid order_id"), __NOTIFICATION_TYPE_ERROR__);
             $this->response->setRedirect(caNavUrl($this->request, '', 'Account', 'Index'), 302);
             return;
         } else {
             $this->view->setVar('order_id', $t_order->getPrimaryKey());
         }
         $va_months = array();
         $o_tep = new TimeExpressionParser();
         foreach ($o_tep->getMonthList() as $vn_m => $vs_month) {
             $va_months[$vs_month] = $vn_m + 1;
         }
         $o_tep = new TimeExpressionParser();
         $this->view->setVar('credit_card_exp_month_list', $va_months);
         $va_tmp = getDate();
         $vn_current_year = $va_tmp['year'];
         $vn_i = 0;
         $va_credit_card_exp_year_list = array();
         while ($vn_i < 8) {
             $va_credit_card_exp_year_list[$vn_current_year + $vn_i] = $vn_current_year + $vn_i;
             $vn_i++;
         }
         $this->view->setVar('credit_card_exp_year_list', $va_credit_card_exp_year_list);
         # --- get any messages linked to this order
         $t_comm = new ca_commerce_communications();
         $this->view->setVar('messages', $t_comm->getMessages($this->request->getUserID(), array('transaction_id' => $t_order->get("transaction_id"))));
         $this->render('Account/view_order_html.php');
     }
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:51,代码来源:AccountController.php


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