本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms方法的具体用法?PHP CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms怎么用?PHP CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_mailing_create
/**
* Handle a create event.
*
* @param array $params
*
* @return array
* API Success Array
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
function civicrm_api3_mailing_create($params)
{
if (CRM_Mailing_Info::workflowEnabled()) {
// Note: 'schedule mailings' and 'approve mailings' can update certain fields, but can't create.
if (empty($params['id'])) {
if (!CRM_Core_Permission::check('access CiviMail') && !CRM_Core_Permission::check('create mailings')) {
throw new \Civi\API\Exception\UnauthorizedException("Cannot create new mailing. Required permission: 'access CiviMail' or 'create mailings'");
}
}
$safeParams = array();
$fieldPerms = CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms();
foreach (array_keys($params) as $field) {
if (CRM_Core_Permission::check($fieldPerms[$field])) {
$safeParams[$field] = $params[$field];
}
}
} else {
$safeParams = $params;
}
$safeParams['_evil_bao_validator_'] = 'CRM_Mailing_BAO_Mailing::checkSendable';
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $safeParams);
}