本文整理汇总了PHP中CRM_Core_Form::addFormRule方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form::addFormRule方法的具体用法?PHP CRM_Core_Form::addFormRule怎么用?PHP CRM_Core_Form::addFormRule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Form
的用法示例。
在下文中一共展示了CRM_Core_Form::addFormRule方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* This function provides the HTML form elements.
*
* @param CRM_Core_Form $form
* Form object.
* @param int $contactID
*/
public static function buildQuickForm(&$form, $contactID)
{
// We provide a value for oplock_ts to client, but JS uses it carefully
// -- i.e. when loading the first inline form, JS copies oplock_ts to a
// global value, and that global value is used for future form submissions.
// Any time a form is submitted, the value will be updated. This
// handles cases like:
// - V1:open V1.phone:open V1.email:open V1.email:submit V1.phone:submit
// - V1:open E1:open E1:submit V1.email:open V1.email:submit
// - V1:open V1.email:open E1:open E1:submit V1.email:submit V1:lock
$timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID);
$form->addElement('hidden', 'oplock_ts', $timestamps['modified_date'], array('id' => 'oplock_ts'));
$form->addFormRule(array('CRM_Contact_Form_Inline_Lock', 'formRule'), $contactID);
}
示例2: buildQuickForm
/**
* Build the form object.
*
* @param CRM_Core_Form $form
* @param int $proxSearch
*/
public static function buildQuickForm($form, $proxSearch)
{
// is proximity search required (2) or optional (1)?
$proxRequired = $proxSearch == 2 ? TRUE : FALSE;
$form->assign('proximity_search', TRUE);
$form->add('text', 'prox_street_address', ts('Street Address'), NULL, FALSE);
$form->add('text', 'prox_city', ts('City'), NULL, FALSE);
$form->add('text', 'prox_postal_code', ts('Postal Code'), NULL, FALSE);
$form->addChainSelect('prox_state_province_id', array('required' => $proxRequired));
$country = array('' => ts('- select -')) + CRM_Core_PseudoConstant::country();
$form->add('select', 'prox_country_id', ts('Country'), $country, $proxRequired);
$form->add('text', 'prox_distance', ts('Distance'), NULL, $proxRequired);
$proxUnits = array('km' => ts('km'), 'miles' => ts('miles'));
$form->add('select', 'prox_distance_unit', ts('Units'), $proxUnits, $proxRequired);
// prox_distance_unit
$form->addFormRule(array('CRM_Contact_Form_Task_ProximityCommon', 'formRule'), $form);
}
示例3: buildForm
/**
* Create Form for CMS user using Profile.
*
* @param CRM_Core_Form $form
* @param int $gid
* Id of group of profile.
* @param bool $emailPresent
* True if the profile field has email(primary).
* @param \const|int $action
*
* @return FALSE|void
* WTF
*
*/
public static function buildForm(&$form, $gid, $emailPresent, $action = CRM_Core_Action::NONE)
{
$config = CRM_Core_Config::singleton();
$showCMS = FALSE;
$isDrupal = $config->userSystem->is_drupal;
$isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
$isWordPress = $config->userFramework == 'WordPress' ? TRUE : FALSE;
//if CMS is configured for not to allow creating new CMS user,
//don't build the form,Fixed for CRM-4036
if ($isJoomla) {
$userParams = JComponentHelper::getParams('com_users');
if (!$userParams->get('allowUserRegistration')) {
return FALSE;
}
} elseif ($isDrupal && !variable_get('user_register', TRUE)) {
return FALSE;
} elseif ($isWordPress && !get_option('users_can_register')) {
return FALSE;
}
if ($gid) {
$isCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gid, 'is_cms_user');
}
// $cms is true when there is email(primary location) is set in the profile field.
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$showUserRegistration = FALSE;
if ($action) {
$showUserRegistration = TRUE;
} elseif (!$action && !$userID) {
$showUserRegistration = TRUE;
}
if ($isCMSUser && $emailPresent) {
if ($showUserRegistration) {
if ($isCMSUser != 2) {
$extra = array('onclick' => "return showHideByValue('cms_create_account','','details','block','radio',false );");
$form->addElement('checkbox', 'cms_create_account', ts('Create an account?'), NULL, $extra);
$required = FALSE;
} else {
$form->add('hidden', 'cms_create_account', 1);
$required = TRUE;
}
$form->assign('isCMS', $required);
if (!$userID || $action & CRM_Core_Action::PREVIEW || $action & CRM_Core_Action::PROFILE) {
$form->add('text', 'cms_name', ts('Username'), NULL, $required);
if ($isDrupal && !variable_get('user_email_verification', TRUE) or $isJoomla or $isWordPress) {
$form->add('password', 'cms_pass', ts('Password'));
$form->add('password', 'cms_confirm_pass', ts('Confirm Password'));
}
$form->addFormRule(array('CRM_Core_BAO_CMSUser', 'formRule'), $form);
}
$showCMS = TRUE;
}
}
$destination = $config->userSystem->getLoginDestination($form);
$loginURL = $config->userSystem->getLoginURL($destination);
$form->assign('loginURL', $loginURL);
$form->assign('showCMS', $showCMS);
}
示例4: buildQuickForm
/**
* This is function is called by the form object to get the DataSource's
* form snippet. It should add all fields necesarry to get the data
* uploaded to the temporary table in the DB.
*
* @param CRM_Core_Form $form
*
* @return void
* (operates directly on form argument)
*/
public function buildQuickForm(&$form)
{
$form->add('hidden', 'hidden_dataSource', 'CRM_Import_DataSource_SQL');
$form->add('textarea', 'sqlQuery', ts('Specify SQL Query'), 'rows=10 cols=45', TRUE);
$form->addFormRule(array('CRM_Import_DataSource_SQL', 'formRule'), $form);
}
示例5: buildForm
/**
* Build form.
*
* @param CRM_Core_Form $form
*/
public static function buildForm(&$form)
{
// We should not build form elements in dashlet mode.
if ($form->_section) {
return;
}
// Check role based permission.
$instanceID = $form->getVar('_id');
if ($instanceID && !CRM_Report_Utils_Report::isInstanceGroupRoleAllowed($instanceID)) {
$url = CRM_Utils_System::url('civicrm/report/list', 'reset=1');
CRM_Core_Error::statusBounce(ts('You do not have permission to access this report.'), $url);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Report_DAO_ReportInstance');
$form->add('text', 'title', ts('Report Title'), $attributes['title']);
$form->add('text', 'description', ts('Report Description'), $attributes['description']);
$form->add('text', 'email_subject', ts('Subject'), $attributes['email_subject']);
$form->add('text', 'email_to', ts('To'), $attributes['email_to']);
$form->add('text', 'email_cc', ts('CC'), $attributes['email_subject']);
$form->add('text', 'row_count', ts('Limit Dashboard Results'), array('maxlength' => 64, 'size' => 5));
$form->add('textarea', 'report_header', ts('Report Header'), $attributes['header']);
$form->add('textarea', 'report_footer', ts('Report Footer'), $attributes['footer']);
$form->addElement('checkbox', 'is_navigation', ts('Include Report in Navigation Menu?'), NULL, array('onclick' => "return showHideByValue('is_navigation','','navigation_menu','table-row','radio',false);"));
$form->addElement('select', 'view_mode', ts('Configure link to...'), array('view' => ts('View Results'), 'criteria' => ts('Show Criteria')));
$form->addElement('checkbox', 'addToDashboard', ts('Available for Dashboard?'), NULL, array('onclick' => "return showHideByValue('addToDashboard','','limit_result','table-row','radio',false);"));
$form->addElement('checkbox', 'is_reserved', ts('Reserved Report?'));
if (!CRM_Core_Permission::check('administer reserved reports')) {
$form->freeze('is_reserved');
}
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Joomla' || $config->userFramework != 'WordPress') {
$form->addElement('select', 'permission', ts('Permission'), array('0' => ts('Everyone (includes anonymous)')) + CRM_Core_Permission::basicPermissions());
// prepare user_roles to save as names not as ids
if (function_exists('user_roles')) {
$user_roles_array = user_roles();
foreach ($user_roles_array as $key => $value) {
$user_roles[$value] = $value;
}
$grouprole =& $form->addElement('advmultiselect', 'grouprole', ts('ACL Group/Role'), $user_roles, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$grouprole->setButtonAttributes('add', array('value' => ts('Add >>')));
$grouprole->setButtonAttributes('remove', array('value' => ts('<< Remove')));
}
}
// navigation field
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
$form->add('select', 'parent_id', ts('Parent Menu'), array('' => ts('- select -')) + $parentMenu);
// For now we only providing drilldown for one primary detail report only. In future this could be multiple reports
foreach ($form->_drilldownReport as $reportUrl => $drillLabel) {
$instanceList = CRM_Report_Utils_Report::getInstanceList($reportUrl);
if (count($instanceList) > 1) {
$form->add('select', 'drilldown_id', $drillLabel, array('' => ts('- select -')) + $instanceList);
}
break;
}
$form->addButtons(array(array('type' => 'submit', 'name' => ts('Save Report'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$form->addFormRule(array('CRM_Report_Form_Instance', 'formRule'), $form);
}
示例6: buildQuickForm
/**
* Build form.
*
* @param CRM_Core_Form $form
*/
public static function buildQuickForm(&$form)
{
// FIXME: this is using the following as keys rather than the standard numeric keys returned by CRM_Utils_Date
$dayOfTheWeek = array();
$dayKeys = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
foreach (CRM_Utils_Date::getAbbrWeekdayNames() as $k => $label) {
$dayOfTheWeek[$dayKeys[$k]] = $label;
}
$form->add('select', 'repetition_frequency_unit', ts('Repeats every'), CRM_Core_SelectValues::getRecurringFrequencyUnits(), FALSE, array('class' => 'required'));
$numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);
$form->add('select', 'repetition_frequency_interval', NULL, $numericOptions, FALSE, array('class' => 'required'));
$form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime'));
foreach ($dayOfTheWeek as $key => $val) {
$startActionCondition[] = $form->createElement('checkbox', $key, NULL, $val);
}
$form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));
$roptionTypes = array('1' => ts('day of the month'), '2' => ts('day of the week'));
$form->addRadio('repeats_by', ts("Repeats by"), $roptionTypes, array('required' => TRUE), NULL);
$form->add('select', 'limit_to', '', CRM_Core_SelectValues::getNumericOptions(1, 31));
$dayOfTheWeekNo = array('first' => ts('First'), 'second' => ts('Second'), 'third' => ts('Third'), 'fourth' => ts('Fourth'), 'last' => ts('Last'));
$form->add('select', 'entity_status_1', '', $dayOfTheWeekNo);
$form->add('select', 'entity_status_2', '', $dayOfTheWeek);
$eoptionTypes = array('1' => ts('After'), '2' => ts('On'));
$form->addRadio('ends', ts("Ends"), $eoptionTypes, array('class' => 'required'), NULL);
// Offset options gets key=>val pairs like 1=>2 because the BAO wants to know the number of
// children while it makes more sense to the user to see the total number including the parent.
$offsetOptions = range(1, 30);
unset($offsetOptions[0]);
$form->add('select', 'start_action_offset', NULL, $offsetOptions, FALSE);
$form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule'));
$form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing'));
$form->add('text', 'exclude_date_list', ts('Exclude Dates'), array('class' => 'twenty'));
$form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit'));
$form->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
// For client-side pluralization
$form->assign('recurringFrequencyOptions', array('single' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits()), 'plural' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits(2))));
}
示例7: buildMappingForm
/**
* Build the mapping form.
*
* @param CRM_Core_Form $form
* @param string $mappingType
* (Export/Import/Search Builder).
* @param int $mappingId
* @param int $columnNo
* @param int $blockCount
* (no of blocks shown).
* @param NULL $exportMode
*
* @return void
*/
public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL)
{
if ($mappingType == 'Export') {
$name = "Map";
$columnCount = array('1' => $columnNo);
} elseif ($mappingType == 'Search Builder') {
$name = "Builder";
$columnCount = $columnNo;
}
//get the saved mapping details
if ($mappingType == 'Export') {
$form->applyFilter('saveMappingName', 'trim');
//to save the current mappings
if (!isset($mappingId)) {
$saveDetailsName = ts('Save this field mapping');
$form->add('text', 'saveMappingName', ts('Name'));
$form->add('text', 'saveMappingDesc', ts('Description'));
} else {
$form->assign('loadedMapping', $mappingId);
$params = array('id' => $mappingId);
$temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$form->assign('savedName', $mappingDetails->name);
$form->add('hidden', 'mappingId', $mappingId);
$form->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL);
$saveDetailsName = ts('Save as a new field mapping');
$form->add('text', 'saveMappingName', ts('Name'));
$form->add('text', 'saveMappingDesc', ts('Description'));
}
$form->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)"));
$form->addFormRule(array('CRM_Export_Form_Map', 'formRule'), $form->get('mappingTypeId'));
} elseif ($mappingType == 'Search Builder') {
$form->addElement('submit', 'addBlock', ts('Also include contacts where'), array('class' => 'submit-link'));
}
$defaults = array();
$hasLocationTypes = array();
$hasRelationTypes = array();
$fields = array();
if ($mappingType == 'Export') {
$required = TRUE;
} elseif ($mappingType == 'Search Builder') {
$required = FALSE;
}
$contactType = array('Individual', 'Household', 'Organization');
foreach ($contactType as $value) {
$contactFields = CRM_Contact_BAO_Contact::exportableFields($value, FALSE, $required);
$contactFields = array_merge($contactFields, CRM_Contact_BAO_Query_Hook::singleton()->getFields());
// exclude the address options disabled in the Address Settings
$fields[$value] = CRM_Core_BAO_Address::validateAddressOptions($contactFields);
ksort($fields[$value]);
if ($mappingType == 'Export') {
$relationships = array();
$relationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $value);
asort($relationshipTypes);
foreach ($relationshipTypes as $key => $var) {
list($type) = explode('_', $key);
$relationships[$key]['title'] = $var;
$relationships[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/';
$relationships[$key]['export'] = TRUE;
$relationships[$key]['relationship_type_id'] = $type;
$relationships[$key]['related'] = TRUE;
$relationships[$key]['hasRelationType'] = 1;
}
if (!empty($relationships)) {
$fields[$value] = array_merge($fields[$value], array('related' => array('title' => ts('- related contact info -'))), $relationships);
}
}
}
//get the current employer for mapping.
if ($required) {
$fields['Individual']['current_employer']['title'] = ts('Current Employer');
}
// add component fields
$compArray = array();
//we need to unset groups, tags, notes for component export
if ($exportMode != CRM_Export_Form_Select::CONTACT_EXPORT) {
foreach (array('groups', 'tags', 'notes') as $value) {
unset($fields['Individual'][$value]);
unset($fields['Household'][$value]);
unset($fields['Organization'][$value]);
}
}
if ($mappingType == 'Search Builder') {
//build the common contact fields array.
$fields['Contact'] = array();
foreach ($fields['Individual'] as $key => $value) {
//.........这里部分代码省略.........
示例8: buildExtraDataDefaultQuickForm
protected function buildExtraDataDefaultQuickForm(CRM_Core_Form $form)
{
require_once 'CRM/Finance/BAO/BatchType.php';
require_once 'CRM/Finance/BAO/BankAccount.php';
require_once 'CRM/Contribute/PseudoConstant.php';
$form->add('text', 'batch_title', ts('Batch Title'), null, true);
$form->add('textarea', 'description', ts('Description'), null, false);
$emptySelect1[''] = '- select -';
$bankAccounts = CRM_Finance_BAO_BankAccount::getBankAccountsList($emptySelect1);
$form->add('select', 'banking_account', ts('Bank Account'), $bankAccounts, true);
//TODO: how to get this in civicrm default format?
$current = CRM_Utils_Date::getToday(null, 'm/d/Y');
$form->addDate('banking_date', ts('Banking Date'), true, array('formatType' => 'activityDate', 'value' => $current));
$form->addElement('checkbox', 'exclude_from_posting', ts('Exclude from posting'), null, null);
$emptySelect[''] = '- select -';
$contributionTypes = CRM_Finance_BAO_BatchType::getContributionTypesList($emptySelect);
$form->add('select', 'contribution_type_id', ts('Contribution Type'), $contributionTypes, true);
$el = $form->add('select', 'payment_instrument_id', ts('Payment Method'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), true);
$el->setValue($this->getDefaultPaymentMethodId());
if (!in_array('campaign_id', $this->hideDefaultFields)) {
$form->add('text', 'campaign_name', ts('Default Campaign Code'), array('class' => 'form text huge'), true);
$form->add('hidden', 'campaign_id');
}
if (!in_array('received_date', $this->hideDefaultFields)) {
$form->addDate('received_date', ts('Received date'), true, array('formatType' => 'activityDate', 'value' => $current));
}
//$form->add('select', 'contribution_type_id', ts('Contribution Type ID'), array(''=>ts( '- select -' )) + CRM_Contribute_PseudoConstant::contributionType( ), true );
//matusz: http://support.vedaconsulting.co.uk/issues/81
//$form->addDate( 'expected_posting_date', ts('Expected posting date'), true, array('formatType' => 'activityDate') );
$form->addFormRule(array($this, 'extraDataQuickFormRule'));
}
示例9: buildMappingForm
/**
* Build the mapping form.
*
* @param CRM_Core_Form $form
* @param string $mappingType
* (Export/Import/Search Builder).
* @param int $mappingId
* @param int $columnNo
* @param int $blockCount
* (no of blocks shown).
* @param NULL $exportMode
*
* @return void
*/
public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL)
{
$name = "Map";
$columnCount = array('1' => $columnNo);
$form->applyFilter('saveMappingName', 'trim');
//to save the current mappings
if (!isset($mappingId)) {
$saveDetailsName = ts('Save this field mapping');
$form->add('text', 'saveMappingName', ts('Name'));
$form->add('text', 'saveMappingDesc', ts('Description'));
} else {
$form->assign('loadedMapping', $mappingId);
$params = array('id' => $mappingId);
$temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$form->assign('savedName', $mappingDetails->name);
$form->add('hidden', 'mappingId', $mappingId);
$form->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL);
$saveDetailsName = ts('Save as a new field mapping');
$form->add('text', 'saveMappingName', ts('Name'));
$form->add('text', 'saveMappingDesc', ts('Description'));
}
$form->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)"));
$form->addFormRule(array('CRM_Export_Form_Map', 'formRule'), $form->get('mappingTypeId'));
$defaults = array();
$hasLocationTypes = array();
$hasRelationTypes = array();
$fields = array();
if ($mappingType == 'Export') {
$required = TRUE;
}
$fields = CRM_Contact_BAO_Relationship::fields();
// add custom fields
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Relationship'));
ksort($fields);
// add component fields
$compArray = array();
foreach ($fields as $key => $value) {
//CRM-2676, replacing the conflict for same custom field name from different custom group.
$customGroupName = self::getCustomGroupName($key);
if ($customGroupName) {
$relatedMapperFields[$key] = $mapperFields[$key] = $customGroupName . ': ' . $value['title'];
} else {
$relatedMapperFields[$key] = $mapperFields[$key] = $value['title'];
}
}
$mapperKeys = array_keys($mapperFields);
$sel1 = array('' => ts('- select field -')) + $mapperFields;
if (isset($mappingId)) {
$colCnt = 0;
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $mappingRelation, $mappingOperator, $mappingValue) = CRM_Core_BAO_Mapping::getMappingFields($mappingId);
$blkCnt = count($mappingName);
if ($blkCnt >= $blockCount) {
$blockCount = $blkCnt + 1;
}
for ($x = 1; $x < $blockCount; $x++) {
if (isset($mappingName[$x])) {
$colCnt = count($mappingName[$x]);
if ($colCnt >= $columnCount[$x]) {
$columnCount[$x] = $colCnt;
}
}
}
}
$form->_blockCount = $blockCount;
$form->_columnCount = $columnCount;
$form->set('blockCount', $form->_blockCount);
$form->set('columnCount', $form->_columnCount);
$defaults = $noneArray = $nullArray = array();
//used to warn for mismatch column count or mismatch mapping
$warning = 0;
for ($x = 1; $x < $blockCount; $x++) {
for ($i = 0; $i < $columnCount[$x]; $i++) {
$sel =& $form->addElement('hierselect', "mapper[{$x}][{$i}]", ts('Mapper for Field %1', array(1 => $i)), NULL);
$jsSet = FALSE;
if (isset($mappingId)) {
//TODO opgeslagen mappings
}
//Fix for Export
$j = 7;
$formValues = $form->exportValues();
if (!$jsSet) {
if (empty($formValues)) {
// Incremented length for third select box(relationship type)
for ($k = 1; $k < $j; $k++) {
$noneArray[] = array($x, $i, $k);
//.........这里部分代码省略.........
示例10: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Expected Recurring Contribution Income');
/**
* Define the search form fields here
*/
$form->addDate('start_date', ts('Start Date'), TRUE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('End Date'), TRUE, array('formatType' => 'custom'));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('start_date', 'end_date'));
$form->addFormRule(array('CRM_Recurringcontributioncustomsearches_Form_Search_ExpectedRecurringContributionIncome', 'formRule'), $form);
}
示例11: buildQuickForm
public function buildQuickForm(CRM_Core_Form $form)
{
$form->add('file', 'uploadFile', ts('Import CSV file'), 'size=30 maxlength=255', true);
$form->addFormRule(array($this, 'quickFormRule'));
}