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


PHP CRM_Core_BAO_CustomField::validateCustomData方法代码示例

本文整理汇总了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();
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:45,代码来源:AJAX.php

示例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();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:42,代码来源:AJAX.php


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