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


PHP CRM_Utils_Date::format方法代码示例

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


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

示例1: getContributionParams

 /**
  * Set the parameters to be passed to contribution create function
  *
  * @param array $params
  * @param integer $contactID
  * @param $financialTypeID
  * @param $online
  * @param $contributionPageId
  * @param $nonDeductibleAmount
  * @param $campaignId
  *
  * @param $isMonetary
  *
  * @param $pending
  * @param $paymentProcessorOutcome
  * @param $receiptDate
  *
  * @param $recurringContributionID
  * @param $isTest
  *
  * @param $addressID
  *
  * @param $softCreditToID
  *
  * @param $lineItems
  *
  * @internal param $financialType
  * @return array
  */
 public static function getContributionParams($params, $contactID, $financialTypeID, $online, $contributionPageId, $nonDeductibleAmount, $campaignId, $isMonetary, $pending, $paymentProcessorOutcome, $receiptDate, $recurringContributionID, $isTest, $addressID, $softCreditToID, $lineItems)
 {
     $contributionParams = array('contact_id' => $contactID, 'financial_type_id' => $financialTypeID, 'contribution_page_id' => $contributionPageId, 'receive_date' => CRM_Utils_Array::value('receive_date', $params) ? CRM_Utils_Date::processDate($params['receive_date']) : date('YmdHis'), 'non_deductible_amount' => $nonDeductibleAmount, 'total_amount' => $params['amount'], 'amount_level' => CRM_Utils_Array::value('amount_level', $params), 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], 'source' => !$online || !empty($params['source']) ? CRM_Utils_Array::value('source', $params) : CRM_Utils_Array::value('description', $params), 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), 'cancel_reason' => CRM_Utils_Array::value('cancel_reason', $params, 0), 'cancel_date' => isset($params['cancel_date']) ? CRM_Utils_Date::format($params['cancel_date']) : NULL, 'thankyou_date' => isset($params['thankyou_date']) ? CRM_Utils_Date::format($params['thankyou_date']) : NULL, 'campaign_id' => $campaignId, 'is_test' => $isTest, 'address_id' => $addressID, 'soft_credit_to' => $softCreditToID, 'line_item' => $lineItems, 'skipLineItem' => CRM_Utils_Array::value('skipLineItem', $params, 0));
     if (!$online && isset($params['thankyou_date'])) {
         $contributionParam['thankyou_date'] = $params['thankyou_date'];
     }
     if (!$online || $isMonetary) {
         if (empty($params['is_pay_later'])) {
             $contributionParams['payment_instrument_id'] = 1;
         }
     }
     if (!$pending && $paymentProcessorOutcome) {
         $contributionParams += array('fee_amount' => CRM_Utils_Array::value('fee_amount', $paymentProcessorOutcome), 'net_amount' => CRM_Utils_Array::value('net_amount', $paymentProcessorOutcome, $params['amount']), 'trxn_id' => $paymentProcessorOutcome['trxn_id'], 'receipt_date' => $receiptDate, 'trxn_result_code' => CRM_Utils_Array::value('trxn_result_code', $paymentProcessorOutcome), 'payment_processor' => CRM_Utils_Array::value('payment_processor', $paymentProcessorOutcome));
     }
     // CRM-4038: for non-en_US locales, CRM_Contribute_BAO_Contribution::add() expects localised amounts
     $contributionParams['non_deductible_amount'] = trim(CRM_Utils_Money::format($contributionParams['non_deductible_amount'], ' '));
     $contributionParams['total_amount'] = trim(CRM_Utils_Money::format($contributionParams['total_amount'], ' '));
     if ($recurringContributionID) {
         $contributionParams['contribution_recur_id'] = $recurringContributionID;
     }
     $contributionParams['contribution_status_id'] = $pending ? 2 : 1;
     if (isset($contributionParams['invoice_id'])) {
         $contributionParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionParams['invoice_id'], 'id', 'invoice_id');
     }
     return $contributionParams;
 }
开发者ID:ruchirapingale,项目名称:civicrm-core,代码行数:55,代码来源:Confirm.php

