本文整理汇总了PHP中CRM_Member_BAO_MembershipType::convertDayFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Member_BAO_MembershipType::convertDayFormat方法的具体用法?PHP CRM_Member_BAO_MembershipType::convertDayFormat怎么用?PHP CRM_Member_BAO_MembershipType::convertDayFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Member_BAO_MembershipType
的用法示例。
在下文中一共展示了CRM_Member_BAO_MembershipType::convertDayFormat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* Browse all membership types.
*
*
* @return void
* @access public
* @static
*/
function browse()
{
// get all membership types sorted by weight
$membershipType = array();
require_once 'CRM/Member/DAO/MembershipType.php';
$dao =& new CRM_Member_DAO_MembershipType();
$dao->orderBy('weight');
$dao->find();
require_once 'CRM/Utils/Money.php';
while ($dao->fetch()) {
$membershipType[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $membershipType[$dao->id]);
// fix the display of the monetary value, CRM-4038
if (CRM_Utils_Array::value('minimum_fee', $membershipType[$dao->id])) {
$membershipType[$dao->id]['minimum_fee'] = CRM_Utils_Money::format($membershipType[$dao->id]['minimum_fee'], null, '%a');
}
//adding column for relationship type label. CRM-4178.
if ($dao->relationship_type_id) {
$relationshipName = 'label_' . $dao->relationship_direction;
$membershipType[$dao->id]['relationshipTypeName'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $dao->relationship_type_id, $relationshipName);
}
// form all action links
$action = array_sum(array_keys($this->links()));
// update enable/disable links depending on if it is is_reserved or is_active
if (!isset($dao->is_reserved)) {
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$membershipType[$dao->id]['order'] = $membershipType[$dao->id]['weight'];
$membershipType[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
}
}
$returnURL = CRM_Utils_System::url('civicrm/admin/member/membershipType', "reset=1&action=browse");
require_once 'CRM/Utils/Weight.php';
CRM_Utils_Weight::addOrder($membershipType, 'CRM_Member_DAO_MembershipType', 'id', $returnURL);
CRM_Member_BAO_MembershipType::convertDayFormat($membershipType);
$this->assign('rows', $membershipType);
}
示例2: testConvertDayFormat
/**
* check function convertDayFormat( )
*
*/
public function testConvertDayFormat()
{
$ids = array();
$params = array('name' => 'General', 'description' => NULL, 'minimum_fee' => 100, 'domain_id' => 1, 'duration_unit' => 'year', 'period_type' => 'fixed', 'member_of_contact_id' => $this->_orgContactID, 'fixed_period_start_day' => 1213, 'fixed_period_rollover_day' => 1214, 'duration_interval' => 1, 'financial_type_id' => $this->_financialTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1);
$membership = CRM_Member_BAO_MembershipType::add($params, $ids);
$membershipType[$membership->id] = $params;
CRM_Member_BAO_MembershipType::convertDayFormat($membershipType);
$this->assertEquals($membershipType[$membership->id]['fixed_period_rollover_day'], 'Dec 14', 'Verify memberFixed Period Rollover Day.');
$this->membershipTypeDelete(array('id' => $membership->id));
}
示例3: browse
/**
* Browse all membership types.
*
*
* @return void
*/
public function browse()
{
// get all membership types sorted by weight
$membershipType = array();
$dao = new CRM_Member_DAO_MembershipType();
$dao->orderBy('weight');
$dao->find();
while ($dao->fetch()) {
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('view contributions of type ' . CRM_Contribute_PseudoConstant::financialType($dao->financial_type_id))) {
continue;
}
$links = self::links();
$membershipType[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $membershipType[$dao->id]);
$membershipType[$dao->id]['period_type'] = CRM_Utils_Array::value($dao->period_type, CRM_Core_SelectValues::periodType(), '');
$membershipType[$dao->id]['visibility'] = CRM_Utils_Array::value($dao->visibility, CRM_Core_SelectValues::memberVisibility(), '');
//adding column for relationship type label. CRM-4178.
if ($dao->relationship_type_id) {
//If membership associated with 2 or more relationship then display all relationship with comma separated
$relTypeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->relationship_type_id);
$relTypeNames = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->relationship_direction);
$membershipType[$dao->id]['relationshipTypeName'] = NULL;
foreach ($relTypeIds as $key => $value) {
$relationshipName = 'label_' . $relTypeNames[$key];
if ($membershipType[$dao->id]['relationshipTypeName']) {
$membershipType[$dao->id]['relationshipTypeName'] .= ", ";
}
$membershipType[$dao->id]['relationshipTypeName'] .= CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $value, $relationshipName);
}
$membershipType[$dao->id]['maxRelated'] = CRM_Utils_Array::value('max_related', $membershipType[$dao->id]);
}
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('edit contributions of type ' . CRM_Contribute_PseudoConstant::financialType($dao->financial_type_id))) {
unset($links[CRM_Core_Action::UPDATE], $links[CRM_Core_Action::ENABLE], $links[CRM_Core_Action::DISABLE]);
}
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('delete contributions of type ' . CRM_Contribute_PseudoConstant::financialType($dao->financial_type_id))) {
unset($links[CRM_Core_Action::DELETE]);
}
// form all action links
$action = array_sum(array_keys($this->links()));
// update enable/disable links depending on if it is is_reserved or is_active
if (!isset($dao->is_reserved)) {
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$membershipType[$dao->id]['order'] = $membershipType[$dao->id]['weight'];
$membershipType[$dao->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $dao->id), ts('more'), FALSE, 'membershipType.manage.action', 'MembershipType', $dao->id);
}
}
$returnURL = CRM_Utils_System::url('civicrm/admin/member/membershipType', "reset=1&action=browse");
CRM_Utils_Weight::addOrder($membershipType, 'CRM_Member_DAO_MembershipType', 'id', $returnURL);
CRM_Member_BAO_MembershipType::convertDayFormat($membershipType);
$this->assign('rows', $membershipType);
}
示例4: browse
/**
* Browse all membership types.
*
*
* @return void
* @access public
* @static
*/
function browse()
{
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
// get all membership types sorted by weight
$membershipType = array();
$dao = new CRM_Member_DAO_MembershipType();
$dao->orderBy('weight');
$dao->find();
while ($dao->fetch()) {
$membershipType[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $membershipType[$dao->id]);
//adding column for relationship type label. CRM-4178.
if ($dao->relationship_type_id) {
//If membership associated with 2 or more relationship then display all relationship with comma separated
$relTypeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->relationship_type_id);
$relTypeNames = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->relationship_direction);
$membershipType[$dao->id]['relationshipTypeName'] = NULL;
foreach ($relTypeIds as $key => $value) {
$relationshipName = 'label_' . $relTypeNames[$key];
if ($membershipType[$dao->id]['relationshipTypeName']) {
$membershipType[$dao->id]['relationshipTypeName'] .= ", ";
}
$membershipType[$dao->id]['relationshipTypeName'] .= CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $value, $relationshipName);
}
$membershipType[$dao->id]['maxRelated'] = CRM_Utils_Array::value('max_related', $membershipType[$dao->id]);
}
// form all action links
$action = array_sum(array_keys($this->links()));
// update enable/disable links depending on if it is is_reserved or is_active
if (!isset($dao->is_reserved)) {
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$membershipType[$dao->id]['order'] = $membershipType[$dao->id]['weight'];
$membershipType[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), FALSE, 'membershipType.manage.action', 'MembershipType', $dao->id);
}
}
$returnURL = CRM_Utils_System::url('civicrm/admin/member/membershipType', "reset=1&action=browse");
CRM_Utils_Weight::addOrder($membershipType, 'CRM_Member_DAO_MembershipType', 'id', $returnURL);
CRM_Member_BAO_MembershipType::convertDayFormat($membershipType);
$this->assign('rows', $membershipType);
}