本文整理汇总了PHP中CRM_Custom_Form_CustomData类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Custom_Form_CustomData类的具体用法?PHP CRM_Custom_Form_CustomData怎么用?PHP CRM_Custom_Form_CustomData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Custom_Form_CustomData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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);
}
开发者ID:scardinius,项目名称:civicrm-core,代码行数:31,代码来源:Survey.php
示例2: 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);
}
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:32,代码来源:Main.php
示例3: 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)));
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:56,代码来源:Petition.php
示例4: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access 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);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:21,代码来源:CustomData.php
示例5: preProcess
/**
* Preprocess function.
*/
public function preProcess()
{
$this->_type = $this->_cdType = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject, TRUE);
$this->_subType = CRM_Utils_Request::retrieve('subType', 'String');
$this->_subName = CRM_Utils_Request::retrieve('subName', 'String');
$this->_groupCount = CRM_Utils_Request::retrieve('cgcount', 'Positive');
$this->_entityId = CRM_Utils_Request::retrieve('entityID', 'Positive');
$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive');
$this->assign('cdType', FALSE);
$this->assign('cgCount', $this->_groupCount);
if (!is_array($this->_subType) && strstr($this->_subType, CRM_Core_DAO::VALUE_SEPARATOR)) {
$this->_subType = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($this->_subType, CRM_Core_DAO::VALUE_SEPARATOR));
}
CRM_Custom_Form_CustomData::setGroupTree($this, $this->_subType, NULL, $this->_groupID);
$this->assign('suppressForm', TRUE);
$this->controller->_generateQFKey = FALSE;
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:20,代码来源:CustomDataByType.php
示例6: preProcess
/**
* Preprocess function.
*/
public function preProcess()
{
$this->_type = $this->_cdType = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject, TRUE);
$this->_subType = CRM_Utils_Request::retrieve('subType', 'String');
$this->_subName = CRM_Utils_Request::retrieve('subName', 'String');
$this->_groupCount = CRM_Utils_Request::retrieve('cgcount', 'Positive');
$this->_entityId = CRM_Utils_Request::retrieve('entityID', 'Positive');
$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive');
$this->assign('cdType', FALSE);
$this->assign('cgCount', $this->_groupCount);
// Carry qf key, since this form is not inheriting core form (unclear is still the case).
if ($qfKey = CRM_Utils_Request::retrieve('qfKey', 'String')) {
$this->assign('qfKey', $qfKey);
}
if (!is_array($this->_subType) && strstr($this->_subType, CRM_Core_DAO::VALUE_SEPARATOR)) {
$this->_subType = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($this->_subType, CRM_Core_DAO::VALUE_SEPARATOR));
}
CRM_Custom_Form_CustomData::setGroupTree($this, $this->_subType, NULL, $this->_groupID);
}
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:22,代码来源:CustomDataByType.php
示例7: 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);
}
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:23,代码来源:EventInfo.php
示例8: buildQuickForm
public function buildQuickForm()
{
$xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
$isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients();
$this->assign('multiClient', $isMultiClient);
if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
$title = 'Delete';
if ($this->_action & CRM_Core_Action::RENEW) {
$title = 'Restore';
}
$this->addButtons(array(array('type' => 'next', 'name' => $title, 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//need to assign custom data type and subtype to the template
$this->assign('customDataType', 'Case');
CRM_Custom_Form_CustomData::buildQuickForm($this);
// we don't want to show button on top of custom form
$this->assign('noPreCustomButton', TRUE);
$s = CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject');
if (!is_array($s)) {
$s = array();
}
$this->add('text', 'activity_subject', ts('Subject'), array_merge($s, array('maxlength' => '128')), TRUE);
$tags = CRM_Core_BAO_Tag::getTags('civicrm_case');
if (!empty($tags)) {
$this->add('select', 'tag', ts('Select Tags'), $tags, FALSE, array('id' => 'tags', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
// build tag widget
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_case');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_case', NULL, FALSE, TRUE);
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}::buildQuickForm( \$this );");
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:36,代码来源:Case.php
示例9: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
$relTypeID = explode('_', $this->_rtypeId, 3);
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$callAjax = $this->get('callAjax');
$searchRows = null;
if (!$callAjax) {
$searchRows = $this->get('searchRows');
} else {
$this->addElement('hidden', 'store_contacts', '', array('id' => 'store_contacts'));
$sourceUrl = 'snippet=4&relType=' . $this->get('relType');
$sourceUrl .= '&relContact=' . $this->get('relContact');
$sourceUrl .= '&cid=' . $this->_contactId;
$this->assign('searchCount', true);
// To handle employee of and employer of
if (!empty($this->_relationshipTypeId) && !empty($this->_rtype)) {
$sourceUrl .= '&typeName=' . $this->_allRelationshipNames[$this->_relationshipTypeId]["name_{$this->_rtype}"];
}
$this->assign('sourceUrl', CRM_Utils_System::url('civicrm/ajax/relationshipcontacts', $sourceUrl, false, null, false));
}
$this->assign('callAjax', $callAjax);
$this->_callAjax = $callAjax;
$this->addElement('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getContactRelationshipType($this->_contactId, $this->_rtype, $this->_relationshipId, null, false, 'label'));
// add a ajax facility for searching contacts
$dataUrl = CRM_Utils_System::url("civicrm/ajax/search", "reset=1", true, null, false);
$this->assign('dataUrl', $dataUrl);
$this->add('text', 'rel_contact', ts('Find Target Contact'));
$this->add('hidden', "rel_contact_id");
$this->addDate('start_date', ts('Start Date'), false, array('formatType' => 'searchDate'));
$this->addDate('end_date', ts('End Date'), false, array('formatType' => 'searchDate'));
$this->addElement('advcheckbox', 'is_active', ts('Enabled?'), null, 'setChecked()');
$this->addElement('checkbox', 'is_permission_a_b', ts('Permission for contact a to view and update information for contact b'), null);
$this->addElement('checkbox', 'is_permission_b_a', ts('permission for contact b to view and update information for contact a'), null);
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Relationship', 'description'));
CRM_Contact_Form_Edit_Notes::buildQuickForm($this);
$searchCount = $this->get('searchCount');
$duplicateRelationship = $this->get('duplicateRelationship');
$searchDone = $this->get('searchDone');
$isEmployeeOf = $isEmployerOf = false;
if (!empty($this->_relationshipTypeId) && !empty($this->_rtype)) {
if ($this->_allRelationshipNames[$this->_relationshipTypeId]["name_{$this->_rtype}"] == 'Employee of') {
$isEmployeeOf = true;
} else {
if ($this->_allRelationshipNames[$this->_relationshipTypeId]["name_{$this->_rtype}"] == 'Employer of') {
$isEmployerOf = true;
}
}
}
$employers = $checkBoxes = $employees = array();
if ($searchRows) {
foreach ($searchRows as $id => $row) {
$checkBoxes[$id] = $this->createElement('checkbox', $id, null, '');
if ($isEmployeeOf) {
$employers[$id] = $this->createElement('radio', null, $id, null, $id);
} else {
if ($isEmployerOf) {
$employees[$id] = $this->createElement('checkbox', $id, null, '');
}
}
}
$this->addGroup($checkBoxes, 'contact_check');
$this->assign('searchRows', $searchRows);
}
if ($isEmployeeOf) {
$this->assign('isEmployeeOf', $isEmployeeOf);
if (!$callAjax) {
$this->addGroup($employers, 'employee_of');
}
} else {
if ($isEmployerOf) {
$this->assign('isEmployerOf', $isEmployerOf);
if (!$callAjax) {
$this->addGroup($employees, 'employer_of');
}
}
}
if ($callAjax && ($isEmployeeOf || $isEmployerOf)) {
$this->addElement('hidden', 'store_employers', '', array('id' => 'store_employers'));
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$this->addElement('checkbox', 'is_current_employer');
}
$this->assign('duplicateRelationship', $duplicateRelationship);
$this->assign('searchCount', $searchCount);
$this->assign('searchDone', $searchDone);
if ($this->get('contact_type')) {
require_once 'CRM/Contact/BAO/ContactType.php';
$typeLabel = CRM_Contact_BAO_ContactType::getLabel($this->get('contact_type'));
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Relationship.php
示例10: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
//@todo document the purpose of cdType (if still in use)
if ($this->_cdType) {
CRM_Custom_Form_CustomData::buildQuickForm($this);
return;
}
$allPanes = array();
//tax rate from financialType
$this->assign('taxRates', json_encode(CRM_Core_PseudoConstant::getTaxRates()));
$this->assign('currencies', json_encode(CRM_Core_OptionGroup::values('currencies_enabled')));
// build price set form.
$buildPriceSet = FALSE;
$invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$this->assign('invoicing', $invoicing);
// display tax amount on edit contribution page
if ($invoicing && $this->_action & CRM_Core_Action::UPDATE && isset($this->_values['tax_amount'])) {
$this->assign('totalTaxAmount', $this->_values['tax_amount']);
}
if (empty($this->_lineItems) && ($this->_priceSetId || !empty($_POST['price_set_id']))) {
$buildPriceSet = TRUE;
$getOnlyPriceSetElements = TRUE;
if (!$this->_priceSetId) {
$this->_priceSetId = $_POST['price_set_id'];
$getOnlyPriceSetElements = FALSE;
}
$this->set('priceSetId', $this->_priceSetId);
CRM_Price_BAO_PriceSet::buildPriceSet($this);
// get only price set form elements.
if ($getOnlyPriceSetElements) {
return;
}
}
// use to build form during form rule.
$this->assign('buildPriceSet', $buildPriceSet);
$showAdditionalInfo = FALSE;
$defaults = $this->_values;
$additionalDetailFields = array('note', 'thankyou_date', 'invoice_id', 'non_deductible_amount', 'fee_amount', 'net_amount');
foreach ($additionalDetailFields as $key) {
if (!empty($defaults[$key])) {
$defaults['hidden_AdditionalDetail'] = 1;
break;
}
}
if ($this->_productDAO) {
if ($this->_productDAO->product_id) {
$defaults['hidden_Premium'] = 1;
}
}
if ($this->_noteID && isset($this->_values['note'])) {
$defaults['hidden_AdditionalDetail'] = 1;
}
$paneNames = array(ts('Additional Details') => 'AdditionalDetail');
//Add Premium pane only if Premium is exists.
$dao = new CRM_Contribute_DAO_Product();
$dao->is_active = 1;
if ($dao->find(TRUE)) {
$paneNames[ts('Premium Information')] = 'Premium';
}
$billingPanes = array();
if ($this->_mode) {
if (CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE) == TRUE) {
$buildRecurBlock = TRUE;
foreach ($this->billingPane as $name => $label) {
if (!empty($this->billingFieldSets[$name]['fields'])) {
// @todo reduce variation so we don't have to convert 'credit_card' to 'CreditCard'
$billingPanes[$label] = $this->generatePane(CRM_Utils_String::convertStringToCamel($name), $defaults);
}
}
}
}
foreach ($paneNames as $name => $type) {
$allPanes[$name] = $this->generatePane($type, $defaults);
}
if (empty($this->_recurPaymentProcessors)) {
$buildRecurBlock = FALSE;
}
if ($buildRecurBlock) {
CRM_Contribute_Form_Contribution_Main::buildRecur($this);
$this->setDefaults(array('is_recur' => 0));
}
$this->assign('buildRecurBlock', $buildRecurBlock);
$qfKey = $this->controller->_key;
$this->assign('qfKey', $qfKey);
$this->assign('billingPanes', $billingPanes);
$this->assign('allPanes', $allPanes);
$this->addFormRule(array('CRM_Contribute_Form_Contribution', 'formRule'), $this);
if ($this->_formType) {
$this->assign('formType', $this->_formType);
return;
}
$this->applyFilter('__ALL__', 'trim');
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
//.........这里部分代码省略.........
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:101,代码来源:Contribution.php
示例11: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
if ($this->_showFeeBlock) {
return CRM_Event_Form_EventFees::buildQuickForm($this);
}
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//need to assign custom data type to the template
$this->assign('customDataType', 'Participant');
$this->applyFilter('__ALL__', 'trim');
if ($this->_action & CRM_Core_Action::DELETE) {
if ($this->_single) {
require_once 'CRM/Event/BAO/Event.php';
$additionalParticipant = count(CRM_Event_BAO_Event::buildCustomProfile($this->_participantId, null, $this->_contactID, false, true)) - 1;
if ($additionalParticipant) {
$this->assign("additionalParticipant", $additionalParticipant);
}
}
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
if ($this->_single) {
$urlPath = 'civicrm/contact/view/participant';
$urlParams = "reset=1&cid={$this->_contactID}&context=participant";
if ($this->_context == 'standalone') {
require_once 'CRM/Contact/Form/NewContact.php';
CRM_Contact_Form_NewContact::buildQuickForm($this);
$urlParams = "reset=1&context=standalone";
$urlPath = 'civicrm/participant/add';
}
if ($this->_participantId) {
$urlParams .= "&action=update&id={$this->_participantId}";
} else {
$urlParams .= "&action=add";
}
if (CRM_Utils_Request::retrieve('past', 'Boolean', $this)) {
$urlParams .= "&past=true";
}
if ($this->_mode) {
$urlParams .= "&mode={$this->_mode}";
}
$url = CRM_Utils_System::url($urlPath, $urlParams, false, null, false);
} else {
$currentPath = CRM_Utils_System::currentPath();
$url = CRM_Utils_System::url($currentPath, '_qf_Participant_display=true', false, null, false);
}
$this->assign("refreshURL", $url);
$url .= "&past=true";
$this->assign("pastURL", $url);
$events = array();
$this->assign("past", false);
require_once "CRM/Event/BAO/Event.php";
if (CRM_Utils_Request::retrieve('past', 'Boolean', $this) || $this->_action & CRM_Core_Action::UPDATE) {
$events = CRM_Event_BAO_Event::getEvents(true);
$this->assign("past", true);
} else {
$events = CRM_Event_BAO_Event::getEvents();
}
if ($this->_mode) {
//unset the event which are not monetary when credit card
//event registration is used
foreach ($events as $key => $val) {
$isPaid = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $key, 'is_monetary');
if (!$isPaid) {
unset($events[$key]);
}
}
$this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, true);
}
$element = $this->add('select', 'event_id', ts('Event'), array('' => ts('- select -')) + $events, true, array('onchange' => "buildFeeBlock( this.value ); buildCustomData( 'Participant', this.value, {$this->_eventNameCustomDataTypeID} );", 'class' => 'huge'));
//frozen the field fix for CRM-4171
if ($this->_action & CRM_Core_Action::UPDATE && $this->_participantId) {
if (CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id')) {
$element->freeze();
}
}
$this->addDateTime('register_date', ts('Registration Date'), true);
if ($this->_participantId) {
$this->assign('entityID', $this->_participantId);
}
$this->add('select', 'role_id', ts('Participant Role'), array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantRole(), true, array('onchange' => "buildCustomData( 'Participant', this.value, {$this->_roleCustomDataTypeID} );"));
// CRM-4395
$checkCancelledJs = array('onchange' => "return sendNotification( );");
if ($this->_onlinePendingContributionId) {
$cancelledparticipantStatusId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus());
$cancelledContributionStatusId = array_search('Cancelled', CRM_Contribute_PseudoConstant::contributionStatus(null, 'name'));
$checkCancelledJs = array('onchange' => "checkCancelled( this.value, {$cancelledparticipantStatusId},{$cancelledContributionStatusId});");
}
$this->add('select', 'status_id', ts('Participant Status'), array('' => ts('- select -')) + CRM_Event_PseudoConstant::participantStatus(null, null, 'label'), true, $checkCancelledJs);
$this->addElement('checkbox', 'is_notify', ts('Send Notification'), null);
$this->add('text', 'source', ts('Event Source'));
$noteAttributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note');
$this->add('textarea', 'note', ts('Notes'), $noteAttributes['note']);
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Participant.php
示例12: buildQuickForm
//.........这里部分代码省略.........
$this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
}
$showAdditionalInfo = FALSE;
$this->_formType = CRM_Utils_Array::value('formType', $_GET);
$defaults = array();
$paneNames = array('Payment Reminders' => 'PaymentReminders');
foreach ($paneNames as $name => $type) {
$urlParams = "snippet=4&formType={$type}";
$allPanes[$name] = array('url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams), 'open' => 'false', 'id' => $type);
// see if we need to include this paneName in the current form
if ($this->_formType == $type || !empty($_POST["hidden_{$type}"]) || CRM_Utils_Array::value("hidden_{$type}", $defaults)) {
$showAdditionalInfo = TRUE;
$allPanes[$name]['open'] = 'true';
}
$fnName = "build{$type}";
CRM_Contribute_Form_AdditionalInfo::$fnName($this);
}
$this->assign('allPanes', $allPanes);
$this->assign('showAdditionalInfo', $showAdditionalInfo);
if ($this->_formType) {
$this->assign('formType', $this->_formType);
return;
}
$this->applyFilter('__ALL__', 'trim');
// pledge fields.
$attributes = CRM_Core_DAO::getAttribute('CRM_Pledge_DAO_Pledge');
$this->assign('isPending', $this->_isPending);
$js = array('onblur' => "calculatedPaymentAmount( );", 'onkeyup' => "calculatedPaymentAmount( );");
$currencyFreeze = FALSE;
if ($this->_id && !$this->_isPending) {
$currencyFreeze = TRUE;
}
$element = $this->addMoney('amount', ts('Total Pledge Amount'), TRUE, array_merge($attributes['pledge_amount'], $js), TRUE, 'currency', NULL, $currencyFreeze);
if ($this->_id && !$this->_isPending) {
$element->freeze();
}
$element =& $this->add('text', 'installments', ts('To be paid in'), array_merge($attributes['installments'], $js), TRUE);
$this->addRule('installments', ts('Please enter a valid number of installments.'), 'positiveInteger');
if ($this->_id && !$this->_isPending) {
$element->freeze();
}
$element =& $this->add('text', 'frequency_interval', ts('every'), $attributes['pledge_frequency_interval'], TRUE);
$this->addRule('frequency_interval', ts('Please enter a number for frequency (e.g. every "3" months).'), 'positiveInteger');
if ($this->_id && !$this->_isPending) {
$element->freeze();
}
// Fix frequency unit display for use with frequency_interval
$freqUnitsDisplay = array();
foreach ($this->_freqUnits as $val => $label) {
$freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label));
}
$element =& $this->add('select', 'frequency_unit', ts('Frequency'), array('' => ts('- select -')) + $freqUnitsDisplay, TRUE);
if ($this->_id && !$this->_isPending) {
$element->freeze();
}
$element =& $this->add('text', 'frequency_day', ts('Payments are due on the'), $attributes['frequency_day'], TRUE);
$this->addRule('frequency_day', ts('Please enter a valid payment due day.'), 'positiveInteger');
if ($this->_id && !$this->_isPending) {
$element->freeze();
}
$this->add('text', 'eachPaymentAmount', ts('each'), array('size' => 10, 'style' => "background-color:#EBECE4", 0 => 'READONLY'));
// add various dates
if (!$this->_id || $this->_isPending) {
$this->addDate('create_date', ts('Pledge Made'), TRUE);
$this->addDate('start_date', ts('Payments Start'), TRUE);
}
if ($this->_id && !$this->_isPending) {
$eachPaymentAmount = $this->_values['original_installment_amount'];
$this->assign('currency', $this->_values['currency']);
$this->assign('eachPaymentAmount', $eachPaymentAmount);
$this->assign('hideCalender', TRUE);
}
if (CRM_Utils_Array::value('status_id', $this->_values) != array_search('Cancelled', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'))) {
$this->addElement('checkbox', 'is_acknowledge', ts('Send Acknowledgment?'), NULL, array('onclick' => "showHideByValue( 'is_acknowledge', '', 'acknowledgeDate', 'table-row', 'radio', true); showHideByValue( 'is_acknowledge', '', 'fromEmail', 'table-row', 'radio', false );"));
$this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails);
}
$this->addDate('acknowledge_date', ts('Acknowledgment Date'));
$this->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), TRUE);
// CRM-7362 --add campaigns.
CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
$pageIds = array();
CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgeBlock', 'entity_table', 'civicrm_contribution_page', $pageIds, array('entity_id'));
$pages = CRM_Contribute_PseudoConstant::contributionPage();
$pledgePages = array();
foreach ($pageIds as $key => $value) {
$pledgePages[$value['entity_id']] = $pages[$value['entity_id']];
}
$ele = $this->add('select', 'contribution_page_id', ts('Self-service Payments Page'), array('' => ts('- select -')) + $pledgePages);
$mailingInfo = Civi::settings()->get('mailing_backend');
$this->assign('outBound_option', $mailingInfo['outBound_option']);
// build custom data
CRM_Custom_Form_CustomData::buildQuickForm($this);
// make this form an upload since we dont know if the custom data injected dynamically
// is of type file etc $uploadNames = $this->get( 'uploadNames' );
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'js' => array('onclick' => "return verify( );"), 'isDefault' => TRUE), array('type' => 'upload', 'name' => ts('Save and New'), 'js' => array('onclick' => "return verify( );"), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->addFormRule(array('CRM_Pledge_Form_Pledge', 'formRule'), $this);
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
}
}
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:101,代码来源:Pledge.php
示例13: preProcess
/**
* Pre-process form.
*
* @throws \Exception
*/
public function preProcess()
{
// This string makes up part of the class names, differentiating them (not sure why) from the membership fields.
$this->assign('formClass', 'membershiprenew');
parent::preProcess();
// check for edit permission
if (!CRM_Core_Permission::check('edit memberships')) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$this->assign('endDate', CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'end_date')));
$this->assign('membershipStatus', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'status_id'), 'name'));
if ($this->_mode) {
$membershipFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'minimum_fee');
if (!$membershipFee) {
$statusMsg = ts('Membership Renewal using a credit card requires a Membership fee. Since there is no fee associated with the selected membership type, you can use the normal renewal mode.');
CRM_Core_Session::setStatus($statusMsg, '', 'info');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership"));
}
}
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_memType, 1, 'Membership', $this->_id);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
CRM_Utils_System::setTitle(ts('Renew Membership'));
parent::preProcess();
}
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:33,代码来源:MembershipRenewal.php
示例14: preProcess
//.........这里部分代码省略.........
$session =& CRM_Core_Session::singleton();
if ($this->_action == CRM_Core_Action::ADD) {
// check for add contacts permissions
require_once 'CRM/Core/Permission.php';
if (!CRM_Core_Permission::check('add contacts')) {
CRM_Utils_System::permissionDenied();
return;
}
$this->_contactType = CRM_Utils_Request::retrieve('ct', 'String', $this, true, null, 'REQUEST');
if (!in_array($this->_contactType, array('Individual', 'Household', 'Organization'))) {
CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
}
$this->_contactSubType = CRM_Utils_Request::retrieve('cst', 'String', $this);
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Integer', CRM_Core_DAO::$_nullObject, false, null, 'GET');
$this->_tid = CRM_Utils_Request::retrieve('tid', 'Integer', CRM_Core_DAO::$_nullObject, false, null, 'GET');
if ($this->_contactSubType) {
CRM_Utils_System::setTitle(ts('New %1', array(1 => $this->_contactSubType)));
} else {
$title = ts('New Individual');
if ($this->_contactType == 'Household') {
$title = ts('New Household');
} else {
if ($this->_contactType == 'Organization') {
$title = ts('New Organization');
}
}
CRM_Utils_System::setTitle($title);
}
$session->pushUserContext(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
$this->_contactId = null;
} else {
//update mode
if (!$this->_contactId) {
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true);
}
if ($this->_contactId) {
require_once 'CRM/Contact/BAO/Contact.php';
$contact =& new CRM_Contact_DAO_Contact();
$contact->id = $this->_contactId;
if (!$contact->find(true)) {
CRM_Core_Error::statusBounce(ts('contact does not exist: %1', array(1 => $this->_contactId)));
}
$this->_contactType = $contact->contact_type;
$this->_contactSubType = $contact->contact_sub_type;
// check for permissions
require_once 'CRM/Contact/BAO/Contact/Permission.php';
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'));
}
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
$session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId));
$values = $this->get('values');
// get contact values.
if (!empty($values)) {
$this->_values = $values;
} else {
$params = array('id' => $this->_contactId, 'contact_id' => $this->_contactId);
$contact = CRM_Contact_BAO_Contact::retrieve($params, $this->_values, true);
$this->set('values', $this->_values);
}
} else {
CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
}
}
$this->_editOptions = $this->get('contactEditOptions');
if (CRM_Utils_System::isNull($this->_editOptions)) {
require_once 'CRM/Core/BAO/Preferences.php';
$this->_editOptions = CRM_Core_BAO_Preferences::valueOptions('contact_edit_options', true, null, false, 'name', true, 'AND v.filter = 0');
$this->set('contactEditOptions', $this->_editOptions);
}
// build demographics only for Individual contact type
if ($this->_contactType != 'Individual' && array_key_exists('Demographics', $this->_editOptions)) {
unset($this->_editOptions['Demographics']);
}
// in update mode don't show notes
if ($this->_contactId && array_key_exists('Notes', $this->_editOptions)) {
unset($this->_editOptions['Notes']);
}
$this->assign('editOptions', $this->_editOptions);
$this->assign('contactType', $this->_contactType);
$this->assign('contactSubType', $this->_contactSubType);
// get the location blocks.
$this->_blocks = $this->get('blocks');
if (CRM_Utils_System::isNull($this->_blocks)) {
$this->_blocks = CRM_Core_BAO_Preferences::valueOptions('contact_edit_options', true, null, false, 'name', true, 'AND v.filter = 1');
$this->set('blocks', $this->_blocks);
}
$this->assign('blocks', $this->_blocks);
if (array_key_exists('CustomData', $this->_editOptions)) {
//only custom data has preprocess hence directly call it
CRM_Custom_Form_CustomData::preProcess($this, null, $this->_contactSubType, 1, $this->_contactType, $this->_contactId);
}
// this is needed for custom data.
$this->assign('entityID', $this->_contactId);
// also keep the convention.
$this->assign('contactId', $this->_contactId);
// location blocks.
CRM_Contact_Form_Location::preProcess($this);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Contact.php
示例15: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
if ($this->_action == CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Group'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
// We want the "new group" form to redirect the user
if ($this->_action == CRM_Core_Action::ADD) {
$this->preventAjaxSubmit();
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'title', ts('Name') . ' ', CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE);
$this->add('textarea', 'description', ts('Description') . ' ', CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
$groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
if (isset($this->_id) && !empty($this->_groupValues['saved_search_id'])) {
unset($groupTypes['Access Control']);
}
|
请发表评论