| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* One place to store frequently used values in Select Elements. Note that
class CRM_Core_SelectValues {
/**
- * Preferred mail format
- * @static
+ * Yes/No options
+ *
+ * @return array
+ */
+ public static function boolean() {
+ return array(
+ 1 => ts('Yes'),
+ 0 => ts('No'),
+ );
+ }
+
+ /**
+ * Preferred mail format.
+ *
+ * @return array
*/
public static function pmf() {
return array(
}
/**
- * Privacy options
- * @static
+ * Privacy options.
+ *
+ * @return array
*/
public static function privacy() {
return array(
}
/**
- * Various pre defined contact super types
- * @static
+ * Various pre defined contact super types.
+ *
+ * @return array
*/
public static function contactType() {
static $contactType = NULL;
}
/**
- * Various pre defined unit list
- * @static
+ * Various pre defined unit list.
+ *
+ * @param string $unitType
+ * @return array
*/
public static function unitList($unitType = NULL) {
$unitList = array(
}
/**
- * Membership type unit
- * @static
+ * Membership type unit.
+ *
+ * @return array
*/
public static function membershipTypeUnitList() {
return self::unitList('duration');
}
/**
- * Various pre defined period types
- * @static
+ * Various pre defined period types.
+ *
+ * @return array
*/
public static function periodType() {
return array(
}
/**
- * Various pre defined email selection methods
- * @static
+ * Various pre defined email selection methods.
+ *
+ * @return array
*/
public static function emailSelectMethods() {
return array(
}
/**
- * Various pre defined member visibility options
- * @static
+ * Various pre defined member visibility options.
+ *
+ * @return array
*/
public static function memberVisibility() {
return array(
/**
* Member auto-renew options
- * @static
+ *
+ * @return array
*/
public static function memberAutoRenew() {
return array(
}
/**
- * Various pre defined event dates
- * @static
+ * Various pre defined event dates.
+ *
+ * @return array
*/
public static function eventDate() {
return array(
}
/**
- * Custom form field types
- * @static
+ * Custom form field types.
+ *
+ * @return array
*/
public static function customHtmlType() {
return array(
}
/**
- * Various pre defined extensions for dynamic properties and groups
+ * Various pre defined extensions for dynamic properties and groups.
+ *
+ * @return array
*
- * @static
*/
public static function customGroupExtends() {
$customGroupExtends = array(
}
/**
- * Styles for displaying the custom data group
+ * Styles for displaying the custom data group.
*
- * @static
+ * @return array
*/
public static function customGroupStyle() {
return array(
}
/**
- * For displaying the uf group types
+ * For displaying the uf group types.
*
- * @static
+ * @return array
*/
public static function ufGroupTypes() {
$ufGroupType = array(
}
/**
- * The status of a contact within a group
+ * The status of a contact within a group.
*
- * @static
+ * @return array
*/
public static function groupContactStatus() {
return array(
}
/**
- * List of Group Types
- * @static
+ * List of Group Types.
+ *
+ * @return array
*/
public static function groupType() {
return array(
}
/**
- * Compose the parameters for a date select object
- *
- * @param string|NULL $type the type of date
- * @param string|NULL $format date format ( QF format)
+ * Compose the parameters for a date select object.
*
+ * @param string|NULL $type
+ * the type of date
+ * @param string|NULL $format
+ * date format (QF format)
* @param null $minOffset
* @param null $maxOffset
*
* @return array
* the date array
- * @static
*/
public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL) {
-
$date = array(
'addEmptyOption' => TRUE,
'emptyOptionText' => ts('- select -'),
}
/**
- * Values for UF form visibility options
+ * Values for UF form visibility options.
*
- * @static
+ * @return array
*/
public static function ufVisibility() {
return array(
}
/**
- * Values for group form visibility options
+ * Values for group form visibility options.
*
- * @static
+ * @return array
*/
public static function groupVisibility() {
return array(
}
/**
- * Different type of Mailing Components
+ * Different type of Mailing Components.
*
- * @static
- * return array
+ * @return array
*/
public static function mailingComponents() {
return array(
}
/**
- * Get hours
- *
+ * Get hours.
*
- * @static
+ * @return array
*/
public function getHours() {
$hours = array();
}
/**
- * Get minutes
+ * Get minutes.
*
- *
- * @static
+ * @return array
*/
public function getMinutes() {
$minutes = array();
}
/**
- * Get the Map Provider
+ * Get the Map Provider.
*
* @return array
* array of map providers
- * @static
*/
public static function mapProvider() {
static $map = NULL;
}
/**
- * Get the Geocoding Providers from available plugins
+ * Get the Geocoding Providers from available plugins.
*
* @return array
* array of geocoder providers
- * @static
*/
public static function geoProvider() {
static $geo = NULL;
}
/**
- * Get the Address Standardization Providers from available
- * plugins
+ * Get the Address Standardization Providers from available plugins.
*
* @return array
* array of address standardization providers
- * @static
*/
public static function addressProvider() {
static $addr = NULL;
}
/**
- * Different type of Mailing Tokens
+ * Different type of Mailing Tokens.
*
- * @static
- * return array
+ * @return array
*/
public static function mailingTokens() {
return array(
}
/**
- * Different type of Activity Tokens
+ * Different type of Activity Tokens.
*
- * @static
- * return array
+ * @return array
*/
public static function activityTokens() {
return array(
}
/**
- * Different type of Membership Tokens
+ * Different type of Membership Tokens.
*
- * @static
- * return array
+ * @return array
*/
public static function membershipTokens() {
return array(
}
/**
- * Different type of Event Tokens
+ * Different type of Event Tokens.
*
- * @static
- * return array
+ * @return array
*/
public static function eventTokens() {
return array(
}
/**
- * Different type of Event Tokens
+ * Different type of Event Tokens.
*
- * @static
- * return array
+ * @return array
*/
public static function contributionTokens() {
return array(
}
/**
- * Different type of Contact Tokens
+ * Different type of Contact Tokens.
*
- * @static
- * return array
+ * @return array
*/
public static function contactTokens() {
static $tokens = NULL;
}
}
- // might as well get all the hook tokens to
+ // Get all the hook tokens too
$hookTokens = array();
CRM_Utils_Hook::tokens($hookTokens);
foreach ($hookTokens as $tokenValues) {
}
/**
- * Different type of Participant Tokens
+ * Different type of Participant Tokens.
*
- * @static
- * return array
+ * @return array
*/
public static function participantTokens() {
static $tokens = NULL;
}
/**
- * CiviCRM supported date input formats
+ * CiviCRM supported date input formats.
+ *
+ * @return array
*/
public static function getDatePluginInputFormats() {
$dateInputFormats = array(
);
/*
- Year greater than 2000 get wrong result for following format
- echo date( 'Y-m-d', strtotime( '7 Nov, 2001') );
- echo date( 'Y-m-d', strtotime( '7 November, 2001') );
- Return current year
- expected :: 2001-11-07
- output :: 2009-11-07
- However
- echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') );
- echo date( 'Y-m-d', strtotime( 'November 7, 2001') );
- gives proper result
- */
+ Year greater than 2000 get wrong result for following format
+ echo date( 'Y-m-d', strtotime( '7 Nov, 2001') );
+ echo date( 'Y-m-d', strtotime( '7 November, 2001') );
+ Return current year
+ expected :: 2001-11-07
+ output :: 2009-11-07
+ However
+ echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') );
+ echo date( 'Y-m-d', strtotime( 'November 7, 2001') );
+ gives proper result
+ */
return $dateInputFormats;
}
/**
- * Map date plugin and actual format that is used by PHP
+ * Map date plugin and actual format that is used by PHP.
+ *
+ * @return array
*/
public static function datePluginToPHPFormats() {
$dateInputFormats = array(
}
/**
- * Time formats
+ * Time formats.
+ *
+ * @return array
*/
public static function getTimeFormats() {
return array(
}
/**
- * Get numeric options
+ * Get numeric options.
*
+ * @param int $start
+ * @param int $end
*
- * @static
+ * @return array
*/
public static function getNumericOptions($start = 0, $end = 10) {
$numericOptions = array();
}
/**
- * Barcode types
- * @static
+ * Barcode types.
+ *
+ * @return array
*/
public static function getBarcodeTypes() {
return array(
}
/**
- * Dedupe rule types
+ * Dedupe rule types.
+ *
+ * @return array
*/
public static function getDedupeRuleTypes() {
return array(
}
/**
- * Campaign group types
+ * Campaign group types.
+ *
+ * @return array
*/
public static function getCampaignGroupTypes() {
return array(
}
/**
- * Subscription history method
+ * Subscription history method.
+ *
+ * @return array
*/
public static function getSubscriptionHistoryMethods() {
return array(
}
/**
- * Premium units
+ * Premium units.
+ *
+ * @return array
*/
public static function getPremiumUnits() {
return array(
}
/**
- * Extension types
+ * Extension types.
+ *
+ * @return array
*/
public static function getExtensionTypes() {
return array(
}
/**
- * Job frequency
+ * Job frequency.
+ *
+ * @return array
*/
public static function getJobFrequency() {
return array(
}
/**
- * Search builder operators
+ * Search builder operators.
+ *
+ * @return array
*/
public static function getSearchBuilderOperators() {
return array(
'>=' => '≥',
'<=' => '≤',
'IN' => ts('In'),
+ 'NOT IN' => ts('Not In'),
'LIKE' => ts('Like'),
+ 'NOT LIKE' => ts('Not Like'),
'RLIKE' => ts('Regex'),
'IS EMPTY' => ts('Is Empty'),
'IS NOT EMPTY' => ts('Not Empty'),
}
/**
- * Profile group types
+ * Profile group types.
*
- * @static
+ * @return array
*/
public static function getProfileGroupType() {
$profileGroupType = array(
/**
- * Word replacement match type
+ * Word replacement match type.
+ *
+ * @return array
*/
public static function getWordReplacementMatchType() {
return array(
}
/**
- * Mailing group types
+ * Mailing group types.
+ *
+ * @return array
*/
public static function getMailingGroupTypes() {
return array(
}
/**
- * Mailing Job Status
+ * Mailing Job Status.
+ *
+ * @return array
*/
public static function getMailingJobStatus() {
return array(
);
}
+ /**
+ * @return array
+ */
public static function billingMode() {
return array(
CRM_Core_Payment::BILLING_MODE_FORM => 'form',
}
/**
- * Frequency unit for schedule reminders
+ * Frequency unit for schedule reminders.
+ *
+ * @param int $count
+ * For pluralization
+ * @return array
*/
- public static function getScheduleReminderFrequencyUnits() {
- //@todo update schema to refer to option group direct & remove this
- static $scheduleReminderFrequencyUnits = NULL;
- if (!$scheduleReminderFrequencyUnits) {
- $scheduleReminderFrequencyUnits = array(
- 'hour' => ts('hour')
- ) + CRM_Core_OptionGroup::values('recur_frequency_units');
- }
-
- return $scheduleReminderFrequencyUnits;
+ public static function getRecurringFrequencyUnits($count = 1) {
+ // @todo this used to refer to the 'recur_frequency_unit' option_values which
+ // is for recurring payments and probably not good to re-use for recurring entities.
+ // If something other than a hard-coded list is desired, add a new option_group.
+ return array(
+ 'hour' => ts('hour', array('plural' => 'hours', 'count' => $count)),
+ 'day' => ts('day', array('plural' => 'days', 'count' => $count)),
+ 'week' => ts('week', array('plural' => 'weeks', 'count' => $count)),
+ 'month' => ts('month', array('plural' => 'months', 'count' => $count)),
+ 'year' => ts('year', array('plural' => 'years', 'count' => $count)),
+ );
}
+
}