本文整理汇总了PHP中CRM_Utils_Date::customformat方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Date::customformat方法的具体用法?PHP CRM_Utils_Date::customformat怎么用?PHP CRM_Utils_Date::customformat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Date
的用法示例。
在下文中一共展示了CRM_Utils_Date::customformat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
//custom data related code
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
return CRM_Custom_Form_CustomData::preProcess($this);
}
// get price set id.
$this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
$this->set('priceSetId', $this->_priceSetId);
$this->assign('priceSetId', $this->_priceSetId);
// action
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_processors = array();
CRM_Core_Resources::singleton()->addSetting(array('ids' => array('contact' => $this->_contactID)));
// check for edit permission
if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_action & CRM_Core_Action::DELETE) {
$contributionID = CRM_Member_BAO_Membership::getMembershipContributionId($this->_id);
// check delete permission for contribution
if ($this->_id && $contributionID && !CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
CRM_Core_Error::fatal(ts("This Membership is linked to a contribution. You must have 'delete in CiviContribute' permission in order to delete this record."));
}
}
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
if ($this->_id) {
$this->_memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'membership_type_id');
$this->_membershipIDs[] = $this->_id;
}
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('membershipMode', $this->_mode);
if ($this->_mode) {
$this->_paymentProcessor = array('billing_mode' => 1);
$validProcessors = array();
$processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'billing_mode IN ( 1, 3 )');
foreach ($processors as $ppID => $label) {
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
if ($paymentProcessor['payment_processor_type'] == 'PayPal' && !$paymentProcessor['user_name']) {
continue;
} elseif ($paymentProcessor['payment_processor_type'] == 'Dummy' && $this->_mode == 'live') {
continue;
} else {
$paymentObject = CRM_Core_Payment::singleton($this->_mode, $paymentProcessor, $this);
$error = $paymentObject->checkConfig();
if (empty($error)) {
$validProcessors[$ppID] = $label;
}
$paymentObject = NULL;
}
}
if (empty($validProcessors)) {
CRM_Core_Error::fatal(ts('Could not find valid payment processor for this page'));
} else {
$this->_processors = $validProcessors;
}
// also check for billing information
// get the billing location type
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
// CRM-8108 remove ts around Billing location type
//$this->_bltID = array_search( ts('Billing'), $locationTypes );
$this->_bltID = array_search('Billing', $locationTypes);
if (!$this->_bltID) {
CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
}
$this->set('bltID', $this->_bltID);
$this->assign('bltID', $this->_bltID);
$this->_fields = array();
CRM_Core_Payment_Form::setCreditCardFields($this);
// this required to show billing block
$this->assign_by_ref('paymentProcessor', $paymentProcessor);
$this->assign('hidePayPalExpress', TRUE);
}
if ($this->_action & CRM_Core_Action::ADD) {
if (!CRM_Member_BAO_Membership::statusAvailabilty($this->_contactID)) {
// all possible statuses are disabled - redirect back to contact form
CRM_Core_Error::statusBounce(ts('There are no configured membership statuses. You cannot add this membership until your membership statuses are correctly configured'));
}
if ($this->_contactID) {
//check whether contact has a current membership so we can alert user that they may want to do a renewal instead
$contactMemberships = array();
$memParams = array('contact_id' => $this->_contactID);
CRM_Member_BAO_Membership::getValues($memParams, $contactMemberships, TRUE);
$cMemTypes = array();
foreach ($contactMemberships as $mem) {
$cMemTypes[] = $mem['membership_type_id'];
}
if (count($cMemTypes) > 0) {
$memberorgs = CRM_Member_BAO_MembershipType::getMemberOfContactByMemTypes($cMemTypes);
$mems_by_org = array();
foreach ($contactMemberships as $memid => $mem) {
$mem['member_of_contact_id'] = CRM_Utils_Array::value($mem['membership_type_id'], $memberorgs);
if (CRM_Utils_Array::value('membership_end_date', $mem)) {
$mem['membership_end_date'] = CRM_Utils_Date::customformat($mem['membership_end_date']);
//.........这里部分代码省略.........
示例2: preProcess
public function preProcess()
{
//custom data related code
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
return CRM_Custom_Form_CustomData::preProcess($this);
}
parent::preProcess();
// get price set id.
$this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
$this->set('priceSetId', $this->_priceSetId);
$this->assign('priceSetId', $this->_priceSetId);
// check for edit permission
if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
if ($this->_action & CRM_Core_Action::DELETE) {
$contributionID = CRM_Member_BAO_Membership::getMembershipContributionId($this->_id);
// check delete permission for contribution
if ($this->_id && $contributionID && !CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
CRM_Core_Error::fatal(ts("This Membership is linked to a contribution. You must have 'delete in CiviContribute' permission in order to delete this record."));
}
}
if ($this->_action & CRM_Core_Action::ADD) {
if (!CRM_Member_BAO_Membership::statusAvailabilty($this->_contactID)) {
// all possible statuses are disabled - redirect back to contact form
CRM_Core_Error::statusBounce(ts('There are no configured membership statuses. You cannot add this membership until your membership statuses are correctly configured'));
}
if ($this->_contactID) {
//check whether contact has a current membership so we can alert user that they may want to do a renewal instead
$contactMemberships = array();
$memParams = array('contact_id' => $this->_contactID);
CRM_Member_BAO_Membership::getValues($memParams, $contactMemberships, TRUE);
$cMemTypes = array();
foreach ($contactMemberships as $mem) {
$cMemTypes[] = $mem['membership_type_id'];
}
if (count($cMemTypes) > 0) {
$memberorgs = CRM_Member_BAO_MembershipType::getMemberOfContactByMemTypes($cMemTypes);
$mems_by_org = array();
foreach ($contactMemberships as $memid => $mem) {
$mem['member_of_contact_id'] = CRM_Utils_Array::value($mem['membership_type_id'], $memberorgs);
if (!empty($mem['membership_end_date'])) {
$mem['membership_end_date'] = CRM_Utils_Date::customformat($mem['membership_end_date']);
}
$mem['membership_type'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $mem['membership_type_id'], 'name', 'id');
$mem['membership_status'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $mem['status_id'], 'label', 'id');
$mem['renewUrl'] = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$mem['id']}&context=membership&selectedChild=member" . ($this->_mode ? '&mode=live' : ''));
$mem['membershipTab'] = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=member");
$mems_by_org[$mem['member_of_contact_id']] = $mem;
}
$this->assign('existingContactMemberships', $mems_by_org);
}
} else {
// In standalone mode we don't have a contact id yet so lookup will be done client-side with this script:
$resources = CRM_Core_Resources::singleton();
$resources->addScriptFile('civicrm', 'templates/CRM/Member/Form/MembershipStandalone.js');
$passthru = array('typeorgs' => CRM_Member_BAO_MembershipType::getMembershipTypeOrganization(), 'memtypes' => CRM_Core_PseudoConstant::get('CRM_Member_BAO_Membership', 'membership_type_id'), 'statuses' => CRM_Core_PseudoConstant::get('CRM_Member_BAO_Membership', 'status_id'));
$resources->addSetting(array('existingMems' => $passthru));
}
}
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// CRM-4395, get the online pending contribution id.
$this->_onlinePendingContributionId = NULL;
if (!$this->_mode && $this->_id && $this->_action & CRM_Core_Action::UPDATE) {
$this->_onlinePendingContributionId = CRM_Contribute_BAO_Contribution::checkOnlinePendingContribution($this->_id, 'Membership');
}
$this->assign('onlinePendingContributionId', $this->_onlinePendingContributionId);
$this->setPageTitle(ts('Membership'));
}
示例3: preProcess
public function preProcess()
{
//custom data related code
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
return CRM_Custom_Form_CustomData::preProcess($this);
}
// get price set id.
$this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
$this->set('priceSetId', $this->_priceSetId);
$this->assign('priceSetId', $this->_priceSetId);
// action
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_processors = array();
// check for edit permission
if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
if ($this->_id) {
$this->_memType = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $this->_id, "membership_type_id");
$this->_membershipIDs[] = $this->_id;
}
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('membershipMode', $this->_mode);
if ($this->_mode) {
$this->_paymentProcessor = array('billing_mode' => 1);
$validProcessors = array();
$processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )");
foreach ($processors as $ppID => $label) {
$paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
if ($paymentProcessor['payment_processor_type'] == 'PayPal' && !$paymentProcessor['user_name']) {
continue;
} elseif ($paymentProcessor['payment_processor_type'] == 'Dummy' && $this->_mode == 'live') {
continue;
} else {
$paymentObject = CRM_Core_Payment::singleton($this->_mode, $paymentProcessor, $this);
$error = $paymentObject->checkConfig();
if (empty($error)) {
$validProcessors[$ppID] = $label;
}
$paymentObject = NULL;
}
}
if (empty($validProcessors)) {
CRM_Core_Error::fatal(ts('Could not find valid payment processor for this page'));
} else {
$this->_processors = $validProcessors;
}
// also check for billing information
// get the billing location type
$locationTypes = CRM_Core_PseudoConstant::locationType();
// CRM-8108 remove ts around Billing location type
//$this->_bltID = array_search( ts('Billing'), $locationTypes );
$this->_bltID = array_search('Billing', $locationTypes);
if (!$this->_bltID) {
CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
}
$this->set('bltID', $this->_bltID);
$this->assign('bltID', $this->_bltID);
$this->_fields = array();
CRM_Core_Payment_Form::setCreditCardFields($this);
// this required to show billing block
$this->assign_by_ref('paymentProcessor', $paymentProcessor);
$this->assign('hidePayPalExpress', TRUE);
}
if ($this->_action & CRM_Core_Action::ADD) {
//check whether any active membership statuses are available - redirects back to contact summary if not
CRM_Member_BAO_Membership::statusAvilability($this->_contactID);
if ($this->_contactID) {
//check whether contact has a current membership so we can alert user that they may want to do a renewal instead
$hasMembership = CRM_Member_BAO_Membership::getContactMembership($this->_contactID, NULL, 0);
if (!empty($hasMembership)) {
$hasMembership['membership_type'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $hasMembership['membership_type_id'], 'name', 'id');
$hasMembership['membership_status'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $hasMembership['status_id'], 'label', 'id');
$membershipTab = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=member");
if ($this->_mode) {
$renewUrl = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$hasMembership['id']}&context=membership&selectedChild=member&mode=live");
} else {
$renewUrl = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$hasMembership['id']}&context=membership&selectedChild=member");
}
if (CRM_Utils_Array::value('membership_end_date', $hasMembership)) {
CRM_Core_Session::setStatus(ts('This contact has an existing %1 membership record with %2 status and end date of %3. <a href="%4">Click here if you want to renew this membership</a> (rather than creating a new membership record). <a href="%5">Click here to view all existing and / or expired memberships for this contact.</a>', array(1 => $hasMembership['membership_type'], 2 => $hasMembership['membership_status'], 3 => CRM_Utils_Date::customformat($hasMembership['membership_end_date']), 4 => $renewUrl, 5 => $membershipTab)));
} else {
CRM_Core_Session::setStatus(ts('This contact has an existing %1 membership record with %2 status. <a href="%3">Click here if you want to renew this membership</a> (rather than creating a new membership record). <a href="%4">Click here to view all existing and / or expired memberships for this contact.</a>', array(1 => $hasMembership['membership_type'], 2 => $hasMembership['membership_status'], 3 => $renewUrl, 4 => $membershipTab)));
}
}
}
}
// when custom data is included in this page
if (CRM_Utils_Array::value("hidden_custom", $_POST)) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
//.........这里部分代码省略.........