本文整理汇总了PHP中CRM_Custom_Form_CustomData::preProcess方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Custom_Form_CustomData::preProcess方法的具体用法?PHP CRM_Custom_Form_CustomData::preProcess怎么用?PHP CRM_Custom_Form_CustomData::preProcess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Custom_Form_CustomData
的用法示例。
在下文中一共展示了CRM_Custom_Form_CustomData::preProcess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
parent::preProcess();
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_System::setTitle(ts('Configure Survey') . ' - ' . $this->_surveyTitle);
}
// 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);
}
if ($this->_name != 'Petition') {
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey Dashboard'), 'url' => $url)));
}
$this->_values = $this->get('values');
if (!is_array($this->_values)) {
$this->_values = array();
if ($this->_surveyId) {
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $this->_values);
}
$this->set('values', $this->_values);
}
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
// for custom data
$this->assign('entityID', $this->_surveyId);
}
示例2: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access 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();
if ($this->_id) {
$this->assign('entityID', $this->_id);
$eventType = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'event_type_id');
} else {
$eventType = 'null';
}
$showLocation = false;
// when custom data is included in this page
if (CRM_Utils_Array::value("hidden_custom", $_POST)) {
$this->set('type', 'Event');
$this->set('subType', CRM_Utils_Array::value('event_type_id', $_POST));
$this->set('entityId', $this->_id);
CRM_Custom_Form_Customdata::preProcess($this);
CRM_Custom_Form_Customdata::buildQuickForm($this);
CRM_Custom_Form_Customdata::setDefaultValues($this);
}
}
示例3: preProcess
public function preProcess()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($this->_surveyId) {
$this->_single = TRUE;
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo);
$this->_surveyTitle = $surveyInfo['title'];
$this->assign('surveyTitle', $this->_surveyTitle);
CRM_Utils_System::setTitle(ts('Configure Survey - %1', array(1 => $this->_surveyTitle)));
}
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Event');
$this->set('entityId', $this->_surveyId);
CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// CRM-11480, CRM-11682
// Preload libraries required by the "Questions" tab
CRM_UF_Page_ProfileEditor::registerProfileScripts();
CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ActivityModel'));
CRM_Campaign_Form_Survey_TabHeader::build($this);
}
示例4: preProcess
public function preProcess()
{
// we do not want to display recently viewed items, so turn off
$this->assign('displayRecent', FALSE);
// component null in controller object - fix? dgg
// $this->_component = $this->controller->get('component');
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this);
$this->assign('component', $this->_component);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
$this->_pageId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
$title = ts('Setup a Personal Campaign Page - Step 2');
if ($this->_pageId) {
$title = ts('Edit Your Personal Campaign Page');
}
CRM_Utils_System::setTitle($title);
//MV: to get the Custom Data preProcess
if (CRM_Core_Permission::check('administer CiviCRM')) {
$this->_cdType = 'PCP';
$this->_customValueCount = 1;
CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, $this->_cdType, $this->_pageId, NULL);
}
//END
parent::preProcess();
}
示例5: preProcess
public function preProcess()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE)) {
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_System::setTitle(ts('Edit Survey'));
} else {
CRM_Utils_System::setTitle(ts('Delete Survey'));
}
}
$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);
}
// 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);
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
$session->pushUserContext($url);
$this->_values = $this->get('values');
if (!is_array($this->_values)) {
$this->_values = array();
if ($this->_surveyId) {
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $this->_values);
}
$this->set('values', $this->_values);
}
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
// for custom data
$this->assign('entityID', $this->_surveyId);
if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE)) {
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_System::setTitle(ts('Edit Petition'));
} else {
CRM_Utils_System::setTitle(ts('Delete Petition'));
}
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=petition');
$session->pushUserContext($url);
CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Petition Dashboard'), 'url' => $url)));
}
示例6: preProcess
/**
* Call preprocess.
*/
public function preProcess()
{
parent::preProcess();
$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE, NULL, $_REQUEST);
$this->assign('customGroupId', $this->_groupID);
$customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', $this, FALSE, 1, $_REQUEST);
$cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', $this, FALSE, 1, $_REQUEST);
$subType = CRM_Contact_BAO_Contact::getContactSubType($this->_contactId, ',');
CRM_Custom_Form_CustomData::preProcess($this, NULL, $subType, $cgcount, $this->_contactType, $this->_contactId);
}
示例7: preProcess
/**
* call preprocess
*/
public function preProcess()
{
//get all the existing email addresses
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE, NULL, $_REQUEST);
$this->assign('contactId', $this->_contactId);
$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE, NULL, $_REQUEST);
$this->assign('customGroupId', $this->_groupID);
$type = CRM_Contact_BAO_Contact::getContactType($this->_contactId);
$subType = CRM_Contact_BAO_Contact::getContactSubType($this->_contactId, ',');
CRM_Custom_Form_CustomData::preProcess($this, null, $subType, 1, $type, $this->_contactId);
}
示例8: preProcess
/**
* Build all the data structures needed to build the form.
*
* @param CRM_Core_Form $form
*/
public static function preProcess(&$form)
{
$form->_type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
$form->_subType = CRM_Utils_Request::retrieve('subType', 'String', CRM_Core_DAO::$_nullObject);
//build the custom data as other blocks.
//$form->assign( "addBlock", false );
if ($form->_type) {
$form->_addBlockName = 'CustomData';
$form->assign("addBlock", TRUE);
$form->assign("blockName", $form->_addBlockName);
}
CRM_Custom_Form_CustomData::preProcess($form, NULL, $form->_subType, NULL, $form->_type ? $form->_type : $form->_contactType);
//assign group tree after build.
$form->assign('groupTree', $form->_groupTree);
}
示例9: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
parent::preProcess();
if ($this->_id) {
$this->assign('entityID', $this->_id);
$eventType = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'event_type_id');
} else {
$eventType = 'null';
}
$showLocation = FALSE;
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Event');
$this->set('subType', CRM_Utils_Array::value('event_type_id', $_POST));
$this->set('entityId', $this->_id);
CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_eventType, 1, 'Event', $this->_id);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
}
示例10: 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']);
//.........这里部分代码省略.........
示例11: applyCustomData
/**
* @param string $type
* Eg 'Contribution'.
* @param string $subType
* @param int $entityId
*/
public function applyCustomData($type, $subType, $entityId)
{
$this->set('type', $type);
$this->set('subType', $subType);
$this->set('entityId', $entityId);
CRM_Custom_Form_CustomData::preProcess($this, NULL, $subType, 1, $type, $entityId);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
示例12: preProcess
/**
* Function to build the form
*
* @return None
* @access public
*/
function preProcess()
{
$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);
}
$this->_caseId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if ($this->_action & CRM_Core_Action::ADD && !$this->_currentlyViewedContactId) {
// check for add contacts permissions
if (!CRM_Core_Permission::check('add contacts')) {
CRM_Utils_System::permissionDenied();
return;
}
}
//CRM-4418
if (!CRM_Core_Permission::checkActionPermission('CiviCase', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
return TRUE;
}
if (!$this->_caseId) {
$caseAttributes = array('case_type' => CRM_Case_PseudoConstant::caseType(), 'case_status' => CRM_Case_PseudoConstant::caseStatus(), 'encounter_medium' => CRM_Case_PseudoConstant::encounterMedium());
foreach ($caseAttributes as $key => $values) {
if (empty($values)) {
CRM_Core_Error::fatal(ts('You do not have any active %1', array(1 => str_replace('_', ' ', $key))));
break;
}
}
}
if ($this->_action & CRM_Core_Action::ADD) {
$this->_activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
if (!$this->_activityTypeId) {
CRM_Core_Error::fatal(ts('The Open Case activity type is missing or disabled. Please have your site administrator check Administer > Option Lists > Activity Types for the CiviCase component.'));
}
}
//check for case permissions.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
if ($this->_action & CRM_Core_Action::ADD && (!CRM_Core_Permission::check('access all cases and activities') && !CRM_Core_Permission::check('add cases'))) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
if ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, 'Case')) {
$this->assign('activityTypeFile', $this->_activityTypeFile);
}
$details = CRM_Case_PseudoConstant::caseActivityType(FALSE);
CRM_Utils_System::setTitle($details[$this->_activityTypeId]['label']);
$this->assign('activityType', $details[$this->_activityTypeId]['label']);
$this->assign('activityTypeDescription', $details[$this->_activityTypeId]['description']);
if (isset($this->_currentlyViewedContactId)) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $this->_currentlyViewedContactId;
if (!$contact->find(TRUE)) {
CRM_Core_Error::statusBounce(ts('Client contact does not exist: %1', array(1 => $this->_currentlyViewedContactId)));
}
$this->assign('clientName', $contact->display_name);
}
$session = CRM_Core_Session::singleton();
$this->_currentUserId = $session->get('userID');
//when custom data is included in this page
CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_activityTypeId, 1, 'Activity');
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
$activityGroupTree = $this->_groupTree;
// for case custom fields to populate with defaults
if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
// so that grouptree is not populated with case fields, since the grouptree is used
// for populating activity custom fields.
$this->_groupTree = $activityGroupTree;
}
示例13: preProcess
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);
}
$this->_contactId = $this->get('contactId');
$this->_relationshipId = $this->get('id');
$this->_rtype = CRM_Utils_Request::retrieve('rtype', 'String', $this);
$this->_rtypeId = CRM_Utils_Request::retrieve('relTypeId', 'String', $this);
$this->_display_name_a = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'display_name');
$this->assign('sort_name_a', $this->_display_name_a);
$this->_caseId = CRM_Utils_Request::retrieve('caseID', 'Integer', $this);
//get the relationship values.
$this->_values = array();
if ($this->_relationshipId) {
$params = array('id' => $this->_relationshipId);
CRM_Core_DAO::commonRetrieve('CRM_Contact_DAO_Relationship', $params, $this->_values);
}
if (!$this->_rtypeId) {
$params = $this->controller->exportValues($this->_name);
if (isset($params['relationship_type_id'])) {
$this->_rtypeId = $params['relationship_type_id'];
} else {
if (!empty($this->_values)) {
$this->_rtypeId = $this->_values['relationship_type_id'] . '_' . $this->_rtype;
}
}
}
//get the relationship type id
$this->_relationshipTypeId = str_replace(array('_a_b', '_b_a'), array('', ''), $this->_rtypeId);
//get the relationship type
if (!$this->_rtype) {
$this->_rtype = str_replace($this->_relationshipTypeId . '_', '', $this->_rtypeId);
}
$this->assign("rtype", $this->_rtype);
require_once 'CRM/Core/PseudoConstant.php';
//use name as it remain constant, CRM-3336
$this->_allRelationshipNames = CRM_Core_PseudoConstant::relationshipType('name');
// 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);
}
}
示例14: preProcess
/**
* pre processing work done here.
*
* gets session variables for table name, id of entity in table, type of entity and stores them.
*
* @param
* @return void
*
* @access public
*
*/
function preProcess()
{
$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);
}
$this->_groupID = CRM_Utils_Request::retrieve('groupId', 'Positive', $this, true);
$this->_tableID = CRM_Utils_Request::retrieve('tableId', 'Positive', $this, true);
require_once "CRM/Contact/BAO/Contact.php";
$this->_contactType = CRM_Contact_BAO_Contact::getContactType($this->_tableID);
$this->_contactSubType = CRM_Contact_BAO_Contact::getContactSubType($this->_tableID);
$this->assign('contact_type', $this->_contactType);
$this->assign('contact_subtype', $this->_contactSubType);
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_tableID);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
// when custom data is included in this page
if (CRM_Utils_Array::value("hidden_custom", $_POST)) {
for ($i; $i <= $_POST['hidden_custom_group_count'][$this->_groupID]; $i++) {
CRM_Custom_Form_CustomData::preProcess($this, null, null, $i);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
}
}
示例15: preProcess
/**
* Set up variables to build the form.
*/
public function preProcess()
{
$this->_id = $this->get('id');
if ($this->_id) {
$breadCrumb = array(array('title' => ts('Manage Groups'), 'url' => CRM_Utils_System::url('civicrm/group', 'reset=1')));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->_groupValues = array();
$params = array('id' => $this->_id);
$this->_group = CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues);
$this->_title = $this->_groupValues['title'];
}
$this->assign('action', $this->_action);
$this->assign('showBlockJS', TRUE);
if ($this->_action == CRM_Core_Action::DELETE) {
if (isset($this->_id)) {
$this->assign('title', $this->_title);
$this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id));
CRM_Utils_System::setTitle(ts('Confirm Group Delete'));
}
if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to delete this reserved group."));
}
} else {
if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to change settings for this reserved group."));
}
if (isset($this->_id)) {
$groupValues = array('id' => $this->_id, 'title' => $this->_title, 'saved_search_id' => isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '');
if (isset($this->_groupValues['saved_search_id'])) {
$groupValues['mapping_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'mapping_id');
$groupValues['search_custom_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'search_custom_id');
}
if (!empty($this->_groupValues['created_id'])) {
$groupValues['created_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'], 'sort_name', 'id');
}
if (!empty($this->_groupValues['modified_id'])) {
$groupValues['modified_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'], 'sort_name', 'id');
}
$this->assign_by_ref('group', $groupValues);
CRM_Utils_System::setTitle(ts('Group Settings: %1', array(1 => $this->_title)));
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/group', 'reset=1'));
}
//build custom data
CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Group', $this->_id);
}