本文整理汇总了PHP中CRM_Custom_Form_CustomData::buildQuickForm方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Custom_Form_CustomData::buildQuickForm方法的具体用法?PHP CRM_Custom_Form_CustomData::buildQuickForm怎么用?PHP CRM_Custom_Form_CustomData::buildQuickForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Custom_Form_CustomData
的用法示例。
在下文中一共展示了CRM_Custom_Form_CustomData::buildQuickForm方法的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
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);
}
示例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)));
}
示例4: buildQuickForm
/**
* build the form elements for CustomData object
*
* @param CRM_Core_Form $form reference to the form object
*
* @return void
* @access public
* @static
*/
static function buildQuickForm(&$form)
{
CRM_Custom_Form_CustomData::buildQuickForm($form);
//build custom data.
$contactSubType = NULL;
if (CRM_Utils_Array::value("hidden_custom", $_POST) && CRM_Utils_Array::value('contact_sub_type', $_POST)) {
$contactSubType = $_POST['contact_sub_type'];
} else {
$contactSubType = CRM_Utils_Array::value('contact_sub_type', $form->_values);
}
$form->assign('contactType', $form->_contactType);
$form->assign('contactSubType', $contactSubType);
}
示例5: 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);
}
}
示例6: buildQuickForm
/**
* Build the form object elements for CustomData object.
*
* @param CRM_Core_Form $form
* Reference to the form object.
*/
public static function buildQuickForm(&$form)
{
if (!empty($form->_submitValues)) {
if ($customValueCount = CRM_Utils_Array::value('hidden_custom_group_count', $form->_submitValues)) {
if (is_array($customValueCount)) {
if (array_key_exists(0, $customValueCount)) {
unset($customValueCount[0]);
}
$form->_customValueCount = $customValueCount;
$form->assign('customValueCount', $customValueCount);
}
}
}
CRM_Custom_Form_CustomData::buildQuickForm($form);
//build custom data.
$contactSubType = NULL;
if (!empty($_POST["hidden_custom"]) && !empty($_POST['contact_sub_type'])) {
$contactSubType = $_POST['contact_sub_type'];
} else {
$contactSubType = CRM_Utils_Array::value('contact_sub_type', $form->_values);
}
$form->assign('contactType', $form->_contactType);
$form->assign('contactSubType', $contactSubType);
}
示例7: 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();
}
示例8: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
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;
}
if ($this->_context == 'standalone') {
$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']);
//.........这里部分代码省略.........
示例9: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
$partiallyPaidStatusId = array_search('Partially paid', $participantStatuses);
$this->assign('partiallyPaidStatusId', $partiallyPaidStatusId);
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) {
$additionalParticipant = count(CRM_Event_BAO_Event::buildCustomProfile($this->_id, NULL, $this->_contactId, FALSE, TRUE)) - 1;
if ($additionalParticipant) {
$deleteParticipants = array(1 => ts('Delete this participant record along with associated participant record(s).'), 2 => ts('Delete only this participant record.'));
$this->addRadio('delete_participant', NULL, $deleteParticipants, NULL, '<br />');
$this->setDefaults(array('delete_participant' => 1));
$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 && $this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
}
$eventFieldParams = array('entity' => 'event', 'select' => array('minimumInputLength' => 0), 'api' => array('extra' => array('campaign_id', 'default_role_id', 'event_type_id')));
if ($this->_mode) {
// exclude events which are not monetary when credit card registration is used
$eventFieldParams['api']['params']['is_monetary'] = 1;
$this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, TRUE);
}
$element = $this->addEntityRef('event_id', ts('Event'), $eventFieldParams, TRUE);
//frozen the field
if ($this->_action & CRM_Core_Action::UPDATE && $this->_id) {
if (CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id')) {
$element->freeze();
}
}
$campaignId = NULL;
if ($this->_id) {
$campaignId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'campaign_id');
}
if (!$campaignId) {
$eventId = CRM_Utils_Request::retrieve('eid', 'Positive', $this);
if ($eventId) {
$campaignId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $eventId, 'campaign_id');
}
}
CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
$this->addDateTime('register_date', ts('Registration Date'), TRUE, array('formatType' => 'activityDateTime'));
if ($this->_id) {
$this->assign('entityID', $this->_id);
}
$this->addSelect('role_id', array('multiple' => TRUE, 'class' => 'huge'), TRUE);
// CRM-4395
$checkCancelledJs = array('onchange' => "return sendNotification( );");
$confirmJS = NULL;
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});");
$participantStatusId = array_search('Pending from pay later', CRM_Event_PseudoConstant::participantStatus());
$contributionStatusId = array_search('Completed', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'));
$confirmJS = array('onclick' => "return confirmStatus( {$participantStatusId}, {$contributionStatusId} );");
}
// get the participant status names to build special status array which is used to show notification
// checkbox below participant status select
$participantStatusName = CRM_Event_PseudoConstant::participantStatus();
$notificationStatuses = array('Cancelled', 'Pending from waitlist', 'Pending from approval', 'Expired');
// get the required status and then implode only ids
$notificationStatusIds = implode(',', array_keys(array_intersect($participantStatusName, $notificationStatuses)));
$this->assign('notificationStatusIds', $notificationStatusIds);
$this->_participantStatuses = $statusOptions = CRM_Event_BAO_Participant::buildOptions('status_id', 'create');
// Only show refund status when editing
if ($this->_action & CRM_Core_Action::ADD) {
$pendingRefundStatusId = array_search('Pending refund', $participantStatusName);
if ($pendingRefundStatusId) {
unset($statusOptions[$pendingRefundStatusId]);
}
}
$this->addSelect('status_id', $checkCancelledJs + array('options' => $statusOptions, 'option_url' => 'civicrm/admin/participant_status'), TRUE);
$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']);
$buttons[] = array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE, 'js' => $confirmJS);
$path = CRM_Utils_System::currentPath();
$excludeForPaths = array('civicrm/contact/search', 'civicrm/group/search');
if (!in_array($path, $excludeForPaths)) {
$buttons[] = array('type' => 'upload', 'name' => ts('Save and New'), 'subName' => 'new', 'js' => $confirmJS);
//.........这里部分代码省略.........
示例10: 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);
}
示例11: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//need to assign custom data type and subtype to the template
$this->assign('entityID', $this->_tableID);
$this->assign('groupID', $this->_groupID);
// make this form an upload since we dont know if the custom data injected dynamically
// is of type file etc
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例12: buildQuickForm
/**
* Build the form object elements for custom data.
*
* @return void
*/
public function buildQuickForm()
{
parent::buildQuickForm();
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
示例13: 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 );");
}
示例14: 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']);
}
if (!empty($groupTypes)) {
$this->addCheckBox('group_type', ts('Group Type'), $groupTypes, NULL, NULL, NULL, NULL, ' ');
}
$this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::groupVisibility(), TRUE);
//CRM-14190
$parentGroups = self::buildParentGroups($this);
if (CRM_Core_Permission::check('administer Multiple Organizations') && CRM_Core_Permission::isMultisiteEnabled()) {
//group organization Element
$props = array('api' => array('params' => array('contact_type' => 'Organization')));
$this->addEntityRef('organization_id', ts('Organization'), $props);
}
// is_reserved property CRM-9936
$this->addElement('checkbox', 'is_reserved', ts('Reserved Group?'));
if (!CRM_Core_Permission::check('administer reserved groups')) {
$this->freeze('is_reserved');
}
//build custom data
CRM_Custom_Form_CustomData::buildQuickForm($this);
$this->addButtons(array(array('type' => 'upload', 'name' => $this->_action == CRM_Core_Action::ADD ? ts('Continue') : ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$doParentCheck = FALSE;
if (CRM_Core_Permission::isMultisiteEnabled()) {
$doParentCheck = $this->_id && CRM_Core_BAO_Domain::isDomainGroup($this->_id) ? FALSE : TRUE;
}
$options = array('selfObj' => $this, 'parentGroups' => $parentGroups, 'doParentCheck' => $doParentCheck);
$this->addFormRule(array('CRM_Group_Form_Edit', 'formRule'), $options);
}
示例15: buildQuickForm
/**
* Function to actually build the form
*
* @param null
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
$this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'title'), TRUE);
$surveyActivityTypes = CRM_Campaign_BAO_Survey::getSurveyActivityType();
// Activity Type id
$this->addSelect('activity_type_id', array(), TRUE);
// Campaign id
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('campaign_id', $this->_values));
$this->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns);
// script / instructions
$this->addWysiwyg('instructions', ts('Instructions for interviewers'), array('rows' => 5, 'cols' => 40));
// release frequency
$this->add('text', 'release_frequency', ts('Release frequency'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'release_frequency'));
$this->addRule('release_frequency', ts('Release Frequency interval should be a positive number.'), 'positiveInteger');
// max reserved contacts at a time
$this->add('text', 'default_number_of_contacts', ts('Maximum reserved at one time'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'default_number_of_contacts'));
$this->addRule('default_number_of_contacts', ts('Maximum reserved at one time should be a positive number'), 'positiveInteger');
// total reserved per interviewer
$this->add('text', 'max_number_of_contacts', ts('Total reserved per interviewer'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'max_number_of_contacts'));
$this->addRule('max_number_of_contacts', ts('Total reserved contacts should be a positive number'), 'positiveInteger');
// is active ?
$this->add('checkbox', 'is_active', ts('Active?'));
// is default ?
$this->add('checkbox', 'is_default', ts('Default?'));
parent::buildQuickForm();
}