Esempio n. 1
0
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Find Latest Activities');
     /**
      * Define the search form fields here
      */
     // Allow user to choose which type of contact to limit search on
     $form->add('select', 'contact_type', ts('Find...'), CRM_Core_SelectValues::contactType());
     // Text box for Activity Subject
     $form->add('text', 'activity_subject', ts('Activity Subject'));
     // Select box for Activity Type
     $activityType = array('' => ' - select activity - ') + CRM_Core_PseudoConstant::activityType();
     $form->add('select', 'activity_type_id', ts('Activity Type'), $activityType, FALSE);
     // textbox for Activity Status
     $activityStatus = array('' => ' - select status - ') + CRM_Core_PseudoConstant::activityStatus();
     $form->add('select', 'activity_status_id', ts('Activity Status'), $activityStatus, FALSE);
     // Activity Date range
     $form->addDate('start_date', ts('Activity Date From'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
     // Contact Name field
     $form->add('text', 'sort_name', ts('Contact Name'));
     /**
      * If you are using the sample template, this array tells the template fields to render
      * for the search form.
      */
     $form->assign('elements', array('contact_type', 'activity_subject', 'activity_type_id', 'activity_status_id', 'start_date', 'end_date', 'sort_name'));
 }
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Find Contributors by Aggregate Totals');
     /**
      * Define the search form fields here
      */
     $form->add('text', 'min_amount', ts('Aggregate Total Between $'));
     $form->addRule('min_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
     $form->add('text', 'max_amount', ts('...and $'));
     $form->addRule('max_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
     $form->addDate('start_date', ts('Contribution Date From'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
     $financial_types = CRM_Contribute_PseudoConstant::financialType();
     foreach ($financial_types as $financial_type_id => $financial_type) {
         $form->addElement('checkbox', "financial_type_id[{$financial_type_id}]", 'Financial Type', $financial_type);
     }
     /**
      * If you are using the sample template, this array tells the template fields to render
      * for the search form.
      */
     $form->assign('elements', array('min_amount', 'max_amount', 'start_date', 'end_date', 'financial_type_id'));
 }
 public function addElements(CRM_Core_Form &$form)
 {
     $form->add('select', 'XWeekDay_week_offset', ts('Offset'), $this->getWeekOffset());
     $form->add('select', 'XWeekDay_day', ts('Days'), $this->getDays());
     $form->add('text', 'XWeekDay_time_hour', ts('Time (hour)'));
     $form->add('text', 'XWeekDay_time_minute', ts('Time (minute)'));
 }
Esempio n. 4
0
 /**
  * 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('number', 'row_count', ts('Limit Dashboard Results'), array('class' => 'four', 'min' => 1));
     $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?'));
     $form->add('number', 'cache_minutes', ts('Cache dashlet for'), array('class' => 'four', 'min' => 1));
     $form->addElement('checkbox', 'add_to_my_reports', ts('Add to My Reports?'), NULL);
     $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);
 }
Esempio n. 5
0
 /**
  * Prepare a set of search fields
  *
  * @param CRM_Core_Form $form modifiable
  * @return void
  */
 function buildForm(&$form)
 {
     CRM_Utils_System::setTitle(ts('Find Post Code'));
     $form->add('text', 'post_code', 'Post Code');
     $form->add('select', 'post_city', 'Post City', $this->citiesList);
     $defaults = $this->retrieveDefaultValues();
     if (!empty($defaults)) {
         $form->setDefaults($defaults);
     }
     $form->assign('elements', array('post_code', 'post_city'));
 }
Esempio n. 6
0
 /**
  * Build the form object elements for Communication Preferences object.
  *
  * @param CRM_Core_Form $form
  *   Reference to the form object.
  *
  * @return void
  */
 public static function buildQuickForm(&$form)
 {
     // since the pcm - preferred comminication method is logically
     // grouped hence we'll use groups of HTML_QuickForm
     // checkboxes for DO NOT phone, email, mail
     // we take labels from SelectValues
     $privacy = $commPreff = $commPreference = array();
     $privacyOptions = CRM_Core_SelectValues::privacy();
     // we add is_opt_out as a separate checkbox below for display and help purposes so remove it here
     unset($privacyOptions['is_opt_out']);
     foreach ($privacyOptions as $name => $label) {
         $privacy[] = $form->createElement('advcheckbox', $name, NULL, $label);
     }
     $form->addGroup($privacy, 'privacy', ts('Privacy'), '&nbsp;');
     // preferred communication method
     $comm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method', array('loclize' => TRUE));
     foreach ($comm as $value => $title) {
         $commPreff[] = $form->createElement('advcheckbox', $value, NULL, $title);
     }
     $form->addGroup($commPreff, 'preferred_communication_method', ts('Preferred Method(s)'));
     $form->addSelect('preferred_language');
     if (!empty($privacyOptions)) {
         $commPreference['privacy'] = $privacyOptions;
     }
     if (!empty($comm)) {
         $commPreference['preferred_communication_method'] = $comm;
     }
     //using for display purpose.
     $form->assign('commPreference', $commPreference);
     $form->add('select', 'preferred_mail_format', ts('Email Format'), CRM_Core_SelectValues::pmf());
     $form->add('checkbox', 'is_opt_out', ts('NO BULK EMAILS (User Opt Out)'));
     $communicationStyleOptions = array();
     $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id', array('localize' => TRUE));
     foreach ($communicationStyle as $key => $var) {
         $communicationStyleOptions[$key] = $form->createElement('radio', NULL, ts('Communication Style'), $var, $key, array('id' => "civicrm_communication_style_{$var}_{$key}"));
     }
     if (!empty($communicationStyleOptions)) {
         $form->addGroup($communicationStyleOptions, 'communication_style_id', ts('Communication Style'));
     }
     //check contact type and build filter clause accordingly for greeting types, CRM-4575
     $greetings = self::getGreetingFields($form->_contactType);
     foreach ($greetings as $greeting => $fields) {
         $filter = array('contact_type' => $form->_contactType, 'greeting_type' => $greeting);
         //add addressee in Contact form
         $greetingTokens = CRM_Core_PseudoConstant::greeting($filter);
         if (!empty($greetingTokens)) {
             $form->addElement('select', $fields['field'], $fields['label'], array('' => ts('- select -')) + $greetingTokens);
             //custom addressee
             $form->addElement('text', $fields['customField'], $fields['customLabel'], CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', $fields['customField']), $fields['js']);
         }
     }
 }
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     $form->add('text', 'segmentSize', ts('Segment Size'), TRUE);
     $groups = CRM_Core_PseudoConstant::nestedGroup();
     $select2style = array('multiple' => TRUE, 'style' => 'width: 100%; max-width: 60em;', 'class' => 'crm-select2', 'placeholder' => ts('- select -'));
     $form->add('select', 'includeGroups', ts('Include Group(s)'), $groups, FALSE, $select2style);
     $form->add('select', 'excludeGroups', ts('Exclude Group(s)'), $groups, FALSE, $select2style);
     $this->setTitle('Create a random segment of contacts');
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('segmentSize', 'includeGroups', 'excludeGroups'));
 }
Esempio n. 8
0
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     $form->add('text', 'postal_code_low', ts('Postal Code Start'), TRUE);
     $form->add('text', 'postal_code_high', ts('Postal Code End'), TRUE);
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Zip Code Range Search');
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('postal_code_low', 'postal_code_high'));
 }
Esempio n. 9
0
 /**
  * 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_CSV');
     $config = CRM_Core_Config::singleton();
     $uploadFileSize = CRM_Utils_Number::formatUnitSize($config->maxFileSize . 'm', TRUE);
     $uploadSize = round($uploadFileSize / (1024 * 1024), 2);
     $form->assign('uploadSize', $uploadSize);
     $form->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
     $form->setMaxFileSize($uploadFileSize);
     $form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
     $form->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
     $form->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
     $form->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
 }
Esempio n. 10
0
 /**
  * Prepare a set of search fields
  *
  * @param CRM_Core_Form $form modifiable
  * @return void
  */
 function buildForm(&$form)
 {
     $config = CRM_Earmarking_Config::singleton();
     CRM_Utils_System::setTitle($config->translate('Search for Contacts with Recurring Contributions'));
     $paymentTypeList = $this->getPaymentTypeList();
     $earmarkingList = $this->getEarmarkingList();
     $contibutionStatusList = $this->getContributionStatusList();
     $form->add('select', 'earmarking_id', $config->translate('Earmarking'), $earmarkingList);
     $form->add('select', 'payment_type_id', $config->translate('Payment Type'), $paymentTypeList);
     $form->add('select', 'status_id', ts('Contribution Status'), $contibutionStatusList);
     $form->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('End Date'), FALSE, array('formatType' => 'custom'));
     $form->assign('elements', array('earmarking_id', 'payment_type_id', 'status_id', 'start_date', 'end_date'));
 }
