本文整理汇总了PHP中CRM_Core_BAO_CustomField::validateCustomData方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomField::validateCustomData方法的具体用法?PHP CRM_Core_BAO_CustomField::validateCustomData怎么用?PHP CRM_Core_BAO_CustomField::validateCustomData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomField
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomField::validateCustomData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerInterview
static function registerInterview()
{
$fields = array('result', 'voter_id', 'survey_id', 'activity_id', 'surveyTitle', 'interviewer_id', 'activity_type_id');
$params = array();
foreach ($fields as $fld) {
$params[$fld] = CRM_Utils_Array::value($fld, $_POST);
}
$params['details'] = CRM_Utils_Array::value('note', $_POST);
$voterId = $params['voter_id'];
$activityId = $params['activity_id'];
$customKey = "field_{$voterId}_custom";
foreach ($_POST as $key => $value) {
if (strpos($key, $customKey) !== FALSE) {
$customFieldKey = str_replace(str_replace(substr($customKey, -6), '', $customKey), '', $key);
$params[$customFieldKey] = $value;
}
}
if (isset($_POST['field']) && !empty($_POST['field'][$voterId]) && is_array($_POST['field'][$voterId])) {
foreach ($_POST['field'][$voterId] as $fieldKey => $value) {
$params[$fieldKey] = $value;
}
}
//lets pickup contat related fields.
foreach ($_POST as $key => $value) {
if (strpos($key, "field_{$voterId}_") !== FALSE && strpos($key, "field_{$voterId}_custom") === FALSE) {
$key = substr($key, strlen("field_{$voterId}_"));
$params[$key] = $value;
}
}
$result = array('status' => 'fail', 'voter_id' => $voterId, 'activity_id' => $params['interviewer_id']);
//time to validate custom data.
$errors = CRM_Core_BAO_CustomField::validateCustomData($params);
if (is_array($errors) && !empty($errors)) {
$result['errors'] = $errors;
echo json_encode($result);
CRM_Utils_System::civiExit();
}
//process the response/interview data.
$activityId = CRM_Campaign_Form_Task_Interview::registerInterview($params);
if ($activityId) {
$result['status'] = 'success';
}
echo json_encode($result);
CRM_Utils_System::civiExit();
}
示例2: registerInterview
static function registerInterview()
{
$fields = array('result', 'voter_id', 'ufGroupId', 'activity_id', 'surveyTitle', 'interviewer_id', 'activity_type_id');
$params = array();
foreach ($fields as $fld) {
$params[$fld] = CRM_Utils_Array::value($fld, $_POST);
}
$params['details'] = CRM_Utils_Array::value('note', $_POST);
$voterId = $params['voter_id'];
$activityId = $params['activity_id'];
$customKey = "field_{$voterId}_custom";
foreach ($_POST as $key => $value) {
if (strpos($key, $customKey) !== false) {
$customFieldKey = str_replace(str_replace(substr($customKey, -6), '', $customKey), '', $key);
$params[$customFieldKey] = $value;
}
}
if (isset($_POST['field']) && CRM_Utils_Array::value($voterId, $_POST['field']) && is_array($_POST['field'][$voterId])) {
foreach ($_POST['field'][$voterId] as $fieldKey => $value) {
$params[$fieldKey] = $value;
}
}
require_once "CRM/Utils/JSON.php";
$result = array('status' => 'fail', 'voter_id' => $voterId, 'activity_id' => $params['interviewer_id']);
//time to validate custom data.
require_once 'CRM/Core/BAO/CustomField.php';
$errors = CRM_Core_BAO_CustomField::validateCustomData($params);
if (is_array($errors) && !empty($errors)) {
$result['errors'] = $errors;
echo json_encode($result);
CRM_Utils_System::civiExit();
}
//process the response/interview data.
require_once 'CRM/Campaign/Form/Task/Interview.php';
$activityId = CRM_Campaign_Form_Task_Interview::registerInterview($params);
if ($activityId) {
$result['status'] = 'success';
}
require_once "CRM/Utils/JSON.php";
echo json_encode($result);
CRM_Utils_System::civiExit();
}