+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
LISTINGS_VISIBILITY = 4;
/**
- * Cache the match clause used in this transaction
+ * Cache the match clause used in this transaction.
*
* @var string
*/
static $_matchFields = NULL;
/**
- * Fetch object based on array of properties
+ * Fetch object based on array of properties.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
* @param array $defaults
* (reference) an assoc array to hold the flattened values.
*
- * @return object CRM_Core_DAO_UFGroup object
- * @static
+ * @return object
+ * CRM_Core_DAO_UFGroup object
*/
public static function retrieve(&$params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_UFGroup', $params, $defaults);
* @param int $id
* Id of uf_group.
*
- * @return string contact type
+ * @return string
+ * contact type
*/
public static function getContactType($id) {
* @param int $id
* Id of uf_form.
*
- * @return string title
- *
- * @static
+ * @return string
+ * title
*
*/
public static function getTitle($id) {
}
/**
- * Update the is_active flag in the db
+ * Update the is_active flag in the db.
*
* @param int $id
* Id of the database record.
* @param bool $is_active
* Value we want to set the is_active field.
*
- * @return Object CRM_Core_DAO_UFGroup object on success, null otherwise
- * @static
+ * @return Object
+ * CRM_Core_DAO_UFGroup object on success, null otherwise
*/
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $id, 'is_active', $is_active);
}
/**
- * Get all the registration fields
+ * Get all the registration fields.
*
* @param int $action
* What action are we doing.
*
* @param null $ctype
*
- * @return array the fields that are needed for registration
- * @static
+ * @return array
+ * the fields that are needed for registration
*/
public static function getRegistrationFields($action, $mode, $ctype = NULL) {
if ($mode & CRM_Profile_Form::MODE_REGISTER) {
}
/**
- * Get all the listing fields
+ * Get all the listing fields.
*
* @param int $action
* What action are we doing.
* @param null $restrict
* @param bool $skipPermission
* @param int $permissionType
- * @return array the fields that are listings related
- * @static
+ * @return array
+ * the fields that are listings related
*/
- static function getListingFields(
+ public static function getListingFields(
$action,
$visibility,
$considerSelector = FALSE,
* @param string $orderBy
* @param null $orderProfiles
*
- * @return array the fields that belong to this ufgroup(s)
- * @static
+ * @return array
+ * the fields that belong to this ufgroup(s)
*/
- static function getFields(
+ public static function getFields(
$id,
$register = FALSE,
$action = NULL,
*
* @param CRM_Core_DAO_UFGroup|CRM_Core_DAO $group
* @param CRM_Core_DAO_UFField|CRM_Core_DAO $field
+ * @param array $customFields
* @param array $addressCustomFields
* @param array $importableFields
- * @param array $customFields
* @param int $permissionType
* Eg CRM_Core_Permission::CREATE.
* @return array
}
/**
- * Create a query to find all visible UFFields in a UFGroup
+ * Create a query to find all visible UFFields in a UFGroup.
*
* This is the SQL-variant of checkUFFieldDisplayable().
*
}
/**
- * Create a query to find all visible UFFields in a UFGroup
+ * Create a query to find all visible UFFields in a UFGroup.
*
* This is the PHP in-memory variant of createUFFieldQuery().
*
* @param bool $searchable
* @param bool $showAll
* @param int $visibility
- * @return bool TRUE if field is displayable
+ * @return bool
+ * TRUE if field is displayable
*/
protected static function filterUFField($field, $searchable, $showAll, $visibility) {
if ($searchable && $field->is_searchable != 1) {
}
/**
- * Check the data validity
+ * Check the data validity.
*
* @param int $userID
* The user id that we are actually editing.
* The action of the form.
*
* @pram boolean $register is this the registrtion form
- * @return boolean true if form is valid
- * @static
+ * @return bool
+ * true if form is valid
*/
public static function isValid($userID, $title, $register = FALSE, $action = NULL) {
if ($register) {
}
/**
- * Get the html for the form that represents this particular group
+ * Get the html for the form that represents this particular group.
*
* @param int $userID
* The user id that we are actually editing.
* @param bool $doNotProcess
* @param null $ctype
*
- * @return string the html for the form on success, otherwise empty string
- * @static
+ * @return string
+ * the html for the form on success, otherwise empty string
*/
- static function getEditHTML(
+ public static function getEditHTML(
$userID,
$title,
$action = NULL,
}
/**
- * Searches for a contact in the db with similar attributes
+ * Searches for a contact in the db with similar attributes.
*
* @param array $params
* The list of values to be used in the where clause.
* The current contact id (hence excluded from matching).
* @param string $contactType
*
- * @return int|null contact_id if found, null otherwise
- * @static
+ * @return int|null
+ * contact_id if found, null otherwise
*/
public static function findContact(&$params, $id = NULL, $contactType = 'Individual') {
$dedupeParams = CRM_Dedupe_Finder::formatParams($params, $contactType);
* @param null $additionalWhereClause
*
* @return void
- * @static
*/
public static function getValues(
$cid, &$fields, &$values,
elseif (in_array($name, array(
'state_province',
'country',
- 'county'
+ 'county',
))) {
$values[$index] = $details->$name;
$idx = $name . '_id';
'deceased_date',
'membership_start_date',
'membership_end_date',
- 'join_date'
+ 'join_date',
))) {
$values[$index] = CRM_Utils_Date::customFormat($details->$name);
$params[$index] = CRM_Utils_Date::isoToMysql($details->$name);
'phone',
'im',
'email',
- 'openid'
+ 'openid',
))) {
if ($type) {
$detailName .= "-{$type}";
if (in_array($fieldName, array(
'state_province',
'country',
- 'county'
+ 'county',
))) {
$values[$index] = $details->$detailName;
$idx = $detailName . '_id';
* @param int $id
* Profile Id.
*
- * @return boolean
- *
- * @static
+ * @return bool
*
*/
public static function usedByModule($id) {
* @param int $id
* Profile Id.
*
- * @return boolean
- *
- * @static
+ * @return bool
*
*/
public static function del($id) {
}
/**
- * Add the UF Group
+ * Add the UF Group.
*
* @param array $params
* Reference array contains the values submitted by the form.
* @param array $ids
* Reference array contains the id.
*
- * @static
*
* @return object
*/
'is_update_dupe',
'is_edit_link',
'is_uf_link',
- 'is_cms_user'
+ 'is_cms_user',
);
foreach ($fields as $field) {
$params[$field] = CRM_Utils_Array::value($field, $params, FALSE);
}
/**
- * Make uf join entries for an uf group
+ * Make uf join entries for an uf group.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
* Ufgroup id.
*
* @return void
- * @static
*/
public static function createUFJoin(&$params, $ufGroupId) {
$groupTypes = CRM_Utils_Array::value('uf_group_type', $params);
}
/**
- * Get the UF Join records for an ufgroup id
+ * Get the UF Join records for an ufgroup id.
*
* @param int $ufGroupId
* Uf group id.
* @param int $status
* If set return module other than default modules (User Account/User registration/Profile).
*
- * @return array $ufGroupJoinRecords
+ * @return array
*
- * @static
*/
public static function getUFJoinRecord($ufGroupId = NULL, $displayName = NULL, $status = NULL) {
if ($displayName) {
}
/**
- * Function takes an associative array and creates a ufjoin record for ufgroup
+ * Function takes an associative array and creates a ufjoin record for ufgroup.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
*
- * @return CRM_Core_BAO_UFJoin object
- * @static
+ * @return CRM_Core_BAO_UFJoin
*/
public static function addUFJoin(&$params) {
$ufJoin = new CRM_Core_DAO_UFJoin();
}
/**
- * Delete the uf join record for an uf group
+ * Delete the uf join record for an uf group.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
*
* @return void
- * @static
*/
public static function delUFJoin(&$params) {
$ufJoin = new CRM_Core_DAO_UFJoin();
}
/**
- * Get the weight for ufjoin record
+ * Get the weight for ufjoin record.
*
* @param int $ufGroupId
* If $ufGroupId get update weight or add weight.
*
- * @return int weight of the UFGroup
- * @static
+ * @return int
+ * weight of the UFGroup
*/
public static function getWeight($ufGroupId = NULL) {
//calculate the weight
}
/**
- * Get the uf group for a module
+ * Get the uf group for a module.
*
* @param string $moduleName
* Module name.
* Which operation (view, edit, create, etc) to check permission for.
* @param array|NULL $returnFields list of UFGroup fields to return; NULL for default
*
- * @return array $ufGroups array of ufgroups for a module
- * @static
+ * @return array
+ * array of ufgroups for a module
*/
public static function getModuleUFGroup($moduleName = NULL, $count = 0, $skipPermission = TRUE, $op = CRM_Core_Permission::VIEW, $returnFields = NULL) {
$selectFields = array('id', 'title', 'created_id', 'is_active', 'is_reserved', 'group_type');
if ($field == 'id') {
continue;
}
- elseif ($field == 'name') {
- $ufGroups[$dao->id][$field] = $dao->title;
- continue;
- }
$ufGroups[$dao->id][$field] = $dao->$field;
}
}
}
/**
- * Filter ufgroups based on logged in user contact type
+ * Filter ufgroups based on logged in user contact type.
*
* @param int $ufGroupId
* Uf group id (profile id).
* @param int $contactID
*
- * @return boolean true or false
- * @static
+ * @return bool
+ * true or false
*/
public static function filterUFGroups($ufGroupId, $contactID = NULL) {
if (!$contactID) {
}
/**
- * Add profile field to a form
+ * Add profile field to a form.
*
* @param CRM_Core_Form $form
* @param array $field
* @param string $prefix
*
* @return null
- * @static
*/
- static function buildProfile(
+ public static function buildProfile(
&$form,
&$field,
$mode,
// do not display view fields in drupal registration form
// CRM-4632
if ($view && $mode == CRM_Profile_Form::MODE_REGISTER) {
- return;
+ return NULL;
}
if ($usedFor == 'onbehalf') {
if ($fieldName == 'image_URL' && $mode == CRM_Profile_Form::MODE_EDIT) {
$deleteExtra = ts('Are you sure you want to delete contact image.');
$deleteURL = array(
- CRM_Core_Action::DELETE =>
- array(
- 'name' => ts('Delete Contact Image'),
- 'url' => 'civicrm/contact/image',
- 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%&action=delete',
- 'extra' =>
- 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
- ),
+ CRM_Core_Action::DELETE => array(
+ 'name' => ts('Delete Contact Image'),
+ 'url' => 'civicrm/contact/image',
+ 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%&action=delete',
+ 'extra' =>
+ 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
+ ),
);
$deleteURL = CRM_Core_Action::formLink($deleteURL,
CRM_Core_Action::DELETE,
$config = CRM_Core_Config::singleton();
if (!in_array($mode, array(
CRM_Profile_Form::MODE_EDIT,
- CRM_Profile_Form::MODE_SEARCH
+ CRM_Profile_Form::MODE_SEARCH,
)) &&
$config->defaultContactStateProvince
) {
$config = CRM_Core_Config::singleton();
if (!in_array($mode, array(
CRM_Profile_Form::MODE_EDIT,
- CRM_Profile_Form::MODE_SEARCH
+ CRM_Profile_Form::MODE_SEARCH,
)) &&
$config->defaultContactCountry
) {
}
$form->add('select', $providerName, NULL,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $required
);
}
else {
$form->add('select', $name . '-provider_id', $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'), $required
);
}
elseif (in_array($fieldName, array(
'membership_start_date',
'membership_end_date',
- 'join_date'
+ 'join_date',
))) {
- $form->addDate($name, $title, $required, array('formatType' => 'custom'));
+ $form->addDate($name, $title, $required, array('formatType' => 'activityDate'));
}
elseif (CRM_Utils_Array::value('name', $field) == 'membership_type') {
list($orgInfo, $types) = CRM_Member_BAO_MembershipType::getMembershipTypeInfo();
elseif (CRM_Utils_Array::value('name', $field) == 'membership_status') {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'), $required
);
}
'Contact',
'Contribution',
'Participant',
- 'Membership'
+ 'Membership',
))
) {
$profileType = 'Individual';
);
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Core_PseudoConstant::greeting($greeting), $required
);
// add custom greeting element
'receive_date',
'receipt_date',
'thankyou_date',
- 'cancel_date'
+ 'cancel_date',
))) {
$form->addDateTime($name, $title, $required, array('formatType' => 'activityDateTime'));
}
list($products, $options) = CRM_Contribute_BAO_Premium::getPremiumProductInfo();
$sel = &$form->addElement('hierselect', $name, $title);
$products = array(
- '0' => ts('- select -')
- ) + $products;
+ '0' => ts('- select -'),
+ ) + $products;
$sel->setOptions(array($products, $options));
}
elseif ($fieldName == 'payment_instrument') {
elseif ($fieldName == 'financial_type') {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Contribute_PseudoConstant::financialType(), $required
);
}
foreach (array(
'In Progress',
'Overdue',
- 'Refunded'
+ 'Refunded',
) as $suppress) {
unset($contributionStatuses[CRM_Utils_Array::key($suppress, $statusName)]);
}
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + $contributionStatuses, $required
);
}
$name = "soft_credit_type[$rowNumber]";
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Core_OptionGroup::values("soft_credit_type")
);
//CRM-15350: choose SCT field default value as 'Gift' for membership use
elseif ($fieldName == 'contribution_page_id') {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Contribute_PseudoConstant::contributionPage(), $required, 'class="big"'
);
}
elseif ($fieldName == 'activity_status_id') {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Core_PseudoConstant::activityStatus(), $required
);
}
elseif ($fieldName == 'activity_engagement_level') {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Campaign_PseudoConstant::engagementLevel(), $required
);
}
}
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Event_PseudoConstant::participantStatus(NULL, $cond, 'label'), $required
);
}
else {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + CRM_Event_PseudoConstant::participantRole(), $required
);
}
));
$form->add('select', $name, $title,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + $campaigns, $required, 'class="crm-select2 big"'
);
}
'non_deductible_amount',
'total_amount',
'fee_amount',
- 'net_amount'
+ 'net_amount',
))) {
$form->addRule($name, ts('Please enter a valid amount.'), 'money');
}
}
/**
- * Set profile defaults
+ * Set profile defaults.
*
* @param int $contactId
* Contact id.
* @param int $componentId
* Id for specific components like contribute, event etc.
* @param null $component
- *
- * @return null
- * @static
*/
- static function setProfileDefaults(
+ public static function setProfileDefaults(
$contactId, &$fields, &$defaults,
$singleProfile = TRUE, $componentId = NULL, $component = NULL
) {
* @param bool $onlyPure
* True if only pure profiles are required.
*
- * @return array $profiles associative array of profiles
- * @static
+ * @return array
+ * associative array of profiles
*/
public static function getProfiles($types, $onlyPure = FALSE) {
$profiles = array();
* @param array $optional
* Array of types those are optional.
*
- * @return array $profiles associative array of profiles
- * @static
+ * @return array
+ * associative array of profiles
*/
public static function getValidProfiles($required, $optional = NULL) {
if (!is_array($required) || empty($required)) {
- return;
+ return NULL;
}
$profiles = array();
* @param array $required
* Array of fields those are required in the profile.
*
- * @return array $profiles associative array of profiles
- * @static
+ * @return array
+ * associative array of profiles
*/
public static function checkValidProfile($ufId, $required = NULL) {
$validProfile = FALSE;
/**
* Get default value for Register.
*
- * @param $fields
- * @param $defaults
+ * @param array $fields
+ * @param array $defaults
*
- * @return mixed $defaults@static
+ * @return array
*/
public static function setRegisterDefaults(&$fields, &$defaults) {
$config = CRM_Core_Config::singleton();
}
/**
- * This function is to make a copy of a profile, including
+ * make a copy of a profile, including
* all the fields in the profile
*
* @param int $id
*
* @return void
*/
-
public static function commonSendMail($contactID, &$values) {
if (!$contactID || !$values) {
return;
}
/**
- * Assign uf fields to template
+ * Assign uf fields to template.
*
* @param int $gid
* Group id.
}
/**
- * Format fields for dupe Contact Matching
+ * Format fields for dupe Contact Matching.
*
* @param array $params
- * Associated array.
*
* @param int $contactId
*
- * @return array $data assoicated formatted array
- * @static
+ * @return array
+ * assoicated formatted array
*/
public static function formatFields($params, $contactId = NULL) {
if ($contactId) {
* @param int $ignoreFieldId
* Ignore particular profile field.
*
- * @return array list of calculated group type
+ * @return array
+ * list of calculated group type
*/
public static function calculateGroupType($gId, $includeTypeValues = FALSE, $ignoreFieldId = NULL) {
//get the profile fields.
* @param int $ignoreFieldId
* Ignore perticular profile field.
*
- * @return array list of calculated group type
+ * @return array
+ * list of calculated group type
*/
public static function _calculateGroupType($ufFields, $includeTypeValues = FALSE, $ignoreFieldId = NULL) {
$groupType = $groupTypeValues = $customFieldIds = array();
* @param array $groupTypes
* With key having group type names.
*
- * @return Boolean
+ * @return bool
*/
public static function updateGroupTypes($gId, $groupTypes = array()) {
if (!is_array($groupTypes) || !$gId) {
'Contact',
'Individual',
'Organization',
- 'Household'
+ 'Household',
), $componentGroupTypes, CRM_Contact_BAO_ContactType::subTypes());
$gTypes = $gTypeValues = array();
}
/**
- * Create a "group_type" string
+ * Create a "group_type" string.
*
* @param array $coreTypes
* E.g. array('Individual','Contact','Student').
}
/**
- * This function is used to setDefault componet specific profile fields.
+ * setDefault componet specific profile fields.
*
* @param array $fields
* Profile fields.
*
* @param bool $isStandalone
*
- * @return void.
+ * @return void
*/
public static function setComponentDefaults(&$fields, $componentId, $component, &$defaults, $isStandalone = FALSE) {
if (!$componentId ||
'thankyou_date',
'membership_start_date',
'membership_end_date',
- 'join_date'
+ 'join_date',
);
foreach ($fields as $name => $field) {
$fldName = $isStandalone ? $name : "field[$componentId][$name]";
'financial_type',
'payment_instrument',
'participant_status',
- 'participant_role'
+ 'participant_role',
))) {
$defaults[$fldName] = $values["{$name}_id"];
}
elseif ($name == 'membership_type') {
// since membership_type field is a hierselect -
- $defaults[$fldName][0] =
- CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $values['membership_type_id'], 'member_of_contact_id', 'id');
+ $defaults[$fldName][0]
+ = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $values['membership_type_id'], 'member_of_contact_id', 'id');
$defaults[$fldName][1] = $values['membership_type_id'];
}
elseif ($name == 'membership_status') {
}
/**
- * Retrieve groups of profiles
+ * Retrieve groups of profiles.
*
* @param int $profileID
* Id of the profile.
*
- * @return array returns array
- * @static
+ * @return array
+ * returns array
*/
public static function profileGroups($profileID) {
$groupTypes = array();
* @param int $contactId
* User contact id.
*
- * @return array $subscribeGroupIds This contains array of groups for subscription
+ * @return array
+ * This contains array of groups for subscription
*/
public static function getDoubleOptInGroupIds(&$params, $contactId = NULL) {
$config = CRM_Core_Config::singleton();
}
/**
- * Check if we are rendering mixed profiles
+ * Check if we are rendering mixed profiles.
*
* @param array $profileIds
* Associated array of profile ids.
*
- * @return boolean $mixProfile true if profile is mixed
- * @static
+ * @return bool
+ * true if profile is mixed
*/
public static function checkForMixProfiles($profileIds) {
$mixProfile = FALSE;
}
/**
- * Determine of we show overlay profile or not
+ * Determine of we show overlay profile or not.
*
- * @return boolean true if profile should be shown else false
- * @static
+ * @return bool
+ * true if profile should be shown else false
*/
public static function showOverlayProfile() {
$showOverlay = TRUE;
}
/**
- * Get group type values of the profile
+ * Get group type values of the profile.
*
* @param int $profileId
* @param string $groupType
*
- * @return Array group type values
- * @static
+ * @return array
+ * group type values
*/
public static function groupTypeValues($profileId, $groupType = NULL) {
$groupTypeValue = array();
}
/**
- * Get profiles used for batch entry
+ * Get profiles used for batch entry.
*
- * @return array profileIds profile ids
- * @static
+ * @return array
+ * profileIds profile ids
*/
public static function getBatchProfiles() {
$query = "SELECT id
}
/**
- * This is function is used to format pseudo fields
+ * This is function is used to format pseudo fields.
*
* @param array $fields
* Associated array of profile fields.
*
- * @static
*/
public static function reformatProfileFields(&$fields) {
//reformat fields array
}
}
}
+
}