Esempio n. 11
0
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements();
     $form->add('select', 'contact_type', ts('Find...'), $contactTypes, FALSE, array('class' => 'crm-select2 huge'));
     // add select for groups
     $group = array('' => ts('- any group -')) + CRM_Core_PseudoConstant::nestedGroup();
     $form->addElement('select', 'group', ts('in'), $group, array('class' => 'crm-select2 huge'));
     // add select for categories
     $tag = array('' => ts('- any tag -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
     $form->addElement('select', 'tag', ts('Tagged'), $tag, array('class' => 'crm-select2 huge'));
     // text for sort_name
     $form->add('text', 'sort_name', ts('Name'));
     $form->assign('elements', array('sort_name', 'contact_type', 'group', 'tag'));
 }
Esempio n. 12
0
 /**
  * Prepare a set of search fields
  *
  * @param CRM_Core_Form $form modifiable
  * @return void
  */
 function buildForm(&$form)
 {
     CRM_Utils_System::setTitle(ts('Search for Players on Teams'));
     $form->add('text', 'contact_id', ts('Player ID'), TRUE);
     $form->add('text', 'group_id', ts('Team ID'), TRUE);
     //$team = array('' => ts('- any team -')) + CRM_Core_PseudoConstant::stateProvince();
     //$form->addElement('select', 'group_id', ts('Team'), $team);
     // Optionally define default search values
     $form->setDefaults(array('contact_id' => '', 'group_id' => NULL));
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('contact_id', 'group_id'));
 }
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     foreach ($this->_amounts as $name => $title) {
         $form->add('text', $name, $title);
     }
     foreach ($this->_dates as $name => $title) {
         $form->addDate($name, $title, FALSE, array('formatType' => 'custom'));
     }
     foreach ($this->_checkboxes as $name => $title) {
         $form->add('checkbox', $name, $title);
     }
     $this->setTitle('Contributions made in Year X and not Year Y');
     // @TODO: Decide on better names for "Exclusion"
     // @TODO: Add rule to ensure that exclusion dates are not in the inclusion range
 }