示例2: array

 /**
  * Form rule to validate the date selector and/or if we should deliver
  * immediately.
  *
  * Warning: if you make changes here, be sure to also make them in
  * Retry.php
  * 
  * @param array $params     The form values
  * @return boolean          True if either we deliver immediately, or the
  *                          date is properly set.
  * @static
  */
 function &formRule(&$params)
 {
     if ($params['now']) {
         return true;
     }
     if (!CRM_Utils_Rule::qfDate($params['start_date'])) {
         return array('start_date' => ts('Start date is not valid.'));
     }
     if (CRM_Utils_Date::format($params['start_date']) < date('YmdHi00')) {
         return array('start_date' => ts('Start date cannot be earlier than the current time.'));
     }
     return true;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:25,代码来源:Schedule.php

示例3: preProcess

 /** 
  * Heart of the viewing process. The runner gets all the meta data for 
  * the contact and calls the appropriate type of page to view. 
  * 
  * @return void 
  * @access public 
  * 
  */
 function preProcess()
 {
     CRM_Utils_System::setTitle(ts('CiviContribute'));
     $startToDate = array();
     $yearToDate = array();
     $monthToDate = array();
     $status = array('Valid', 'Cancelled');
     $startDate = null;
     $config =& CRM_Core_Config::singleton();
     $currentMonth = date('m');
     $currentDay = date('d');
     if ((int) $config->fiscalYearStart['M'] > $currentMonth || (int) $config->fiscalYearStart['M'] == $currentMonth && (int) $config->fiscalYearStart['d'] > $currentDay) {
         $year = date('Y') - 1;
     } else {
         $year = date('Y');
     }
     $year = array('Y' => $year);
     $yearDate = $config->fiscalYearStart;
     $yearDate = array_merge($year, $yearDate);
     $yearDate = CRM_Utils_Date::format($yearDate);
     $monthDate = date('Ym') . '01000000';
     $prefixes = array('start', 'month', 'year');
     $status = array('Valid', 'Cancelled');
     $yearNow = $yearDate + 10000;
     $yearNow .= '000000';
     $yearDate = $yearDate . '000000';
     // we are specific since we want all information till this second
     $now = date('YmdHis');
     require_once 'CRM/Contribute/BAO/Contribution.php';
     foreach ($prefixes as $prefix) {
         $aName = $prefix . 'ToDate';
         $dName = $prefix . 'Date';
         if ($prefix == 'year') {
             $now = $yearNow;
         }
         foreach ($status as $s) {
             ${$aName}[$s] = CRM_Contribute_BAO_Contribution::getTotalAmountAndCount($s, ${$dName}, $now);
             ${$aName}[$s]['url'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&status=1&start={${$dName}}&end={$now}&test=0");
         }
         $this->assign($aName, ${$aName});
     }
     // Check for admin permission to see if we should include the Manage Contribution Pages action link
     $isAdmin = 0;
     require_once 'CRM/Core/Permission.php';
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $isAdmin = 1;
     }
     $this->assign('isAdmin', $isAdmin);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:57,代码来源:DashBoard.php

示例4: preProcess

 /** 
  * Heart of the viewing process. The runner gets all the meta data for 
  * the contact and calls the appropriate type of page to view. 
  * 
  * @return void 
  * @access public 
  * 
  */
 function preProcess()
 {
     CRM_Utils_System::setTitle(ts('CiviPledge'));
     $startToDate = array();
     $yearToDate = array();
     $monthToDate = array();
     $previousToDate = array();
     $prefixes = array('start', 'month', 'year', 'previous');
     $status = array('Completed', 'Cancelled', 'Pending', 'In Progress', 'Overdue');
     // cumulative (since inception) - prefix = 'start'
     $startDate = null;
     $startDateEnd = null;
     // current year - prefix = 'year'
     $config =& CRM_Core_Config::singleton();
     $yearDate = $config->fiscalYearStart;
     $year = array('Y' => date('Y'));
     $this->assign('curYear', $year['Y']);
     $yearDate = array_merge($year, $yearDate);
     $yearDate = CRM_Utils_Date::format($yearDate);
     $yearDate = $yearDate . '000000';
     $yearDateEnd = $year['Y'] . '1231235959';
     // current month - prefix = 'month'
     $currentMonth = date("F Y", mktime(0, 0, 0, date("m"), 01, date("Y")));
     $this->assign('currentMonthYear', $currentMonth);
     $monthDate = date('Ym') . '01000000';
     $monthDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m"), 01, date("Y"))), '%Y%m%d') . '235959';
     // previous month - prefix = 'previous'
     $previousDate = CRM_Utils_Date::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '000000';
     $previousDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '235959';
     $previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
     $this->assign('previousMonthYear', $previousMonth);
     require_once 'CRM/Pledge/BAO/Pledge.php';
     foreach ($prefixes as $prefix) {
         $aName = $prefix . 'ToDate';
         $startName = $prefix . 'Date';
         $endName = $prefix . 'DateEnd';
         foreach ($status as $s) {
             ${$aName}[str_replace(" ", "", $s)] = CRM_Pledge_BAO_Pledge::getTotalAmountAndCount($s, ${$startName}, ${$endName});
         }
         $this->assign($aName, ${$aName});
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:50,代码来源:DashBoard.php

示例5: getContributionParams

 /**
  * Set the parameters to be passed to contribution create function.
  *
  * @param array $params
  * @param int $financialTypeID
  * @param float $nonDeductibleAmount
  * @param bool $pending
  * @param array $paymentProcessorOutcome
  * @param string $receiptDate
  * @param int $recurringContributionID
  *
  * @return array
  */
 public static function getContributionParams($params, $financialTypeID, $nonDeductibleAmount, $pending, $paymentProcessorOutcome, $receiptDate, $recurringContributionID)
 {
     $contributionParams = array('financial_type_id' => $financialTypeID, 'receive_date' => CRM_Utils_Array::value('receive_date', $params) ? CRM_Utils_Date::processDate($params['receive_date']) : date('YmdHis'), 'non_deductible_amount' => $nonDeductibleAmount, 'total_amount' => $params['amount'], 'tax_amount' => CRM_Utils_Array::value('tax_amount', $params), 'amount_level' => CRM_Utils_Array::value('amount_level', $params), 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), 'cancel_reason' => CRM_Utils_Array::value('cancel_reason', $params, 0), 'cancel_date' => isset($params['cancel_date']) ? CRM_Utils_Date::format($params['cancel_date']) : NULL, 'thankyou_date' => isset($params['thankyou_date']) ? CRM_Utils_Date::format($params['thankyou_date']) : NULL, 'skipLineItem' => CRM_Utils_Array::value('skipLineItem', $params, 0));
     if ($paymentProcessorOutcome) {
         $contributionParams['payment_processor'] = CRM_Utils_Array::value('payment_processor', $paymentProcessorOutcome);
     }
     if (!$pending && $paymentProcessorOutcome) {
         $contributionParams += array('fee_amount' => CRM_Utils_Array::value('fee_amount', $paymentProcessorOutcome), 'net_amount' => CRM_Utils_Array::value('net_amount', $paymentProcessorOutcome, $params['amount']), 'trxn_id' => $paymentProcessorOutcome['trxn_id'], 'receipt_date' => $receiptDate, 'trxn_result_code' => CRM_Utils_Array::value('trxn_result_code', $paymentProcessorOutcome));
     }
     // CRM-4038: for non-en_US locales, CRM_Contribute_BAO_Contribution::add() expects localised amounts
     $contributionParams['non_deductible_amount'] = trim(CRM_Utils_Money::format($contributionParams['non_deductible_amount'], ' '));
     $contributionParams['total_amount'] = trim(CRM_Utils_Money::format($contributionParams['total_amount'], ' '));
     if ($recurringContributionID) {
         $contributionParams['contribution_recur_id'] = $recurringContributionID;
     }
     $contributionParams['contribution_status_id'] = $pending ? 2 : 1;
     if (isset($contributionParams['invoice_id'])) {
         $contributionParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionParams['invoice_id'], 'id', 'invoice_id');
     }
     return $contributionParams;
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:34,代码来源:Confirm.php

示例6: add

 /**
  * takes an associative array and creates a contact object
  *
  * the function extract all the params it needs to initialize the create a
  * contact object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array  $params (reference ) an assoc array of name/value pairs
  * @param array $ids    the array that holds all the db ids
  *
  * @return object CRM_Contact_BAO_Individual object
  * @access public
  * @static
  */
 function add(&$params, &$ids)
 {
     if (!CRM_Contact_BAO_Individual::dataExists($params, $ids)) {
         return;
     }
     $individual =& new CRM_Contact_BAO_Individual();
     $individual->copyValues($params);
     $date = CRM_Utils_Array::value('birth_date', $params);
     if (is_array($date)) {
         $individual->birth_date = CRM_Utils_Date::format($date);
     } else {
         $individual->birth_date = preg_replace('/[^0-9]/', '', $date);
     }
     $individual->middle_name = CRM_Utils_Array::value('middle_name', $params);
     // hack to make db_do save a null value to a field
     if (!$individual->birth_date) {
         $individual->birth_date = 'NULL';
     }
     if (!array_key_exists('is_deceased', $params)) {
         $individual->is_deceased = 0;
     }
     $individual->id = CRM_Utils_Array::value('individual', $ids);
     return $individual->save();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:38,代码来源:Individual.php

示例7: formRule

 /**
  * Form rule to validate the date selector and/or if we should deliver
  * immediately.
  *
  * Warning: if you make changes here, be sure to also make them in
  * Retry.php
  *
  * @param array $params
  *   The form values.
  *
  * @param $files
  * @param $self
  *
  * @return bool
  *   True if either we deliver immediately, or the date is properly
  *   set.
  */
 public static function formRule($params, $files, $self)
 {
     if (!empty($params['_qf_Schedule_submit'])) {
         CRM_Core_Session::setStatus(ts("Your Mass SMS has been saved. Click the 'Continue' action to resume working on it."), ts('Saved'), 'success');
         $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1&sms=1');
         CRM_Utils_System::redirect($url);
     }
     if (isset($params['now']) || CRM_Utils_Array::value('_qf_Schedule_back', $params) == ts('Previous')) {
         return TRUE;
     }
     if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'])) < CRM_Utils_Date::format(date('YmdHi00'))) {
         return array('start_date' => ts('Start date cannot be earlier than the current time.'));
     }
     return TRUE;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:32,代码来源:Schedule.php

示例8: formRule

 /**
  * global validation rules for the form
  *
  * @param array $fields posted values of the form
  *
  * @return array list of errors to be posted back to the form
  * @static
  * @access public
  */
 static function formRule($fields)
 {
     $errors = array();
     if (!empty($fields['is_active']) && CRM_Utils_System::isNull($fields['subject'])) {
         $errors['subject'] = ts('Subject is a required field.');
     }
     if (!CRM_Utils_System::isNull($fields['absolute_date'])) {
         if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($fields['absolute_date'], NULL)) < CRM_Utils_Date::format(date('YmdHi00'))) {
             $errors['absolute_date'] = ts('Absolute date cannot be earlier than the current time.');
         }
     }
     if (!empty($errors)) {
         return $errors;
     }
     return empty($errors) ? TRUE : $errors;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:25,代码来源:ScheduleReminders.php

示例9: getContributionDates

 function getContributionDates()
 {
     $config = CRM_Core_Config::singleton();
     $currentMonth = date('m');
     $currentDay = date('d');
     if ((int) $config->fiscalYearStart['M'] > $currentMonth || (int) $config->fiscalYearStart['M'] == $currentMonth && (int) $config->fiscalYearStart['d'] > $currentDay) {
         $year = date('Y') - 1;
     } else {
         $year = date('Y');
     }
     $year = array('Y' => $year);
     $yearDate = $config->fiscalYearStart;
     $yearDate = array_merge($year, $yearDate);
     $yearDate = CRM_Utils_Date::format($yearDate);
     $monthDate = date('Ym') . '01';
     $now = date('Ymd');
     return array('now' => $now, 'yearDate' => $yearDate, 'monthDate' => $monthDate);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:18,代码来源:Contribution.php

示例10: assignToTemplate

 /**
  * assign the minimal set of variables to the template
  *
  * @return void
  * @access public
  */
 function assignToTemplate()
 {
     $name = CRM_Utils_Array::value('billing_first_name', $this->_params);
     if (CRM_Utils_Array::value('billing_middle_name', $this->_params)) {
         $name .= " {$this->_params['billing_middle_name']}";
     }
     $name .= ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params);
     $name = trim($name);
     $this->assign('billingName', $name);
     $this->set('name', $name);
     $this->assign('paymentProcessor', $this->_paymentProcessor);
     $vars = array('amount', 'currencyID', 'credit_card_type', 'trxn_id', 'amount_level');
     $config = CRM_Core_Config::singleton();
     if (isset($this->_values['is_recur']) && CRM_Utils_Array::value('is_recur', $this->_paymentProcessor)) {
         $this->assign('is_recur_enabled', 1);
         $vars = array_merge($vars, array('is_recur', 'frequency_interval', 'frequency_unit', 'installments'));
     }
     if (in_array('CiviPledge', $config->enableComponents) && CRM_Utils_Array::value('is_pledge', $this->_params) == 1) {
         $this->assign('pledge_enabled', 1);
         $vars = array_merge($vars, array('is_pledge', 'pledge_frequency_interval', 'pledge_frequency_unit', 'pledge_installments'));
     }
     if (isset($this->_params['amount_other']) || isset($this->_params['selectMembership'])) {
         $this->_params['amount_level'] = '';
     }
     foreach ($vars as $v) {
         if (isset($this->_params[$v])) {
             if ($v == 'frequency_unit' || $v == 'pledge_frequency_unit') {
                 $frequencyUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
                 if (array_key_exists($this->_params[$v], $frequencyUnits)) {
                     $this->_params[$v] = $frequencyUnits[$this->_params[$v]];
                 }
             }
             if ($v == "amount" && $this->_params[$v] === 0) {
                 $this->_params[$v] = CRM_Utils_Money::format($this->_params[$v], NULL, NULL, TRUE);
             }
             $this->assign($v, $this->_params[$v]);
         }
     }
     // assign the address formatted up for display
     $addressParts = array("street_address-{$this->_bltID}", "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "state_province-{$this->_bltID}", "country-{$this->_bltID}");
     $addressFields = array();
     foreach ($addressParts as $part) {
         list($n, $id) = explode('-', $part);
         $addressFields[$n] = CRM_Utils_Array::value('billing_' . $part, $this->_params);
     }
     $this->assign('address', CRM_Utils_Address::format($addressFields));
     if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) {
         $this->assign('onBehalfName', $this->_params['organization_name']);
         $locTypeId = array_keys($this->_params['onbehalf_location']['email']);
         $this->assign('onBehalfEmail', $this->_params['onbehalf_location']['email'][$locTypeId[0]]['email']);
     }
     //fix for CRM-3767
     $assignCCInfo = FALSE;
     if ($this->_amount > 0.0) {
         $assignCCInfo = TRUE;
     } elseif (CRM_Utils_array::value('selectMembership', $this->_params)) {
         $memFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_params['selectMembership'], 'minimum_fee');
         if ($memFee > 0.0) {
             $assignCCInfo = TRUE;
         }
     }
     if ($this->_contributeMode == 'direct' && $assignCCInfo) {
         if ($this->_paymentProcessor && $this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) {
             $this->assign('payment_type', $this->_paymentProcessor['payment_type']);
             $this->assign('account_holder', $this->_params['account_holder']);
             $this->assign('bank_identification_number', $this->_params['bank_identification_number']);
             $this->assign('bank_name', $this->_params['bank_name']);
             $this->assign('bank_account_number', $this->_params['bank_account_number']);
         } else {
             $date = CRM_Utils_Date::format(CRM_Utils_array::value('credit_card_exp_date', $this->_params));
             $date = CRM_Utils_Date::mysqlToIso($date);
             $this->assign('credit_card_exp_date', $date);
             $this->assign('credit_card_number', CRM_Utils_System::mungeCreditCard(CRM_Utils_array::value('credit_card_number', $this->_params)));
         }
     }
     $this->assign('email', $this->controller->exportValue('Main', "email-{$this->_bltID}"));
     // also assign the receipt_text
     if (isset($this->_values['receipt_text'])) {
         $this->assign('receipt_text', $this->_values['receipt_text']);
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:87,代码来源:ContributionBase.php

示例11: postProcess


//.........这里部分代码省略.........
                 if (isset($params['payment_instrument_id'])) {
                     $this->assign('paidBy', CRM_Utils_Array::value($params['payment_instrument_id'], $paymentInstrument));
                 }
             }
             $this->assign('totalAmount', $contributionParams['total_amount']);
             if (isset($contributionParams['partial_payment_total'])) {
                 // balance amount
                 $balanceAmount = $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_pay'];
                 $this->assign('balanceAmount', $balanceAmount);
             }
             $this->assign('isPrimary', 1);
             $this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
         }
         if ($this->_mode) {
             if (!empty($params['billing_first_name'])) {
                 $name = $params['billing_first_name'];
             }
             if (!empty($params['billing_middle_name'])) {
                 $name .= " {$params['billing_middle_name']}";
             }
             if (!empty($params['billing_last_name'])) {
                 $name .= " {$params['billing_last_name']}";
             }
             $this->assign('billingName', $name);
             // assign the address formatted up for display
             $addressParts = array("street_address-{$this->_bltID}", "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "state_province-{$this->_bltID}", "country-{$this->_bltID}");
             $addressFields = array();
             foreach ($addressParts as $part) {
                 list($n, $id) = explode('-', $part);
                 if (isset($this->_params['billing_' . $part])) {
                     $addressFields[$n] = $this->_params['billing_' . $part];
                 }
             }
             $this->assign('address', CRM_Utils_Address::format($addressFields));
             $date = CRM_Utils_Date::format($params['credit_card_exp_date']);
             $date = CRM_Utils_Date::mysqlToIso($date);
             $this->assign('credit_card_exp_date', $date);
             $this->assign('credit_card_number', CRM_Utils_System::mungeCreditCard($params['credit_card_number']));
             $this->assign('credit_card_type', $params['credit_card_type']);
             // The concept of contributeMode is deprecated.
             $this->assign('contributeMode', 'direct');
             $this->assign('isAmountzero', 0);
             $this->assign('is_pay_later', 0);
             $this->assign('isPrimary', 1);
         }
         $this->assign('register_date', $params['register_date']);
         if ($params['receive_date']) {
             $this->assign('receive_date', $params['receive_date']);
         }
         $participant = array(array('participant_id', '=', $participants[0]->id, 0, 0));
         // check whether its a test drive ref CRM-3075
         if (!empty($this->_defaultValues['is_test'])) {
             $participant[] = array('participant_test', '=', 1, 0, 0);
         }
         $template = CRM_Core_Smarty::singleton();
         $customGroup = array();
         //format submitted data
         foreach ($params['custom'] as $fieldID => $values) {
             foreach ($values as $fieldValue) {
                 $customFields[$fieldID]['id'] = $fieldID;
                 $formattedValue = CRM_Core_BAO_CustomField::displayValue($fieldValue['value'], $fieldID, $participants[0]->id);
                 $customGroup[$customFields[$fieldID]['groupTitle']][$customFields[$fieldID]['label']] = str_replace('&nbsp;', '', $formattedValue);
             }
         }
         foreach ($this->_contactIds as $num => $contactID) {
             // Retrieve the name and email of the contact - this will be the TO for receipt email
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:67,代码来源:Participant.php

示例12: resolveDefaults

 /**
  * Get the values for pseudoconstants for name->value and reverse.
  *
  * @param array $defaults
  *   (reference) the default values, some of which need to be resolved.
  * @param bool $reverse
  *   True if we want to resolve the values in the reverse direction (value -> name).
  */
 public static function resolveDefaults(&$defaults, $reverse = FALSE)
 {
     // Hack for birth_date.
     if (!empty($defaults['birth_date'])) {
         if (is_array($defaults['birth_date'])) {
             $defaults['birth_date'] = CRM_Utils_Date::format($defaults['birth_date'], '-');
         }
     }
     CRM_Utils_Array::lookupValue($defaults, 'prefix', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'), $reverse);
     CRM_Utils_Array::lookupValue($defaults, 'suffix', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'), $reverse);
     CRM_Utils_Array::lookupValue($defaults, 'gender', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), $reverse);
     CRM_Utils_Array::lookupValue($defaults, 'communication_style', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id'), $reverse);
     //lookup value of email/postal greeting, addressee, CRM-4575
     foreach (self::$_greetingTypes as $greeting) {
         $filterCondition = array('contact_type' => CRM_Utils_Array::value('contact_type', $defaults), 'greeting_type' => $greeting);
         CRM_Utils_Array::lookupValue($defaults, $greeting, CRM_Core_PseudoConstant::greeting($filterCondition), $reverse);
     }
     $blocks = array('address', 'im', 'phone');
     foreach ($blocks as $name) {
         if (!array_key_exists($name, $defaults) || !is_array($defaults[$name])) {
             continue;
         }
         foreach ($defaults[$name] as $count => &$values) {
             //get location type id.
             CRM_Utils_Array::lookupValue($values, 'location_type', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), $reverse);
             if ($name == 'address') {
                 // FIXME: lookupValue doesn't work for vcard_name
                 if (!empty($values['location_type_id'])) {
                     $vcardNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'vcard_name'));
                     $values['vcard_name'] = $vcardNames[$values['location_type_id']];
                 }
                 if (!CRM_Utils_Array::lookupValue($values, 'country', CRM_Core_PseudoConstant::country(), $reverse) && $reverse) {
                     CRM_Utils_Array::lookupValue($values, 'country', CRM_Core_PseudoConstant::countryIsoCode(), $reverse);
                 }
                 // CRM-7597
                 // if we find a country id above, we need to restrict it to that country
                 // rather than the list of all countries
                 if (!empty($values['country_id'])) {
                     $stateProvinceList = CRM_Core_PseudoConstant::stateProvinceForCountry($values['country_id']);
                 } else {
                     $stateProvinceList = CRM_Core_PseudoConstant::stateProvince();
                 }
                 if (!CRM_Utils_Array::lookupValue($values, 'state_province', $stateProvinceList, $reverse) && $reverse) {
                     if (!empty($values['country_id'])) {
                         $stateProvinceList = CRM_Core_PseudoConstant::stateProvinceForCountry($values['country_id'], 'abbreviation');
                     } else {
                         $stateProvinceList = CRM_Core_PseudoConstant::stateProvinceAbbreviation();
                     }
                     CRM_Utils_Array::lookupValue($values, 'state_province', $stateProvinceList, $reverse);
                 }
                 if (!empty($values['state_province_id'])) {
                     $countyList = CRM_Core_PseudoConstant::countyForState($values['state_province_id']);
                 } else {
                     $countyList = CRM_Core_PseudoConstant::county();
                 }
                 CRM_Utils_Array::lookupValue($values, 'county', $countyList, $reverse);
             }
             if ($name == 'im') {
                 CRM_Utils_Array::lookupValue($values, 'provider', CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $reverse);
             }
             if ($name == 'phone') {
                 CRM_Utils_Array::lookupValue($values, 'phone_type', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'), $reverse);
             }
             // Kill the reference.
             unset($values);
         }
     }
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:76,代码来源:Contact.php

示例13: formRule

 /**
  * Form rule to validate the date selector and/or if we should deliver
  * immediately.
  *
  * Warning: if you make changes here, be sure to also make them in
  * Retry.php
  *
  * @param array $params     The form values
  *
  * @return boolean          True if either we deliver immediately, or the
  *                          date is properly set.
  * @static
  */
 public static function formRule($params, $files, $self)
 {
     if (!empty($params['_qf_Schedule_submit'])) {
         //when user perform mailing from search context
         //redirect it to search result CRM-3711.
         $ssID = $self->get('ssID');
         if ($ssID && $self->_searchBasedMailing) {
             if ($self->_action == CRM_Core_Action::BASIC) {
                 $fragment = 'search';
             } elseif ($self->_action == CRM_Core_Action::PROFILE) {
                 $fragment = 'search/builder';
             } elseif ($self->_action == CRM_Core_Action::ADVANCED) {
                 $fragment = 'search/advanced';
             } else {
                 $fragment = 'search/custom';
             }
             $draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
             $status = ts("Your mailing has been saved. You can continue later by clicking the 'Continue' action to resume working on it.<br /> From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
             CRM_Core_Session::setStatus($status);
             //replace user context to search.
             $context = $self->get('context');
             if (!CRM_Contact_Form_Search::isSearchContext($context)) {
                 $context = 'search';
             }
             $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
             $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
             if (CRM_Utils_Rule::qfKey($qfKey)) {
                 $urlParams .= "&qfKey={$qfKey}";
             }
             $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, "force=1&reset=1&ssID={$ssID}");
             CRM_Utils_System::redirect($url);
         } else {
             CRM_Core_Session::setStatus(ts("Your mailing has been saved. Click the 'Continue' action to resume working on it."));
             $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
             CRM_Utils_System::redirect($url);
         }
     }
     if (isset($params['now']) || CRM_Utils_Array::value('_qf_Schedule_back', $params) == '<< Previous') {
         return TRUE;
     }
     if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'])) < CRM_Utils_Date::format(date('YmdHi00'))) {
         return array('start_date' => ts('Start date cannot be earlier than the current time.'));
     }
     return TRUE;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:58,代码来源:Schedule.php

示例14: whereClauseSingle

 /**
  * Where clause for a single field.
  *
  * @param $values
  * @param $query
  *
  * @return void
  */
 public static function whereClauseSingle(&$values, &$query)
 {
     list($name, $op, $value, $grouping, $wildcard) = $values;
     $val = $names = array();
     switch ($name) {
         case 'case_type_id':
         case 'case_type':
         case 'case_status':
         case 'case_status_id':
         case 'case_id':
             if (strpos($name, 'type')) {
                 $name = 'case_type_id';
                 $label = 'Case Type(s)';
             } elseif (strpos($name, 'status')) {
                 $name = 'status_id';
                 $label = 'Case Status(s)';
             } else {
                 $name = 'id';
                 $label = 'Case ID';
             }
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_case.{$name}", $op, $value, "Integer");
             list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Case_DAO_Case', $name, $value, $op);
             $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $label, 2 => $op, 3 => $value));
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             return;
         case 'case_owner':
         case 'case_mycases':
             if (!empty($value)) {
                 if ($value == 2) {
                     $session = CRM_Core_Session::singleton();
                     $userID = $session->get('userID');
                     $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_relationship.contact_id_b", $op, $userID, 'Int');
                     $query->_qill[$grouping][] = ts('Case %1 My Cases', array(1 => $op));
                     $query->_tables['case_relationship'] = $query->_whereTables['case_relationship'] = 1;
                 } elseif ($value == 1) {
                     $query->_qill[$grouping][] = ts('Case %1 All Cases', array(1 => $op));
                     $query->_where[$grouping][] = "civicrm_case_contact.contact_id = contact_a.id";
                 }
                 $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
                 $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             }
             return;
         case 'case_deleted':
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_case.is_deleted", $op, $value, 'Boolean');
             if ($value) {
                 $query->_qill[$grouping][] = ts("Find Deleted Cases");
             }
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             return;
         case 'case_activity_subject':
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.subject", $op, $value, 'String');
             $query->_qill[$grouping][] = ts("Activity Subject %1 '%2'", array(1 => $op, 2 => $value));
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_subject':
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_case.subject", $op, $value, 'String');
             $query->_qill[$grouping][] = ts("Case Subject %1 '%2'", array(1 => $op, 2 => $value));
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_source_contact_id':
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_case_reporter.sort_name", $op, $value, 'String');
             $query->_qill[$grouping][] = ts("Activity Reporter %1 '%2'", array(1 => $op, 2 => $value));
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case_reporter'] = $query->_whereTables['civicrm_case_reporter'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_recent_activity_date':
             $date = CRM_Utils_Date::format($value);
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.activity_date_time", $op, $date, 'Date');
             if ($date) {
                 $date = CRM_Utils_Date::customFormat($date);
                 $query->_qill[$grouping][] = ts("Activity Actual Date %1 %2", array(1 => $op, 2 => $date));
             }
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
         case 'case_scheduled_activity_date':
             $date = CRM_Utils_Date::format($value);
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("case_activity.activity_date_time", $op, $date, 'Date');
             if ($date) {
                 $date = CRM_Utils_Date::customFormat($date);
                 $query->_qill[$grouping][] = ts("Activity Schedule Date %1 %2", array(1 => $op, 2 => $date));
             }
             $query->_tables['case_activity'] = $query->_whereTables['case_activity'] = 1;
             $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
             $query->_tables['civicrm_case_contact'] = $query->_whereTables['civicrm_case_contact'] = 1;
             return;
//.........这里部分代码省略.........
开发者ID:scardinius,项目名称:civicrm-core-api-mailing,代码行数:101,代码来源:Query.php

示例15: postProcess


//.........这里部分代码省略.........
             $this->assign('location', $location);
         }
         $status = CRM_Event_PseudoConstant::participantStatus();
         if ($this->_isPaidEvent) {
             $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
             if (!$this->_mode) {
                 $this->assign('paidBy', CRM_Utils_Array::value($params['payment_instrument_id'], $paymentInstrument));
             }
             $this->assign('totalAmount', $contributionParams['total_amount']);
             $this->assign('isPrimary', 1);
             $this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
         }
         if ($this->_mode) {
             if (CRM_Utils_Array::value('billing_first_name', $params)) {
                 $name = $params['billing_first_name'];
             }
             if (CRM_Utils_Array::value('billing_middle_name', $params)) {
                 $name .= " {$params['billing_middle_name']}";
             }
             if (CRM_Utils_Array::value('billing_last_name', $params)) {
                 $name .= " {$params['billing_last_name']}";
             }
             $this->assign('billingName', $name);
             // assign the address formatted up for display
             $addressParts = array("street_address-{$this->_bltID}", "city-{$this->_bltID}", "postal_code-{$this->_bltID}", "state_province-{$this->_bltID}", "country-{$this->_bltID}");
             $addressFields = array();
             foreach ($addressParts as $part) {
                 list($n, $id) = explode('-', $part);
                 if (isset($this->_params['billing_' . $part])) {
                     $addressFields[$n] = $this->_params['billing_' . $part];
                 }
             }
             require_once 'CRM/Utils/Address.php';
             $this->assign('address', CRM_Utils_Address::format($addressFields));
             $date = CRM_Utils_Date::format($params['credit_card_exp_date']);
             $date = CRM_Utils_Date::mysqlToIso($date);
             $this->assign('credit_card_exp_date', $date);
             $this->assign('credit_card_number', CRM_Utils_System::mungeCreditCard($params['credit_card_number']));
             $this->assign('credit_card_type', $params['credit_card_type']);
             $this->assign('contributeMode', 'direct');
             $this->assign('isAmountzero', 0);
             $this->assign('is_pay_later', 0);
             $this->assign('isPrimary', 1);
         }
         $this->assign('register_date', $params['register_date']);
         if ($params['receive_date']) {
             $this->assign('receive_date', $params['receive_date']);
         }
         $participant = array(array('participant_id', '=', $participants[0]->id, 0, 0));
         // check whether its a test drive ref CRM-3075
         if (CRM_Utils_Array::value('is_test', $this->_defaultValues)) {
             $participant[] = array('participant_test', '=', 1, 0, 0);
         }
         $template =& CRM_Core_Smarty::singleton();
         $customGroup = array();
         //format submitted data
         foreach ($params['custom'] as $fieldID => $values) {
             foreach ($values as $fieldValue) {
                 $customValue = array('data' => $fieldValue['value']);
                 $customFields[$fieldID]['id'] = $fieldID;
                 $formattedValue = CRM_Core_BAO_CustomGroup::formatCustomValues($customValue, $customFields[$fieldID]);
                 $customGroup[$customFields[$fieldID]['groupTitle']][$customFields[$fieldID]['label']] = str_replace('&nbsp;', '', $formattedValue);
             }
         }
         foreach ($this->_contactIds as $num => $contactID) {
             // Retrieve the name and email of the contact - this will be the TO for receipt email
开发者ID:ksecor,项目名称:civicrm,代码行数:67,代码来源:Participant.php


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