本文整理汇总了PHP中CRM_Core_Form_Date类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form_Date类的具体用法?PHP CRM_Core_Form_Date怎么用?PHP CRM_Core_Form_Date使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Form_Date类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Common form elements.
*/
public function buildQuickForm()
{
$config = CRM_Core_Config::singleton();
$uploadFileSize = CRM_Utils_Number::formatUnitSize($config->maxFileSize . 'm', TRUE);
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
$this->add('text', 'fieldSeparator', ts('Import Field Separator'), array('size' => 2), TRUE);
$this->setDefaults(array('fieldSeparator' => $config->fieldSeparator));
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import ' . static::IMPORT_ENTITY, 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadedMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadedMapping);
$this->setDefaults(array('savedMapping' => $loadedMapping));
}
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:29,代码来源:DataSource.php
示例2: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
function buildQuickForm()
{
//Setting Upload File Size
$config =& new CRM_Core_Config();
if ($config->maxImportFileSize >= 8388608) {
$uploadFileSize = 8388608;
} else {
$uploadFileSize = $config->maxImportFileSize;
}
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=60', true);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'asciiFile');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
$duplicateOptions = array();
$duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Skip'), CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_SKIP);
$duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Update'), CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_UPDATE);
$duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Fill'), CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_FILL);
// for contributions NOCHECK == SKIP
// $duplicateOptions[] = HTML_QuickForm::createElement('radio',
// null, null, ts('No Duplicate Checking'), CRM_Contribute_Import_Parser::DUPLICATE_NOCHECK);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('On duplicate entries'));
$this->setDefaults(array('onDuplicate' => CRM_CONTRIBUTE_IMPORT_PARSER_DUPLICATE_SKIP));
//build date formats
require_once 'CRM/Core/Form/Date.php';
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:37,代码来源:UploadFile.php
示例3: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
//Setting Upload File Size
$config = CRM_Core_Config::singleton();
$uploadFileSize = CRM_Core_Config_Defaults::formatUnitSize($config->maxFileSize . 'm', TRUE);
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->setMaxFileSize($uploadFileSize);
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
$duplicateOptions = array();
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Fill'), CRM_Import_Parser::DUPLICATE_FILL);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('On duplicate entries'));
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Activity', 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadeMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadeMapping);
$this->setDefaults(array('savedMapping' => $loadeMapping));
}
$this->setDefaults(array('onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
开发者ID:kidaa30,项目名称:yes,代码行数:36,代码来源:DataSource.php
示例4: buildQuickForm
public function buildQuickForm()
{
$parent = $this->controller->getParent();
$nameTextLabel = $parent->_sms ? ts('SMS Name') : ts('Mailing Name');
$this->add('text', 'mailing_name', $nameTextLabel, CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title'));
CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE);
$this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
// CRM-15434 - Fix mailing search by status in non-English languages
$statusVals = CRM_Core_SelectValues::getMailingJobStatus();
foreach ($statusVals as $statusId => $statusName) {
$this->addElement('checkbox', "mailing_status[{$statusId}]", NULL, $statusName);
}
$this->addElement('checkbox', 'status_unscheduled', NULL, ts('Draft / Unscheduled'));
$this->addYesNo('is_archived', ts('Mailing is Archived'), TRUE);
// Search by language, if multi-lingual
$enabledLanguages = CRM_Core_I18n::languages(TRUE);
if (count($enabledLanguages) > 1) {
$this->addElement('select', 'language', ts('Language'), array('' => ts('- all languages -')) + $enabledLanguages, array('class' => 'crm-select2'));
}
if ($parent->_sms) {
$this->addElement('hidden', 'sms', $parent->_sms);
}
$this->add('hidden', 'hidden_find_mailings', 1);
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:26,代码来源:Search.php
示例5: buildQuickForm
public function buildQuickForm()
{
$parent = $this->controller->getParent();
$nameTextLabel = $parent->_sms ? ts('SMS Name') : ts('Mailing Name');
$this->add('text', 'mailing_name', $nameTextLabel, CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title'));
CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE, FALSE);
$this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
foreach (array('Scheduled', 'Complete', 'Running') as $status) {
$this->addElement('checkbox', "mailing_status[{$status}]", NULL, $status);
}
if ($parent->_sms) {
$this->addElement('hidden', 'sms', $parent->_sms);
}
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:16,代码来源:Search.php
示例6: buildAdvancedSearchPaneForm
public function buildAdvancedSearchPaneForm(&$form, $type)
{
//if (!CRM_Core_Permission::check('access HRJobs')) { echo 'not accessible'; return; }
if ($type == 'hrjobcontract') {
$form->add('hidden', 'hidden_hrjobcontract', 1);
$form->addElement('text', 'hrjobcontract_details_position', ts('Position'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'position'));
$form->addElement('text', 'hrjobcontract_details_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'title'));
$form->addElement('text', 'hrjobcontract_details_funding_notes', ts('Funding Notes'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'funding_notes'));
$form->addElement('text', 'hrjobcontract_details_notice_amount', ts('Notice Period from Employer (Amount)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'notice_amount'));
$form->add('select', 'hrjobcontract_details_notice_unit', ts('Notice Period from Employer (Amount)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_details_notice_unit', 'multiple' => true));
$form->addElement('text', 'hrjobcontract_details_notice_amount_employee', ts('Notice Period from Employee (Amount)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'notice_amount_employee'));
$form->add('select', 'hrjobcontract_details_notice_unit_employee', ts('Notice Period from Employer (Amount)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_details_notice_unit_employee', 'multiple' => true));
$hrjcLocation = CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobDetails', 'hrjobcontract_details_location');
$form->add('select', 'hrjobcontract_details_location', ts('Normal Place of Work'), $hrjcLocation, FALSE, array('id' => 'hrjobcontract_details_location', 'multiple' => true));
$form->add('select', 'hrjobcontract_role_role_level_type', ts('Level'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobRole', 'hrjobcontract_role_role_level_type'), FALSE, array('id' => 'hrjobcontract_role_role_level_type', 'multiple' => true));
$form->add('select', 'hrjobcontract_details_contract_type', ts('Contract Type'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobDetails', 'hrjobcontract_details_contract_type'), FALSE, array('id' => 'hrjobcontract_details_contract_type', 'multiple' => true));
CRM_Core_Form_Date::buildDateRange($form, 'hrjobcontract_details_period_start_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'hrjobcontract_details_period_end_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
//$form->addYesNo( 'hrjobcontract_details_is_primary', ts('Is Primary?'));
$form->add('select', 'hrjobcontract_details_is_primary', ts('Is Primary'), array('' => '- select -', 0 => 'No', 1 => 'Yes'), FALSE, array('id' => 'hrjobcontract_details_is_primary', 'multiple' => false));
}
if ($type == 'hrjobcontract_health') {
$form->add('hidden', 'hidden_hrjobcontract_health', 1);
//$form->add('checkbox', 'hrjobcontract_health_is_healthcare', ts('Is healthcare provided?'));
$form->addElement('text', 'hrjobcontract_health_health_provider', ts('Healthcare Provider (Complete OR Partial Name)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'provider'));
$form->add('select', 'hrjobcontract_health_health_plan_type', ts('Healthcare Plan Type'), CRM_Hrjobcontract_SelectValues::planType(), FALSE, array('id' => 'hrjobcontract_health_health_plan_type', 'multiple' => true));
$form->addElement('text', 'hrjobcontract_health_description', ts('Description Health Insurance'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'description'));
$form->addElement('text', 'hrjobcontract_health_dependents', ts('Healthcare Dependents'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'dependents'));
$form->addElement('text', 'hrjobcontract_health_health_provider_life_insurance', ts('Life insurance Provider (Complete OR Partial Name)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'provider_life_insurance'));
$form->add('select', 'hrjobcontract_health_life_insurance_plan_type', ts('Life insurance Plan Type'), CRM_Hrjobcontract_SelectValues::planTypeLifeInsurance(), FALSE, array('id' => 'hrjobcontract_health_life_insurance_plan_type', 'multiple' => true));
$form->addElement('text', 'hrjobcontract_health_description_life_insurance', ts('Description Life Insurance'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'description_life_insurance'));
$form->addElement('text', 'hrjobcontract_health_dependents_life_insurance', ts('Life Insurance Dependents'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'dependents_life_insurance'));
}
if ($type == 'hrjobcontract_hour') {
$form->add('hidden', 'hidden_hrjobcontract_hour', 1);
$hoursLocation = new CRM_Hrjobcontract_BAO_HoursLocation();
$hoursLocation->find();
$hoursLocationOptions = array();
while ($hoursLocation->fetch()) {
$hoursLocationOptions[$hoursLocation->id] = $hoursLocation->location;
}
$form->add('select', 'hrjobcontract_hour_location_standard_hours', ts('Location/Standard hours'), $hoursLocationOptions, FALSE, array('id' => 'hrjobcontract_hour_location_standard_hours', 'multiple' => true));
$hoursType = CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobHour', 'hrjobcontract_hour_hours_type');
$form->add('select', 'hrjobcontract_hour_hours_type', ts('Hours Types'), $hoursType, FALSE, array('id' => 'hrjobcontract_hour_hours_type', 'multiple' => true));
$form->add('text', 'hrjobcontract_hour_hours_amount', ts('Actual Hours (Amount)'), array('size' => 8, 'maxlength' => 8));
$form->add('select', 'hrjobcontract_hour_hours_unit', ts('Actual Hours (Unit)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_hour_hours_unit', 'multiple' => true));
$form->add('text', 'hrjobcontract_hour_hours_fte', ts('Full-Time Equivalence'), array('size' => 8, 'maxlength' => 8));
$form->add('text', 'hrjobcontract_hour_hours_fte_num', ts('Full-Time Numerator Equivalence'), array('size' => 8, 'maxlength' => 8));
$form->add('text', 'hrjobcontract_hour_fte_denom', ts('Full-Time Denominator Equivalence'), array('size' => 8, 'maxlength' => 8));
$form->add('text', 'hrjobcontract_hour_hours_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_hour_hours_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjobcontract_hour_hours_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_hour_hours_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
$form->add('text', 'hrjobcontract_hour_hours_fte_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_hour_hours_fte_low', ts('Please enter a valid decimal value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjobcontract_hour_hours_fte_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_hour_hours_fte_high', ts('Please enter a valid decimal value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
}
if ($type == 'hrjobcontract_leave') {
$form->add('hidden', 'hidden_hrjobcontract_leave', 1);
$leaveTypeOptions = array();
$absenceType = new CRM_HRAbsence_BAO_HRAbsenceType();
$absenceType->find();
while ($absenceType->fetch()) {
$leaveTypeOptions[$absenceType->id] = $absenceType->title;
}
$form->add('select', 'hrjobcontract_leave_leave_type', ts('Leave Type'), $leaveTypeOptions, FALSE, array('id' => 'hrjobcontract_leave_leave_type', 'multiple' => true));
}
if ($type == 'hrjobcontract_pay') {
$form->add('hidden', 'hidden_hrjobcontract_pay', 1);
$payScaleOptions = array();
$payScale = new CRM_Hrjobcontract_BAO_PayScale();
$payScale->find();
while ($payScale->fetch()) {
$payScaleOptions[$payScale->id] = $payScale->pay_scale;
if (!empty($payScale->pay_grade)) {
$payScaleOptions[$payScale->id] .= ' - ' . $payScale->pay_grade . ' - ' . $payScale->currency . ' ' . $payScale->amount . ' per ' . $payScale->periodicity;
}
}
$form->add('select', 'hrjobcontract_pay_pay_scale', ts('Pay Scale'), $payScaleOptions, FALSE, array('id' => 'hrjobcontract_pay_pay_scale', 'multiple' => true));
$form->add('select', 'hrjobcontract_pay_is_paid', ts('Paid / Unpaid'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobPay', 'is_paid'), FALSE, array('id' => 'hrjobcontract_pay_is_paid', 'multiple' => 'multiple', 'title' => ts('- select -')));
$form->add('text', 'hrjobcontract_pay_pay_amount', ts('Pay Amount'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_pay_pay_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjobcontract_pay_pay_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_pay_pay_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjobcontract_pay_pay_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_pay_pay_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
$form->add('select', 'hrjobcontract_pay_pay_unit', ts('Pay Unit'), CRM_Hrjobcontract_SelectValues::payUnit(), FALSE, array('id' => 'hrjobcontract_pay_pay_unit', 'multiple' => true));
$form->add('select', 'hrjobcontract_pay_pay_currency', ts('Pay Currency'), array_keys(CRM_Hrjobcontract_Page_JobContractTab::getCurrencyFormats()), FALSE, array('id' => 'hrjobcontract_pay_pay_currency', 'multiple' => true));
$form->add('text', 'hrjobcontract_pay_pay_annualized_est', ts('Estimated Annual Pay'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_pay_pay_annualized_est', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjobcontract_pay_pay_annualized_est_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_pay_pay_annualized_est_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'hrjobcontract_pay_pay_annualized_est_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('hrjobcontract_pay_pay_annualized_est_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
$form->add('select', 'hrjobcontract_pay_pay_is_auto_est', ts('Estimated Auto Pay'), array('' => '- select -', 0 => 'No', 1 => 'Yes'), FALSE, array('id' => 'hrjobcontract_pay_pay_is_auto_est', 'multiple' => false));
// TODO: Annual Benefits + Annual Deductions
$payCycleOptions = array();
$payCycles = array();
CRM_Core_OptionGroup::getAssoc('hrjc_pay_cycle', $payCycles, true);
//.........这里部分代码省略.........
开发者ID:JoeMurray,项目名称:civihr,代码行数:101,代码来源:Query.php
示例7: buildSearchForm
/**
* Add all the elements shared between case search and advanaced search.
*
*
* @param CRM_Core_Form $form
*
* @return void
*/
public static function buildSearchForm(&$form)
{
$config = CRM_Core_Config::singleton();
//validate case configuration.
$configured = CRM_Case_BAO_Case::isCaseConfigured();
$form->assign('notConfigured', !$configured['configured']);
$form->add('select', 'case_type_id', ts('Case Type'), CRM_Case_PseudoConstant::caseType('title', FALSE), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple'));
$form->add('select', 'case_status_id', ts('Case Status'), CRM_Case_PseudoConstant::caseStatus('label', FALSE), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple'));
CRM_Core_Form_Date::buildDateRange($form, 'case_from', 1, '_start_date_low', '_start_date_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'case_to', 1, '_end_date_low', '_end_date_high', ts('From'), FALSE);
$form->assign('validCiviCase', TRUE);
//give options when all cases are accessible.
$accessAllCases = FALSE;
if (CRM_Core_Permission::check('access all cases and activities')) {
$accessAllCases = TRUE;
$caseOwner = array(1 => ts('Search All Cases'), 2 => ts('Only My Cases'));
$form->addRadio('case_owner', ts('Cases'), $caseOwner);
}
$form->assign('accessAllCases', $accessAllCases);
$caseTags = CRM_Core_BAO_Tag::getTags('civicrm_case');
if ($caseTags) {
foreach ($caseTags as $tagID => $tagName) {
$form->_tagElement =& $form->addElement('checkbox', "case_tags[{$tagID}]", NULL, $tagName);
}
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_case');
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_case', NULL, TRUE, FALSE);
if (CRM_Core_Permission::check('administer CiviCRM')) {
$form->addElement('checkbox', 'case_deleted', ts('Deleted Cases'));
}
// add all the custom searchable fields
$extends = array('Case');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('caseGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
$form->setDefaults(array('case_owner' => 1));
}
开发者ID:scardinius,项目名称:civicrm-core-api-mailing,代码行数:53,代码来源:Query.php
示例8: buildSearchForm
static function buildSearchForm(&$form)
{
$dataURLEvent = CRM_Utils_System::url('civicrm/ajax/event', "reset=1", FALSE, NULL, FALSE);
$dataURLEventType = CRM_Utils_System::url('civicrm/ajax/eventType', "reset=1", FALSE, NULL, FALSE);
$dataURLEventFee = CRM_Utils_System::url('civicrm/ajax/eventFee', "reset=1", FALSE, NULL, FALSE);
$form->assign('dataURLEvent', $dataURLEvent);
$form->assign('dataURLEventType', $dataURLEventType);
$form->assign('dataURLEventFee', $dataURLEventFee);
$eventId =& $form->add('text', 'event_name', ts('Event Name'));
$eventType =& $form->add('text', 'event_type', ts('Event Type'));
$participantFee =& $form->add('text', 'participant_fee_level', ts('Fee Level'));
//elements for assigning value operation
$eventNameId =& $form->add('hidden', 'event_id', '', array('id' => 'event_id'));
$eventTypeId =& $form->add('hidden', 'event_type_id', '', array('id' => 'event_type_id'));
$participantFeeId =& $form->add('hidden', 'participant_fee_id', '', array('id' => 'participant_fee_id'));
CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE, FALSE);
$status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
asort($status);
foreach ($status as $id => $Name) {
$form->_participantStatus =& $form->addElement('checkbox', "participant_status_id[{$id}]", NULL, $Name);
}
foreach (CRM_Event_PseudoConstant::participantRole() as $rId => $rName) {
$form->_participantRole =& $form->addElement('checkbox', "participant_role_id[{$rId}]", NULL, $rName);
}
$form->addElement('checkbox', 'participant_test', ts('Find Test Participants?'));
$form->addElement('checkbox', 'participant_pay_later', ts('Find Pay Later Participants?'));
$form->addElement('text', 'participant_fee_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addElement('text', 'participant_fee_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('participant_fee_amount_low', ts('Please enter a valid money value.'), 'money');
$form->addRule('participant_fee_amount_high', ts('Please enter a valid money value.'), 'money');
// add all the custom searchable fields
$extends = array('Participant');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('participantGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'participant_campaign_id');
$form->assign('validCiviEvent', TRUE);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:46,代码来源:Query.php
示例9: buildSearchForm
/**
* add all the elements shared between contribute search and advnaced search
*
* @access public
*
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
//added contribution source
$form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
$form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
//adding select option for curreny type -- CRM-4711
$form->add('select', 'contribution_currency_type', ts('Currency Type'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::currencySymbols('name'));
$form->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
$form->add('select', 'contribution_page_id', ts('Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage());
$form->add('select', 'contribution_payment_instrument_id', ts('Payment Instrument'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument());
$form->add('select', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::pcPage());
$status = array();
$statusValues = CRM_Core_OptionGroup::values("contribution_status");
// Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue).
unset($statusValues['5']);
unset($statusValues['6']);
foreach ($statusValues as $key => $val) {
$status[] = $form->createElement('advcheckbox', $key, NULL, $val);
}
$form->addGroup($status, 'contribution_status_id', ts('Contribution Status'));
// add null checkboxes for thank you and receipt
$form->addElement('checkbox', 'contribution_thankyou_date_isnull', ts('Thank-you date not set?'));
$form->addElement('checkbox', 'contribution_receipt_date_isnull', ts('Receipt not sent?'));
//add fields for honor search
$form->addElement('text', 'contribution_in_honor_of', ts("In Honor Of"));
$form->addElement('checkbox', 'contribution_test', ts('Find Test Contributions?'));
$form->addElement('checkbox', 'contribution_pay_later', ts('Find Pay Later Contributions?'));
//add field for transaction ID search
$form->addElement('text', 'contribution_transaction_id', ts("Transaction ID"));
$form->addElement('checkbox', 'contribution_recurring', ts('Find Recurring Contributions?'));
$form->addElement('checkbox', 'contribution_recurring_isnull', ts('Find Non Recurring Contributions?'));
$form->addElement('text', 'contribution_check_number', ts('Check Number'));
//add field for pcp display in roll search
$form->addYesNo('contribution_pcp_display_in_roll', ts('Personal Campaign Page Honor Roll?'));
// add all the custom searchable fields
$contribution = array('Contribution');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution);
if ($groupDetails) {
$form->assign('contributeGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'contribution_campaign_id');
// add batch select
$batches = CRM_Core_BAO_Batch::getBatches();
if (!empty($batches)) {
$form->add('select', 'contribution_batch_id', ts('Batch Name'), array('' => ts('- select -')) + $batches);
}
$form->assign('validCiviContribute', TRUE);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:67,代码来源:Query.php
示例10: recurringContribution
/**
* @param $form
*/
public static function recurringContribution(&$form)
{
// Recurring contribution fields
foreach (self::getRecurringFields() as $key => $label) {
if ($key == 'contribution_recur_payment_made' && !empty($form->_formValues) && !CRM_Utils_System::isNull(CRM_Utils_Array::value($key, $form->_formValues))) {
$form->assign('contribution_recur_pane_open', TRUE);
break;
}
CRM_Core_Form_Date::buildDateRange($form, $key, 1, '_low', '_high');
// If data has been entered for a recurring field, tell the tpl layer to open the pane
if (!empty($form->_formValues) && !empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) {
$form->assign('contribution_recur_pane_open', TRUE);
break;
}
}
// Add field to check if payment is made for recurring contribution
$recurringPaymentOptions = array(1 => ts('All recurring contributions'), 2 => ts('Recurring contributions with at least one payment'));
$form->addRadio('contribution_recur_payment_made', NULL, $recurringPaymentOptions, array('allowClear' => TRUE));
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_start_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_end_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_modified_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_next_sched_contribution_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_failure_retry_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_cancel_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
$form->addElement('text', 'contribution_recur_processor_id', ts('Processor ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'processor_id'));
$form->addElement('text', 'contribution_recur_trxn_id', ts('Transaction ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'trxn_id'));
$contributionRecur = array('ContributionRecur');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contributionRecur);
if ($groupDetails) {
$form->assign('contributeRecurGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:42,代码来源:ContributionRecur.php
示例11: buildQuickForm
/**
* Function to actually build the form - this appears to be entirely code that should be in a shared base class in core
*
* @return None
* @access public
*/
public function buildQuickForm()
{
// Setting Upload File Size.
$config = CRM_Core_Config::singleton();
// This conditional block is important as the "maxImportFileSize" has been changed to "maxFileSize"
// in the newer versions. In order to remove version support, remove this block and
// replace by $uploadFileSize = $config->maxFileSize.
if (!empty($config->maxImportFileSize)) {
$uploadFileSize = $config->maxImportFileSize;
} else {
$uploadFileSize = CRM_Utils_Number::formatUnitSize($config->maxFileSize . 'm', TRUE);
}
if ($uploadFileSize >= 8388608) {
$uploadFileSize = 8388608;
}
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
if ($this->isDuplicateOptions) {
$duplicateOptions = array();
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('On Duplicate Entries'));
}
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', $this->_mappingType, 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadedMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadedMapping);
$this->setDefaults(array('savedMapping' => $loadedMapping));
}
$this->setDefaults(array('onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP));
if ($this->_enableContactOptions) {
$this->addContactOptions();
}
$this->setDefaults(array('contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL));
$this->addElement('text', 'fieldSeparator', ts('Import Field Separator'), array('size' => 2));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
开发者ID:wayneYaw,项目名称:nz.co.fuzion.csvimport,代码行数:54,代码来源:DataSourceBaseClass.php
示例12: custom
/**
* Generate the custom Data Fields based
* on the is_searchable
*
*
* @param $form
*
* @return void
*/
public static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
if ($field['data_type'] == 'Date' && $field['is_search_range']) {
CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
} else {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
//TODO: validate for only one state if prox_distance isset
}
开发者ID:kidaa30,项目名称:yes,代码行数:31,代码来源:Criteria.php
示例13: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
//Setting Upload File Size
$config = CRM_Core_Config::singleton();
if ($config->maxImportFileSize >= 8388608) {
$uploadFileSize = 8388608;
} else {
$uploadFileSize = $config->maxImportFileSize;
}
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
$duplicateOptions = array();
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK);
// for contributions NOCHECK == SKIP
// $duplicateOptions[] = $this->createElement('radio',
// null, null, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('On Duplicate Entries'));
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Participant', 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadeMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadeMapping);
$this->setDefaults(array('savedMapping' => $loadeMapping));
}
$this->setDefaults(array('onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP));
//contact types option
$contactOptions = array();
if (CRM_Contact_BAO_ContactType::isActive('Individual')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Individual'), CRM_Import_Parser::CONTACT_INDIVIDUAL);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Household'), CRM_Import_Parser::CONTACT_HOUSEHOLD);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Organization'), CRM_Import_Parser::CONTACT_ORGANIZATION);
}
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->setDefaults(array('contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:57,代码来源:DataSource.php
示例14: addFilters
function addFilters()
{
$options = $filters = array();
$count = 1;
foreach ($this->_filters as $table => $attributes) {
foreach ($attributes as $fieldName => $field) {
// get ready with option value pair
$operations = $this->getOperationPair(CRM_Utils_Array::value('operatorType', $field), $fieldName);
$filters[$table][$fieldName] = $field;
switch (CRM_Utils_Array::value('operatorType', $field)) {
|
请发表评论