Esempio n. 14
0
 /**
  * Build the form object elements for a phone object.
  *
  * @param CRM_Core_Form $form
  *   Reference to the form object.
  * @param int $addressBlockCount
  *   Block number to build.
  * @param bool $blockEdit
  *   Is it block edit.
  */
 public static function buildQuickForm(&$form, $addressBlockCount = NULL, $blockEdit = FALSE)
 {
     // passing this via the session is AWFUL. we need to fix this
     if (!$addressBlockCount) {
         $blockId = $form->get('Phone_Block_Count') ? $form->get('Phone_Block_Count') : 1;
     } else {
         $blockId = $addressBlockCount;
     }
     $form->applyFilter('__ALL__', 'trim');
     //phone type select
     $form->addSelect("phone[{$blockId}][phone_type_id]", array('entity' => 'phone', 'class' => 'eight', 'placeholder' => NULL));
     //main phone number with crm_phone class
     $form->add('text', "phone[{$blockId}][phone]", ts('Phone'), array_merge(CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'), array('class' => 'crm_phone twelve')));
     // phone extension
     $form->addElement('text', "phone[{$blockId}][phone_ext]", ts('Extension'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone_ext'));
     if (isset($form->_contactType) || $blockEdit) {
         //Block type select
         $form->addSelect("phone[{$blockId}][location_type_id]", array('entity' => 'phone', 'class' => 'eight', 'placeholder' => NULL));
         //is_Primary radio
         $js = array('id' => 'Phone_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );');
         $form->addElement('radio', "phone[{$blockId}][is_primary]", '', '', '1', $js);
     }
     // TODO: set this up as a group, we need a valid phone_type_id if we have a  phone number
     // $form->addRule( "location[$locationId][phone][$locationId][phone]", ts('Phone number is not valid.'), 'phone' );
 }
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Multiple Value Custom Group Search and Export');
     $form->add('text', 'sort_name', ts('Contact Name'), TRUE);
     // add select for contact type
     //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
     // this is loaded onto then replace with something like '__' & test
     $separator = CRM_Core_DAO::VALUE_SEPARATOR;
     $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
     $form->add('select', 'contact_type', ts('Find...'), $contactTypes, array('class' => 'crm-select2 huge'));
     // add select for groups
     $group = array('' => ts('- any group -')) + CRM_Core_PseudoConstant::group();
     $form->addElement('select', 'group', ts('in'), $group, array('class' => 'crm-select2 huge'));
     // add select for tags
     $tag = array('' => ts('- any tag -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
     $form->addElement('select', 'tag', ts('Tagged'), $tag, array('class' => 'crm-select2 huge'));
     if (empty($this->_groupTree)) {
         CRM_Core_Error::statusBounce(ts("Atleast one Custom Group must be present, for Custom Group search."), CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1'));
     }
     // add the checkbox for custom_groups
     foreach ($this->_groupTree as $groupID => $group) {
         if ($groupID == 'info') {
             continue;
         }
         $form->addElement('checkbox', "custom_group[{$groupID}]", NULL, $group['title']);
     }
 }
Esempio n. 16
0
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Find Totals for Events');
     /**
      * Define the search form fields here
      */
     $form->addElement('checkbox', 'paid_online', ts('Only show Credit Card Payments'));
     $form->addElement('checkbox', 'show_payees', ts('Show payees'));
     $event_type = CRM_Core_OptionGroup::values('event_type', FALSE);
     foreach ($event_type as $eventId => $eventName) {
         $form->addElement('checkbox', "event_type_id[{$eventId}]", 'Event Type', $eventName);
     }
     $events = CRM_Event_BAO_Event::getEvents(1);
     $form->add('select', 'event_id', ts('Event Name'), array('' => ts('- select -')) + $events);
     $form->addDate('start_date', ts('Payments Date From'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('...through'), FALSE, 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('paid_online', 'start_date', 'end_date', 'show_payees', 'event_type_id', 'event_id'));
 }
Esempio n. 17
0
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     $config = CRM_Core_Config::singleton();
     $countryDefault = $config->defaultContactCountry;
     $form->add('text', 'distance', ts('Distance'), NULL, TRUE);
     $proxUnits = array('km' => ts('km'), 'miles' => ts('miles'));
     $form->add('select', 'prox_distance_unit', ts('Units'), $proxUnits, TRUE);
     $form->add('text', 'street_address', ts('Street Address'));
     $form->add('text', 'city', ts('City'));
     $form->add('text', 'postal_code', ts('Postal Code'));
     $defaults = array();
     if ($countryDefault) {
         $defaults['country_id'] = $countryDefault;
     }
     $form->addChainSelect('state_province_id');
     $country = array('' => ts('- select -')) + CRM_Core_PseudoConstant::country();
     $form->add('select', 'country_id', ts('Country'), $country, TRUE, array('class' => 'crm-select2'));
     $group = array('' => ts('- any group -')) + CRM_Core_PseudoConstant::nestedGroup();
     $form->addElement('select', 'group', ts('Group'), $group, array('class' => 'crm-select2 huge'));
     $tag = array('' => ts('- any tag -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
     $form->addElement('select', 'tag', ts('Tag'), $tag, array('class' => 'crm-select2 huge'));
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Proximity Search');
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('distance', 'prox_distance_unit', 'street_address', 'city', 'postal_code', 'country_id', 'state_province_id', 'group', 'tag'));
 }
Esempio n. 18
0
 /**
  * Build the form object.
  *
  *
  * @param CRM_Core_Form $form
  * @param $proxSearch
  *
  * @return void
  */
 public 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);
 }
Esempio n. 19
0
 /**
  * This function provides the HTML form elements that are specific.
  * to the Household Contact Type
  *
  * @param CRM_Core_Form $form
  *   Form object.
  * @param int $inlineEditMode
  *   ( 1 for contact summary.
  * top bar form and 2 for display name edit )
  *
  * @return void
  */
 public static function buildQuickForm(&$form, $inlineEditMode = NULL)
 {
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
     $form->applyFilter('__ALL__', 'trim');
     if (!$inlineEditMode || $inlineEditMode == 1) {
         // household_name
         $form->add('text', 'household_name', ts('Household Name'), $attributes['household_name']);
     }
     if (!$inlineEditMode || $inlineEditMode == 2) {
         // nick_name
         $form->addElement('text', 'nick_name', ts('Nickname'), $attributes['nick_name']);
         $form->addElement('text', 'contact_source', ts('Source'), CRM_Utils_Array::value('source', $attributes));
     }
     if (!$inlineEditMode) {
         $form->add('text', 'external_identifier', ts('External ID'), $attributes['external_identifier'], FALSE);
         $form->addRule('external_identifier', ts('External ID already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Contact', $form->_contactId, 'external_identifier'));
     }
 }
Esempio n. 20
0
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     $form->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('End Date'), FALSE, array('formatType' => 'custom'));
     $groups = CRM_Core_PseudoConstant::nestedGroup();
     $select2style = array('multiple' => TRUE, 'style' => 'width: 100%; max-width: 60em;', 'class' => 'crm-select2', 'placeholder' => ts('- select -'));
     $form->add('select', 'includeGroups', ts('Include Group(s)'), $groups, FALSE, $select2style);
     $form->add('select', 'excludeGroups', ts('Exclude Group(s)'), $groups, FALSE, $select2style);
     $this->setTitle('Search by date added to CiviCRM');
     //redirect if group not available for search criteria
     if (count($groups) == 0) {
         CRM_Core_Error::statusBounce(ts("Atleast one Group must be present for search."), CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1'));
     }
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('start_date', 'end_date', 'includeGroups', 'excludeGroups'));
 }
 /**
  * build the form elements for Communication Preferences object
  *
  * @param CRM_Core_Form $form       reference to the form object
  *
  * @return void
  * @access public
  * @static
  */
 static function buildQuickForm(&$form)
 {
     // since the pcm - preferred comminication method is logically
     // grouped hence we'll use groups of HTML_QuickForm
     // checkboxes for DO NOT phone, email, mail
     // we take labels from SelectValues
     $privacy = $commPreff = $commPreference = array();
     $privacyOptions = CRM_Core_SelectValues::privacy();
     foreach ($privacyOptions as $name => $label) {
         $privacy[] = HTML_QuickForm::createElement('advcheckbox', $name, null, $label);
     }
     $form->addGroup($privacy, 'privacy', ts('Privacy'), '&nbsp;');
     // preferred communication method
     require_once 'CRM/Core/PseudoConstant.php';
     $comm = CRM_Core_PseudoConstant::pcm();
     foreach ($comm as $value => $title) {
         $commPreff[] = HTML_QuickForm::createElement('advcheckbox', $value, null, $title);
     }
     $form->addGroup($commPreff, 'preferred_communication_method', ts('Preferred Method(s)'));
     $form->add('select', 'preferred_language', ts('Preferred Language'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::languages());
     if (!empty($privacyOptions)) {
         $commPreference['privacy'] = $privacyOptions;
     }
     if (!empty($comm)) {
         $commPreference['preferred_communication_method'] = $comm;
     }
     //using for display purpose.
     $form->assign('commPreference', $commPreference);
     $form->add('select', 'preferred_mail_format', ts('Email Format'), CRM_Core_SelectValues::pmf());
     $form->add('checkbox', 'is_opt_out', ts('NO BULK EMAILS (User Opt Out)'));
     //check contact type and build filter clause accordingly for greeting types, CRM-4575
     $greetings = self::getGreetingFields($form->_contactType);
     foreach ($greetings as $greeting => $fields) {
         $filter = array('contact_type' => $form->_contactType, 'greeting_type' => $greeting);
         //add addressee in Contact form
         $greetingTokens = CRM_Core_PseudoConstant::greeting($filter);
         if (!empty($greetingTokens)) {
             $form->addElement('select', $fields['field'], $fields['label'], array('' => ts('- select -')) + $greetingTokens);
             //custom addressee
             $form->addElement('text', $fields['customField'], $fields['customLabel'], CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', $fields['customField']), $fields['js']);
         }
     }
 }
/**
 * Implements hook_civicrm_buildForm().
 *
 * Set a default value for an event price set field.
 *
 * @param string $formName
 * @param CRM_Core_Form $form
 */
function menufontawesome_civicrm_buildForm($formName, &$form)
{
    if ($formName == 'CRM_Admin_Form_Navigation') {
        CRM_Core_Resources::singleton()->addStyleFile('com.opetmar.menufontawesome', 'resources/plugins/bootstrap/css/bootstrap.css', 0, 'html-header');
        CRM_Core_Resources::singleton()->addStyleFile('com.opetmar.menufontawesome', 'resources/plugins/fontawesome-iconpicker/css/fontawesome-iconpicker.min.css', 0, 'html-header');
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/plugins/jquery-1.11.3.min.js', 0);
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/plugins/bootstrap/js/bootstrap.min.js', 1);
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/plugins/fontawesome-iconpicker/js/fontawesome-iconpicker.min.js', 2);
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/main.js', 3);
        // Add the field element in the form
        if ($form->getAction() == CRM_Core_Action::UPDATE) {
            $id = $form->getVar('_id');
            $fa_icon = CRM_Menufontawesome_BAO_Navigation::getIcon($id);
            $form->add('text', 'fa_icon', ts('Icon'), array('value' => $fa_icon));
        } else {
            $form->add('text', 'fa_icon', ts('Icon'), array('value' => ''));
        }
        $templatePath = realpath(dirname(__FILE__) . "/templates/CRM/Menufontawesome/Page");
        // dynamically insert a template block in the page
        CRM_Core_Region::instance('page-body')->add(array('template' => "{$templatePath}/fa_icon.tpl"));
    }
}
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Find Contributors by Aggregate Totals');
     /**
      * Define the search form fields here
      */
     $form->add('text', 'min_amount', ts('Aggregate Total Between $'));
     $form->addRule('min_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
     $form->add('text', 'max_amount', ts('...and $'));
     $form->addRule('max_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
     $form->addDate('start_date', ts('Contribution Date From'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
     $form->addSelect('financial_type_id', array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search'));
     /**
      * If you are using the sample template, this array tells the template fields to render
      * for the search form.
      */
     $form->assign('elements', array('min_amount', 'max_amount', 'start_date', 'end_date'));
 }
/**
 * Delegated implementation of hook_civicrm_buildForm
 *
 * Customizes the UI for adding custom fields to allow the user to specify whether
 * a multi-select field should use the slider widget or not
 */
function _volunteer_civicrm_buildForm_CRM_Custom_Form_Field($formName, CRM_Core_Form &$form)
{
    // set default value for the checkbox
    $field_id = $form->getVar('_id');
    $widgetized_fields = _volunteer_get_slider_fields();
    $form->_defaultValues['is_slider_widget'] = in_array($field_id, $widgetized_fields);
    // add checkbox to the form object
    $form->add('checkbox', 'is_slider_widget', ts('Use Slider Selector?'));
    // add checkbox to the display
    CRM_Core_Region::instance('page-body')->add(array('template' => 'Slider/CRM/Custom/Form/Field.tpl'));
    // reposition and show/hide checkbox
    CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.volunteer', 'js/CRM_Custom_Form_Field.js');
}
Esempio n. 25
0
 /**
  * @param CRM_Core_Form $form
  */
 public function appendQuickForm(&$form)
 {
     $textarea_size = array('size' => 30, 'maxlength' => 60);
     $form->add('text', $this->email_field_name(), ts('Email Address'), $textarea_size, TRUE);
     list($custom_fields_pre, $custom_fields_post) = $this->get_participant_custom_data_fields($this->participant->event_id);
     foreach ($custom_fields_pre as $key => $field) {
         CRM_Core_BAO_UFGroup::buildProfile($form, $field, CRM_Profile_Form::MODE_CREATE, $this->participant->id);
     }
     foreach ($custom_fields_post as $key => $field) {
         CRM_Core_BAO_UFGroup::buildProfile($form, $field, CRM_Profile_Form::MODE_CREATE, $this->participant->id);
     }
     $custom = CRM_Utils_Array::value('custom', $form->getTemplate()->_tpl_vars, array());
     $form->assign('custom', array_merge($custom, array($this->html_field_name('customPre') => $custom_fields_pre, $this->html_field_name('customPost') => $custom_fields_post, $this->html_field_name('number') => $this->name())));
 }
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Recurring Contribution Aggregate');
     // Get default curreny
     $config = CRM_Core_Config::singleton();
     $currencySymbol = $config->defaultCurrencySymbol;
     /**
      * Define the search form fields here
      */
     $form->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'custom'));
     $form->add('text', 'min_amount', ts('Aggregate Total Between ' . $currencySymbol));
     $form->addRule('min_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
     $form->add('text', 'max_amount', ts('...and ' . $currencySymbol));
     $form->addRule('max_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
     /**
      * 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', 'min_amount', 'max_amount'));
 }
Esempio n. 27
0
 /**
  * Prepare a set of search fields
  *
  * @param CRM_Core_Form $form modifiable
  * @return void
  */
 function buildForm(&$form)
 {
     CRM_Utils_System::setTitle(ts('My Search Title'));
     $form->add('text', 'household_name', ts('Household Name'), TRUE);
     $stateProvince = array('' => ts('- any state/province -')) + CRM_Core_PseudoConstant::stateProvince();
     $form->addElement('select', 'state_province_id', ts('State/Province'), $stateProvince);
     // Optionally define default search values
     $form->setDefaults(array('household_name' => '', 'state_province_id' => NULL));
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('household_name', 'state_province_id'));
 }
Esempio n. 28
0
 /**
  * @param CRM_Core_Form $form
  */
 public static function buildQuickForm(&$form)
 {
     $form->removeElement('status_id');
     $form->removeElement('priority_id');
     $caseId = CRM_Utils_Array::first($form->_caseId);
     $form->_caseType = CRM_Case_PseudoConstant::caseType();
     $form->_caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseId, 'case_type_id');
     if (!in_array($form->_caseTypeId, $form->_caseType)) {
         $form->_caseType[$form->_caseTypeId] = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $form->_caseTypeId, 'title');
     }
     $form->add('select', 'case_type_id', ts('New Case Type'), $form->_caseType, TRUE);
     // timeline
     $form->addYesNo('is_reset_timeline', ts('Reset Case Timeline?'), NULL, TRUE, array('onclick' => "return showHideByValue('is_reset_timeline','','resetTimeline','table-row','radio',false);"));
     $form->addDateTime('reset_date_time', ts('Reset Start Date'), FALSE, array('formatType' => 'activityDateTime'));
 }
 /**
  * Prepare a set of search fields
  *
  * @param CRM_Core_Form $form modifiable
  * @return void
  */
 function buildForm(&$form)
 {
     $this->setTitle('Potential spam entries and names for fixing');
     /**
      * Define the search form fields here
      */
     $spam_options = array('1' => ts('First name equals last name'), '2' => ts('Names contain numbers'), '6' => ts('MiXEd cAsE LAsT namE'), '7' => ts('Non-Numeric Postcode (and address not known to be overseas)'), '8' => ts('Long or short Postcode'), '9' => ts('Long or short Phone Number'), '10' => ts('Unexpected Punctuation in Name'));
     $form->addRadio('spam_options', ts('Search options'), $spam_options, array(), '<br />', TRUE);
     // Text box for phone number length to test
     $form->add('text', 'min_length', ts('Shortest length of postcodes (default: 4) or phone numbers (default: 10)'));
     // Text box for phone number length to test
     $form->add('text', 'max_length', ts('Longest length of postcodes (default: 4) or phone numbers (default: 14)'));
     // Date for records added since
     $form->addDate('start_date', ts('Contact records added since'), FALSE, array('formatType' => 'custom'));
     // Filter on Minimum Contact ID
     $form->add('text', 'min_contact_id', ts('Only show contact records with ID greater than:'));
     // Filter out blank names
     $form->add('checkbox', 'blank_names', ts("Check to not display contacts whose first and last name are both blank"));
     /**
      * If you are using the sample template, this array tells the template fields to render
      * for the search form.
      */
     $form->assign('elements', array('spam_options', 'min_contact_id', 'blank_names', 'min_length', 'max_length'));
 }
Esempio n. 30
0
 /**
  * Build form.
  *
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     $form->add('text', 'household_name', ts('Household Name'), TRUE);
     $stateProvince = array('' => ts('- any state/province -')) + CRM_Core_PseudoConstant::stateProvince();
     $form->addElement('select', 'state_province_id', ts('State/Province'), $stateProvince);
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle(ts('My Search Title'));
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('household_name', 'state_province_id'));
 }