/**
* @var array details of the UFGroup used on this page
*/
- protected $_ufGroup = array('name' => 'unknown');
+ protected $_ufGroup = ['name' => 'unknown'];
/**
* The group id that we are passing in url.
/**
* Name of button for saving matching contacts.
- * @var
+ * @var string
*/
protected $_duplicateButtonName;
/**
/**
* Dedupe using a specific rule (CRM-6131).
* Not currently exposed in profile settings, but can be set in a buildForm hook.
+ * @var int
*/
public $_ruleGroupID = NULL;
/**
* Store profile ids if multiple profile ids are passed using comma separated.
* Currently lets implement this functionality only for dialog mode.
+ * @var array
*/
- protected $_profileIds = array();
+ protected $_profileIds = [];
/**
* Contact profile having activity fields?
}
if ($this->_multiRecord &&
- !in_array($this->_multiRecord, array(CRM_Core_Action::UPDATE, CRM_Core_Action::ADD, CRM_Core_Action::DELETE))
+ !in_array($this->_multiRecord, [CRM_Core_Action::UPDATE, CRM_Core_Action::ADD, CRM_Core_Action::DELETE])
) {
CRM_Core_Error::fatal(ts('Proper action not specified for this custom value record profile'));
}
$dao->free();
if (!CRM_Utils_Array::value('is_active', $this->_ufGroup)) {
- CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', array(
+ CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', [
1 => $this->_gid,
- )));
+ ]));
}
}
$this->assign('ufGroupName', $this->_ufGroup['name']);
&& ($this->_multiRecord == CRM_Core_Action::UPDATE || $this->_multiRecord == CRM_Core_Action::DELETE)
) {
CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) requires record id while performing this action',
- array(1 => $this->_gid)
+ [1 => $this->_gid]
));
}
elseif (empty($this->_multiRecordFields)) {
CRM_Core_Error::fatal(ts('No Multi-Record Fields configured for this profile (gid=%1)',
- array(1 => $this->_gid)
+ [1 => $this->_gid]
));
}
$fieldId = CRM_Core_BAO_CustomField::getKeyID(key($this->_multiRecordFields));
- $customGroupDetails = CRM_Core_BAO_CustomGroup::getGroupTitles(array($fieldId));
+ $customGroupDetails = CRM_Core_BAO_CustomGroup::getGroupTitles([$fieldId]);
$this->_customGroupTitle = $customGroupDetails[$fieldId]['groupTitle'];
$this->_customGroupId = $customGroupDetails[$fieldId]['groupID'];
else {
$this->_recordExists = FALSE;
if ($this->_multiRecord & CRM_Core_Action::UPDATE) {
- CRM_Core_Session::setStatus(ts('Note: The record %1 doesnot exists. Upon save a new record will be create', array(1 => $this->_recordId)), ts('Record doesnot exist'), 'alert');
+ CRM_Core_Session::setStatus(ts('Note: The record %1 doesnot exists. Upon save a new record will be create', [1 => $this->_recordId]), ts('Record doesnot exist'), 'alert');
}
}
}
}
elseif (!empty($this->_multiRecordFields)
- && (!$this->_multiRecord || !in_array($this->_multiRecord, array(
+ && (!$this->_multiRecord || !in_array($this->_multiRecord, [
CRM_Core_Action::DELETE,
CRM_Core_Action::UPDATE,
- )))
+ ]))
) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
//multi-record listing page
*
*/
public function setDefaultsValues() {
- $this->_defaults = array();
+ $this->_defaults = [];
if ($this->_multiRecordProfile && ($this->_multiRecord == CRM_Core_Action::DELETE)) {
return;
}
if ($this->_id && !$this->_multiRecordProfile) {
if ($this->_isContactActivityProfile) {
- $contactFields = $activityFields = array();
+ $contactFields = $activityFields = [];
foreach ($this->_fields as $fieldName => $field) {
if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
$activityFields[$fieldName] = $field;
$fieldIds[] = CRM_Core_BAO_CustomField::getKeyID($key);
}
- $defaultValues = array();
+ $defaultValues = [];
if ($this->_multiRecord && $this->_multiRecord == CRM_Core_Action::UPDATE) {
$defaultValues = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_id, NULL, $fieldIds, TRUE);
if ($this->_recordExists == TRUE) {
if (($this->_multiRecord & CRM_Core_Action::DELETE)) {
if (!$this->_recordExists) {
- CRM_Core_Session::setStatus(ts('The record %1 doesnot exists', array(1 => $this->_recordId)), ts('Record doesnot exists'), 'alert');
+ CRM_Core_Session::setStatus(ts('The record %1 doesnot exists', [1 => $this->_recordId]), ts('Record doesnot exists'), 'alert');
}
else {
$this->assign('deleteRecord', TRUE);
$return = TRUE;
if (!$statusMessage) {
$statusMessage = ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.",
- array(1 => $profileSubType ? $profileSubType : $profileType));
+ [1 => $profileSubType ? $profileSubType : $profileType]);
}
}
}
if (
in_array(
$profileType,
- array("Membership", "Participant", "Contribution")
+ ["Membership", "Participant", "Contribution"]
)
) {
$return = TRUE;
}
$this->assign('anonUser', $anonUser);
- $addCaptcha = array();
+ $addCaptcha = [];
$emailPresent = FALSE;
// add the form elements
* @return array
*/
public static function validateContactActivityProfile($activityId, $contactId, $gid) {
- $errors = array();
+ $errors = [];
if (!$activityId) {
$errors[] = ts('Profile is using one or more activity fields, and is missing the activity Id (aid) in the URL.');
return $errors;
}
- $activityDetails = array();
- $activityParams = array('id' => $activityId);
+ $activityDetails = [];
+ $activityParams = ['id' => $activityId];
CRM_Activity_BAO_Activity::retrieve($activityParams, $activityDetails);
if (empty($activityDetails)) {
$customizedValue = CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greeting . '_id', 'Customized');
if ($customizedValue == $greetingType && empty($fields[$greeting . '_custom'])) {
$errors[$greeting . '_custom'] = ts('Custom %1 is a required field if %1 is of type Customized.',
- array(1 => ucwords(str_replace('_', ' ', $greeting)))
+ [1 => ucwords(str_replace('_', ' ', $greeting))]
);
}
}
if ($this->_deleteButtonName) {
if (!empty($_POST[$this->_deleteButtonName]) && $this->_recordId) {
$filterParams['id'] = $this->_customGroupId;
- $returnProperties = array('is_multiple', 'table_name');
+ $returnProperties = ['is_multiple', 'table_name'];
CRM_Core_DAO::commonRetrieve("CRM_Core_DAO_CustomGroup", $filterParams, $returnValues, $returnProperties);
if (!empty($returnValues['is_multiple'])) {
if ($tableName = CRM_Utils_Array::value('table_name', $returnValues)) {
$sql = "DELETE FROM {$tableName} WHERE id = %1 AND entity_id = %2";
- $sqlParams = array(
- 1 => array($this->_recordId, 'Integer'),
- 2 => array($this->_id, 'Integer'),
- );
+ $sqlParams = [
+ 1 => [$this->_recordId, 'Integer'],
+ 2 => [$this->_id, 'Integer'],
+ ];
CRM_Core_DAO::executeQuery($sql, $sqlParams);
CRM_Core_Session::setStatus(ts('Your record has been deleted.'), ts('Deleted'), 'success');
}
CRM_Contact_BAO_Contact::processImageParams($params);
}
- $greetingTypes = array(
+ $greetingTypes = [
'addressee' => 'addressee_id',
'email_greeting' => 'email_greeting_id',
'postal_greeting' => 'postal_greeting_id',
- );
+ ];
- $details = array();
+ $details = [];
if ($this->_id) {
$contactDetails = CRM_Contact_BAO_Contact::getHierContactDetails($this->_id,
$greetingTypes
//used to send subscribe mail to the group which user want.
//if the profile double option in is enabled
- $mailingType = array();
+ $mailingType = [];
$result = NULL;
foreach ($params as $name => $values) {
}
//array of group id, subscribed by contact
- $contactGroup = array();
+ $contactGroup = [];
if (!empty($params['group']) &&
CRM_Core_BAO_UFGroup::isProfileDoubleOptin()
) {
- $groupSubscribed = array();
+ $groupSubscribed = [];
if (!empty($result['email'])) {
if ($this->_id) {
$contactGroups = new CRM_Contact_DAO_GroupContact();
$contactGroups->contact_id = $this->_id;
$contactGroups->status = 'Added';
$contactGroups->find();
- $contactGroup = array();
+ $contactGroup = [];
while ($contactGroups->fetch()) {
$contactGroup[] = $contactGroups->group_id;
$groupSubscribed[$contactGroups->group_id] = 1;
) {
if (!count($contactGroup)) {
//array of group id, subscribed by contact
- $contactGroup = array();
+ $contactGroup = [];
if ($this->_id) {
$contactGroups = new CRM_Contact_DAO_GroupContact();
$contactGroups->contact_id = $this->_id;
$contactGroups->status = 'Added';
$contactGroups->find();
- $contactGroup = array();
+ $contactGroup = [];
while ($contactGroups->fetch()) {
$contactGroup[] = $contactGroups->group_id;
$groupSubscribed[$contactGroups->group_id] = 1;
$profileFields = $this->_fields;
if (($this->_mode & self::MODE_EDIT) && $this->_activityId && $this->_isContactActivityProfile) {
- $profileFields = $activityParams = array();
+ $profileFields = $activityParams = [];
foreach ($this->_fields as $fieldName => $field) {
if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
if (isset($params[$fieldName])) {
CRM_Mailing_Event_BAO_Subscribe::commonSubscribe($mailingType, $result, $this->_id, 'profile');
}
- $ufGroups = array();
+ $ufGroups = [];
if ($this->_gid) {
$ufGroups[$this->_gid] = 1;
}