Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
civimobileapi
Commits
b94dfcbd
Commit
b94dfcbd
authored
Aug 12, 2021
by
BohdanDmytryshyn
Browse files
Merge branch 'release_5_7_0' into 'master'
Release 5.7.0 See merge request
!55
parents
68c41787
6f1da118
Changes
35
Hide whitespace changes
Inline
Side-by-side
CRM/CiviMobileAPI/Api/CiviMobileCustomFields/Get.php
View file @
b94dfcbd
...
...
@@ -23,6 +23,9 @@ class CRM_CiviMobileAPI_Api_CiviMobileCustomFields_Get extends CRM_CiviMobileAPI
'Household'
=>
[
'find_for'
=>
[
'Contact'
,
'Household'
],
],
'Activity'
=>
[
'find_for'
=>
[
'Activity'
],
],
];
/**
...
...
@@ -41,6 +44,7 @@ class CRM_CiviMobileAPI_Api_CiviMobileCustomFields_Get extends CRM_CiviMobileAPI
return
[
'find_for'
=>
self
::
$entityMap
[
$params
[
'entity'
]][
'find_for'
],
'entity_id'
=>
$params
[
'entity_id'
],
'extends_entity_column_value'
=>
!
empty
(
$params
[
'extends_entity_column_value'
])
?
$params
[
'extends_entity_column_value'
]
:
NULL
];
}
...
...
@@ -51,32 +55,50 @@ class CRM_CiviMobileAPI_Api_CiviMobileCustomFields_Get extends CRM_CiviMobileAPI
*/
public
function
getResult
()
{
$result
=
[];
$anyActivitiesCustomGroups
=
[];
try
{
$customGroups
=
civicrm_api3
(
'CustomGroup'
,
'get'
,
[
'sequential'
=>
1
,
'extends'
=>
[
'IN'
=>
$this
->
validParams
[
'find_for'
]],
'is_active'
=>
1
,
'extends_entity_column_value'
=>
$this
->
validParams
[
'extends_entity_column_value'
],
'options'
=>
[
'limit'
=>
0
],
]);
])
[
'values'
]
;
}
catch
(
CiviCRM_API3_Exception
$e
)
{
return
[];
}
if
(
empty
(
$customGroups
[
'values'
]))
{
if
(
$this
->
validParams
[
'find_for'
][
0
]
==
"Activity"
&&
!
empty
(
$this
->
validParams
[
'extends_entity_column_value'
]))
{
try
{
$anyActivitiesCustomGroups
=
civicrm_api3
(
'CustomGroup'
,
'get'
,
[
'sequential'
=>
1
,
'extends'
=>
"Activity"
,
'is_active'
=>
1
,
'extends_entity_column_value'
=>
[
'IS NULL'
=>
1
],
'options'
=>
[
'limit'
=>
0
],
])[
'values'
];
}
catch
(
CiviCRM_API3_Exception
$e
)
{
return
[];
}
}
$customGroups
=
array_merge
(
$customGroups
,
$anyActivitiesCustomGroups
);
if
(
empty
(
$customGroups
))
{
return
[];
}
if
(
!
CRM_Core_Permission
::
check
(
'administer CiviCRM'
)
&&
!
CRM_Core_Permission
::
check
(
'access all custom data'
))
{
$accessibleCustomGroupsToView
=
CRM_Core_Permission
::
customGroup
(
CRM_Core_Permission
::
VIEW
);
foreach
(
$customGroups
[
'values'
]
as
$customGroup
)
{
foreach
(
$customGroups
as
$customGroup
)
{
if
(
in_array
(
$customGroup
[
'id'
],
$accessibleCustomGroupsToView
))
{
$result
[]
=
$this
->
prepareCustomGroup
(
$customGroup
);
}
}
}
else
{
foreach
(
$customGroups
[
'values'
]
as
$customGroup
)
{
foreach
(
$customGroups
as
$customGroup
)
{
$result
[]
=
$this
->
prepareCustomGroup
(
$customGroup
);
}
}
...
...
@@ -92,6 +114,8 @@ class CRM_CiviMobileAPI_Api_CiviMobileCustomFields_Get extends CRM_CiviMobileAPI
* @return array
*/
private
function
prepareCustomGroup
(
$customGroup
)
{
$gotvCustomFieldId
=
CRM_CiviMobileAPI_Utils_CustomField
::
getId
(
CRM_CiviMobileAPI_Install_Entity_CustomGroup
::
SURVEY
,
CRM_CiviMobileAPI_Install_Entity_CustomField
::
SURVEY_GOTV_STATUS
);
$customGroupData
=
[
'id'
=>
$customGroup
[
'id'
],
'name'
=>
$customGroup
[
'name'
],
...
...
@@ -105,6 +129,7 @@ class CRM_CiviMobileAPI_Api_CiviMobileCustomFields_Get extends CRM_CiviMobileAPI
try
{
$customFields
=
civicrm_api3
(
'CustomField'
,
'get'
,
[
'sequential'
=>
1
,
'id'
=>
[
'!='
=>
$gotvCustomFieldId
],
'custom_group_id'
=>
$customGroup
[
'id'
],
'options'
=>
[
'limit'
=>
0
],
'is_active'
=>
1
,
...
...
CRM/CiviMobileAPI/Api/CiviMobilePublicParticipant/Create.php
View file @
b94dfcbd
...
...
@@ -31,7 +31,9 @@ class CRM_CiviMobileAPI_Api_CiviMobilePublicParticipant_Create extends CRM_CiviM
$result
[
"values"
][
$key
][
'participant_public_key'
]
=
$publicKey
;
}
return
$result
[
"values"
];
$this
->
sendEmail
(
$result
[
'id'
]);
return
$result
[
'values'
];
}
/**
...
...
@@ -56,7 +58,8 @@ class CRM_CiviMobileAPI_Api_CiviMobilePublicParticipant_Create extends CRM_CiviM
$result
=
[
'event_id'
=>
$params
[
"event_id"
],
'contact_id'
=>
$contactId
,
'default_role_id'
=>
$event
->
default_role_id
'default_role_id'
=>
$event
->
default_role_id
,
'contact_email'
=>
$params
[
'contact_email'
]
];
return
$result
;
...
...
@@ -133,4 +136,50 @@ class CRM_CiviMobileAPI_Api_CiviMobilePublicParticipant_Create extends CRM_CiviM
}
}
/**
* Send email for participant
*
* @param $participantId
*/
private
function
sendEmail
(
$participantId
)
{
try
{
$event
=
civicrm_api3
(
'Event'
,
'getsingle'
,
[
'id'
=>
$this
->
validParams
[
"event_id"
]
]);
}
catch
(
Exception
$e
)
{
return
;
}
try
{
$participant
=
civicrm_api3
(
'Participant'
,
'getsingle'
,
[
'id'
=>
$participantId
]);
}
catch
(
Exception
$e
)
{
return
;
}
$emailParams
=
[
'participant'
=>
$participant
,
'event'
=>
$event
,
'params'
=>
[
$participantId
=>
[
'first_name'
=>
$participant
[
'first_name'
],
'last_name'
=>
$participant
[
'last_name'
],
'email-Primary'
=>
$this
->
validParams
[
'contact_email'
],
'is_primary'
=>
1
,
'is_pay_later'
=>
$event
[
'is_pay_later'
],
'contact_id'
=>
$participant
[
'contact_id'
],
'defaultRole'
=>
$event
[
'default_role_id'
],
'participant_role_id'
=>
$participant
[
'participant_role_id'
],
'description'
=>
E
::
ts
(
'Event Registration'
)
.
' '
.
$event
[
'title'
],
]
]
];
$smarty
=
CRM_Core_Smarty
::
singleton
();
$smarty
->
assign
(
'event'
,
$event
);
CRM_Event_BAO_Event
::
sendMail
(
$participant
[
"contact_id"
],
$emailParams
,
$participant
[
'participant_id'
]);
}
}
CRM/CiviMobileAPI/ApiWrapper/Contact.php
View file @
b94dfcbd
...
...
@@ -28,6 +28,7 @@ class CRM_CiviMobileAPI_ApiWrapper_Contact implements API_Wrapper {
if
(
$apiRequest
[
'action'
]
==
'getsingle'
)
{
$result
[
'can_edit'
]
=
CRM_Contact_BAO_Contact_Permission
::
allow
(
$result
[
'id'
],
CRM_Core_Permission
::
EDIT
)
?
1
:
0
;
$result
[
'can_view'
]
=
CRM_Contact_BAO_Contact_Permission
::
allow
(
$result
[
'id'
])
?
1
:
0
;
if
(
empty
(
$result
[
'current_employer_id'
])
&&
!
empty
(
$result
[
'contact_id'
]))
{
$result
[
'current_employer_id'
]
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Contact_DAO_Contact'
,
$result
[
'contact_id'
],
'employer_id'
);
...
...
CRM/CiviMobileAPI/ApiWrapper/Contribution.php
View file @
b94dfcbd
...
...
@@ -19,6 +19,22 @@ class CRM_CiviMobileAPI_ApiWrapper_Contribution implements API_Wrapper {
}
$apiRequest
[
'params'
][
'return'
]
=
array_unique
(
array_merge
(
$apiRequest
[
'params'
][
'return'
],
[
'currency'
,
'financial_type_id'
]));
}
if
(
is_mobile_request
())
{
if
(
$apiRequest
[
'params'
][
'contact_display_name'
]
||
$apiRequest
[
'params'
][
'contact_type'
]
||
$apiRequest
[
'params'
][
'contact_tags'
]
||
$apiRequest
[
'params'
][
'contact_groups'
]
)
{
$contactsId
=
(
new
CRM_CiviMobileAPI_Utils_ContributionFilter
)
->
filterContributionContacts
(
$apiRequest
[
'params'
]);
if
(
!
empty
(
$contactsId
))
{
$apiRequest
[
'params'
][
'contact_id'
]
=
[
'IN'
=>
$contactsId
];
}
else
{
$apiRequest
[
'params'
][
'contact_id'
]
=
[
'IS NULL'
=>
1
];
}
}
}
return
$apiRequest
;
}
...
...
@@ -31,16 +47,86 @@ class CRM_CiviMobileAPI_ApiWrapper_Contribution implements API_Wrapper {
* @return array
*/
public
function
toApiOutput
(
$apiRequest
,
$result
)
{
if
(
is_string
(
$apiRequest
[
'params'
][
'return'
]))
{
$apiRequest
[
'params'
][
'return'
]
=
explode
(
','
,
$apiRequest
[
'params'
][
'return'
]);
}
if
(
is_mobile_request
())
{
if
(
!
empty
(
$result
[
'values'
]))
{
$contactsId
=
$this
->
getContributionContactsId
(
$result
[
'values'
]);
try
{
$contacts
=
civicrm_api3
(
'Contact'
,
'get'
,
[
'sequential'
=>
1
,
'id'
=>
[
"IN"
=>
$contactsId
],
'options'
=>
[
'limit'
=>
0
],
])[
'values'
];
}
catch
(
CiviCRM_API3_Exception
$e
)
{
$contacts
=
[];
}
if
(
!
empty
(
$contacts
))
{
foreach
(
$contacts
as
$contact
)
{
foreach
(
$result
[
'values'
]
as
&
$contribution
)
{
if
(
$contact
[
'id'
]
==
$contribution
[
'contact_id'
])
{
$contribution
[
'contact_display_name'
]
=
!
empty
(
$contact
[
'display_name'
])
?
$contact
[
'display_name'
]
:
''
;
$contribution
[
'contact_first_name'
]
=
!
empty
(
$contact
[
'first_name'
])
?
$contact
[
'first_name'
]
:
''
;
$contribution
[
'contact_last_name'
]
=
!
empty
(
$contact
[
'last_name'
])
?
$contact
[
'last_name'
]
:
''
;
$contribution
[
'contact_type'
]
=
!
empty
(
$contact
[
'contact_type'
])
?
$contact
[
'contact_type'
]
:
''
;
$contribution
[
'contact_image_URL'
]
=
!
empty
(
$contact
[
'image_URL'
])
?
$contact
[
'image_URL'
]
:
''
;
}
}
}
}
}
$result
=
$this
->
fillFinancialTypeName
(
$apiRequest
,
$result
);
$result
=
$this
->
fillFormatTotalAmount
(
$apiRequest
,
$result
);
if
(
is_string
(
$apiRequest
[
'params'
][
'return'
]))
{
$apiRequest
[
'params'
][
'return'
]
=
explode
(
','
,
$apiRequest
[
'params'
][
'return'
]);
}
$result
=
$this
->
fillFinancialTypeName
(
$apiRequest
,
$result
);
$result
=
$this
->
fillFormatTotalAmount
(
$apiRequest
,
$result
);
$result
[
'max_total_amount'
]
=
$this
->
getMaxTotalAmount
();
}
return
$result
;
}
/**
* Get contribution contact's Id
*
* @param $contributions
* @return array
*/
public
function
getContributionContactsId
(
$contributions
)
{
$contactsId
=
[];
if
(
!
empty
(
$contributions
))
{
foreach
(
$contributions
as
$contribution
)
{
$contactsId
[]
=
$contribution
[
'contact_id'
];
}
}
return
$contactsId
;
}
/**
* Get max total amount of the contributions
*
* @return int
*/
public
function
getMaxTotalAmount
()
{
$select
=
'SELECT MAX(civicrm_contribution.total_amount) as max_total_amount'
;
$from
=
' FROM civicrm_contribution'
;
$sql
=
$select
.
$from
;
$maxTotalAmount
=
0
;
try
{
$dao
=
CRM_Core_DAO
::
executeQuery
(
$sql
);
while
(
$dao
->
fetch
())
{
$maxTotalAmount
=
(
int
)
$dao
->
max_total_amount
;
}
}
catch
(
Exception
$e
)
{
return
$maxTotalAmount
;
}
return
$maxTotalAmount
;
}
/**
* Check with API version is being called.
*
...
...
@@ -115,4 +201,5 @@ class CRM_CiviMobileAPI_ApiWrapper_Contribution implements API_Wrapper {
return
CRM_Core_DAO
::
getFieldValue
(
'CRM_Financial_DAO_FinancialType'
,
$financialTypeId
,
'name'
);
}
}
}
CRM/CiviMobileAPI/ApiWrapper/ContributionPage.php
0 → 100644
View file @
b94dfcbd
<?php
/**
* @deprecated will be deleted in version 7.0.0
*/
class
CRM_CiviMobileAPI_ApiWrapper_ContributionPage
implements
API_Wrapper
{
/**
* Interface for interpreting api input
*
* @param array $apiRequest
*
* @return array
*/
public
function
fromApiInput
(
$apiRequest
)
{
return
$apiRequest
;
}
/**
* Adds extra field
*
* @param $apiRequest
* @param $result
*
* @return array
*/
public
function
toApiOutput
(
$apiRequest
,
$result
)
{
if
(
is_mobile_request
())
{
if
(
!
empty
(
$result
[
'values'
]))
{
foreach
(
$result
[
'values'
]
as
&
$contributionPage
)
{
$contributionPage
[
'page_URL'
]
=
CRM_CiviMobileAPI_Utils_CiviCRM
::
getContributionPageUrl
(
$contributionPage
[
'id'
]);
}
}
}
return
$result
;
}
}
CRM/CiviMobileAPI/ApiWrapper/Event.php
View file @
b94dfcbd
...
...
@@ -13,6 +13,14 @@ class CRM_CiviMobileAPI_ApiWrapper_Event implements API_Wrapper {
* @return array
*/
public
function
fromApiInput
(
$apiRequest
)
{
if
(
!
empty
(
$apiRequest
[
'params'
][
'return'
]))
{
$isAllowMobileRegistration
=
"custom_"
.
CRM_CiviMobileAPI_Utils_CustomField
::
getId
(
CRM_CiviMobileAPI_Install_Entity_CustomGroup
::
ALLOW_MOBILE_REGISTRATION
,
CRM_CiviMobileAPI_Install_Entity_CustomField
::
IS_MOBILE_EVENT_REGISTRATION
);
if
(
is_string
(
$apiRequest
[
'params'
][
'return'
]))
{
$apiRequest
[
'params'
][
'return'
]
=
explode
(
','
,
$apiRequest
[
'params'
][
'return'
]);
}
$apiRequest
[
'params'
][
'return'
]
=
array_unique
(
array_merge
(
$apiRequest
[
'params'
][
'return'
],
[
$isAllowMobileRegistration
]));
}
if
(
is_mobile_request
())
{
$apiRequest
[
'params'
][
'check_permissions'
]
=
0
;
}
...
...
@@ -30,11 +38,13 @@ class CRM_CiviMobileAPI_ApiWrapper_Event implements API_Wrapper {
*/
public
function
toApiOutput
(
$apiRequest
,
$result
)
{
$isQrUsedFieldName
=
"custom_"
.
CRM_CiviMobileAPI_Utils_CustomField
::
getId
(
CRM_CiviMobileAPI_Install_Entity_CustomGroup
::
QR_USES
,
CRM_CiviMobileAPI_Install_Entity_CustomField
::
IS_QR_USED
);
$isAllowMobileRegistration
=
"custom_"
.
CRM_CiviMobileAPI_Utils_CustomField
::
getId
(
CRM_CiviMobileAPI_Install_Entity_CustomGroup
::
ALLOW_MOBILE_REGISTRATION
,
CRM_CiviMobileAPI_Install_Entity_CustomField
::
IS_MOBILE_EVENT_REGISTRATION
);
$isQrUsedAlias
=
'is_event_use_qr_code'
;
if
(
$apiRequest
[
'action'
]
==
'getsingle'
)
{
$result
[
'url'
]
=
CRM_Utils_System
::
url
(
'civicrm/event/info'
,
'id='
.
$result
[
'id'
],
true
);
$result
[
'registered_participants_count'
]
=
CRM_Event_BAO_Event
::
getParticipantCount
(
$result
[
'id'
],
FALSE
,
FALSE
,
FALSE
,
FALSE
);
$result
[
'is_allow_mobile_registration'
]
=
isset
(
$result
[
$isAllowMobileRegistration
])
?
$result
[
$isAllowMobileRegistration
]
:
0
;
}
if
(
$apiRequest
[
'action'
]
==
'get'
&&
!
empty
(
$result
[
'values'
]))
{
...
...
@@ -45,6 +55,8 @@ class CRM_CiviMobileAPI_ApiWrapper_Event implements API_Wrapper {
'event_id'
=>
$event
[
'id'
],
])[
'count'
];
$result
[
'values'
][
$key
][
'is_allow_mobile_registration'
]
=
isset
(
$result
[
'values'
][
$key
][
$isAllowMobileRegistration
])
?
$result
[
'values'
][
$key
][
$isAllowMobileRegistration
]
:
0
;
if
(
isset
(
$event
[
'currency'
]))
{
if
(
!
empty
(
$event
[
'currency'
]))
{
$result
[
'values'
][
$key
][
'currency_symbol'
]
=
CRM_CiviMobileAPI_Utils_Currency
::
getSymbolByName
(
$event
[
'currency'
]);
...
...
CRM/CiviMobileAPI/ApiWrapper/Membership/Get.php
View file @
b94dfcbd
...
...
@@ -79,12 +79,13 @@ class CRM_CiviMobileAPI_ApiWrapper_Membership_Get implements API_Wrapper {
if
(
!
empty
(
$apiRequest
[
'params'
][
'membership_contact_id'
]))
{
try
{
$lastPayment
=
civicrm_api3
(
'MembershipPayment'
,
'getsingle'
,
[
'return'
=>
[
"contribution_id.receive_date"
,
"membership_id.contact_id"
],
'return'
=>
[
"contribution_id.receive_date"
,
"membership_id.contact_id"
,
"contribution_id.payment_instrument_id"
],
'membership_id'
=>
$membership
[
'id'
],
'membership_id.contact_id'
=>
$apiRequest
[
'params'
][
'membership_contact_id'
],
'options'
=>
[
'sort'
=>
"contribution_id.receive_date desc"
,
'limit'
=>
1
],
]);
$additionalInfo
[
'payment_instrument'
]
=
CRM_CiviMobileAPI_Utils_Membership
::
getPaymentInstrumentLabel
(
$lastPayment
[
'contribution_id.payment_instrument_id'
]);
$additionalInfo
[
'last_payment_receive_date'
]
=
$lastPayment
[
'contribution_id.receive_date'
];
}
catch
(
Exception
$e
)
{}
}
...
...
CRM/CiviMobileAPI/Form/CalendarSettings.php
View file @
b94dfcbd
...
...
@@ -172,7 +172,7 @@ class CRM_CiviMobileAPI_Form_CalendarSettings extends CRM_Core_Form {
$prefixedSettings
=
[];
foreach
(
$settings
as
$name
=>
$value
)
{
$prefixedSettings
[
CRM_CiviMobileAPI_Settings_Calendar_CiviMobile
::
getName
(
$name
,
TRUE
)]
=
$value
;
$prefixedSettings
[
CRM_CiviMobileAPI_Settings_Calendar_CiviMobile
::
getName
(
$name
,
TRUE
)]
=
!
empty
(
$value
)
?
$value
:
NULL
;
}
if
(
!
empty
(
$prefixedSettings
))
{
...
...
CRM/CiviMobileAPI/Form/Settings.php
View file @
b94dfcbd
...
...
@@ -49,6 +49,9 @@ class CRM_CiviMobileAPI_Form_Settings extends CRM_Core_Form {
if
(
in_array
(
'CiviCampaign'
,
$enabledComponents
))
{
$possibleItemsToDisplayInPublicArea
[]
=
'Petitions'
;
}
if
(
in_array
(
'CiviContribute'
,
$enabledComponents
))
{
$possibleItemsToDisplayInPublicArea
[]
=
'Donations'
;
}
$this
->
assign
(
'isWritable'
,
CRM_CiviMobileAPI_Utils_Extension
::
directoryIsWritable
());
$this
->
assign
(
'serverKeyValidMessage'
,
$serverKeyValidMessage
);
...
...
CRM/CiviMobileAPI/Install/Entity/CustomField.php
View file @
b94dfcbd
...
...
@@ -23,6 +23,7 @@ class CRM_CiviMobileAPI_Install_Entity_CustomField extends CRM_CiviMobileAPI_Ins
const
PUBLIC_KEY
=
'public_key'
;
const
AGENDA_PARTICIPANT_BIO
=
'civi_mobile_agenda_participant_bio'
;
const
SURVEY_GOTV_STATUS
=
'civi_mobile_survey_gotv_status'
;
const
IS_MOBILE_EVENT_REGISTRATION
=
'civi_mobile_is_event_mobile_registration'
;
/**
* Params for checking Entity existence
...
...
@@ -96,6 +97,15 @@ class CRM_CiviMobileAPI_Install_Entity_CustomField extends CRM_CiviMobileAPI_Ins
'is_view'
=>
1
,
'default_value'
=>
0
],
[
'name'
=>
self
::
IS_MOBILE_EVENT_REGISTRATION
,
'label'
=>
E
::
ts
(
'Allow Online registration in CiviMobile?'
),
'custom_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_CustomGroup
::
ALLOW_MOBILE_REGISTRATION
,
'html_type'
=>
'Radio'
,
'data_type'
=>
'Boolean'
,
'is_view'
=>
1
,
'default_value'
=>
1
],
];
}
...
...
CRM/CiviMobileAPI/Install/Entity/CustomGroup.php
View file @
b94dfcbd
...
...
@@ -15,6 +15,7 @@ class CRM_CiviMobileAPI_Install_Entity_CustomGroup extends CRM_CiviMobileAPI_Ins
const
PUBLIC_INFO
=
'civi_mobile_public_info'
;
const
AGENDA_PARTICIPANT
=
'civi_mobile_agenda_participant'
;
const
SURVEY
=
'civi_mobile_survey'
;
const
ALLOW_MOBILE_REGISTRATION
=
'civi_mobile_allow_registration'
;
/**
* Entity name
...
...
@@ -70,6 +71,15 @@ class CRM_CiviMobileAPI_Install_Entity_CustomGroup extends CRM_CiviMobileAPI_Ins
'is_public'
=>
0
,
'is_reserved'
=>
1
],
[
'name'
=>
self
::
ALLOW_MOBILE_REGISTRATION
,
'title'
=>
E
::
ts
(
'Allow Online registration in CiviMobile'
),
'extends'
=>
'Event'
,
'is_public'
=>
1
,
'style'
=>
'Inline'
,
'collapse_display'
=>
1
,
'is_reserved'
=>
1
],
];
}
...
...
CRM/CiviMobileAPI/Install/Entity/OptionGroup.php
0 → 100644
View file @
b94dfcbd
<?php
use
CRM_CiviMobileAPI_ExtensionUtil
as
E
;
class
CRM_CiviMobileAPI_Install_Entity_OptionGroup
extends
CRM_CiviMobileAPI_Install_Entity_EntityBase
{
/**
* Entity name
*
* @var string
*/
protected
$entityName
=
'OptionGroup'
;
/**
* OptionGroup name
*
* @var string
*/
const
TABS
=
'civi_mobile_tabs'
;
/**
* Params for checking Entity existence
*
* @var array
*/
protected
$entitySearchParamNameList
=
[
'name'
];
/**
* Sets entity Param list
*/
protected
function
setEntityParamList
()
{
$this
->
entityParamList
=
[
[
'name'
=>
self
::
TABS
,
'title'
=>
E
::
ts
(
'CiviMobile Tabs'
),
'data_type'
=>
'String'
,
'is_reserved'
=>
1
,
'is_locked'
=>
1
]
];
}
}
CRM/CiviMobileAPI/Install/Entity/OptionValue.php
0 → 100644
View file @
b94dfcbd
<?php
use
CRM_CiviMobileAPI_ExtensionUtil
as
E
;
class
CRM_CiviMobileAPI_Install_Entity_OptionValue
extends
CRM_CiviMobileAPI_Install_Entity_EntityBase
{
/**
* Entity name
*
* @var string
*/
protected
$entityName
=
'OptionValue'
;
/**
* OptionValue name
*
* @var string
*/
const
TAB_CALENDAR
=
'civi_mobile_tab_calendar'
;
const
TAB_EVENTS
=
'civi_mobile_tab_events'
;
const
TAB_ACTIVITIES
=
'civi_mobile_tab_activities'
;
const
TAB_CONTACTS
=
'civi_mobile_tab_contacts'
;
const
TAB_CASES
=
'civi_mobile_tab_cases'
;
const
TAB_RELATIONSHIPS
=
'civi_mobile_tab_relationships'
;
const
TAB_MEMBERSHIPS
=
'civi_mobile_tab_memberships'
;
const
TAB_CONTRIBUTIONS
=
'civi_mobile_tab_contributions'
;
const
TAB_NOTES
=
'civi_mobile_tab_notes'
;
const
TAB_GROUPS
=
'civi_mobile_tab_groups'
;
const
TAB_TAGS
=
'civi_mobile_tab_tags'
;
const
TAB_SURVEYS
=
'civi_mobile_tab_surveys'
;
/**
* Params for checking Entity existence
*
* @var array
*/
protected
$entitySearchParamNameList
=
[
'name'
,
'option_group_id'
];
/**
* Sets entity Param list
*/
protected
function
setEntityParamList
()
{
$this
->
entityParamList
=
[
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Calendar'
),
'name'
=>
self
::
TAB_CALENDAR
,
'value'
=>
self
::
TAB_CALENDAR
,
'weight'
=>
1
,
],
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Events'
),
'name'
=>
self
::
TAB_EVENTS
,
'value'
=>
self
::
TAB_EVENTS
,
'weight'
=>
2
,
],
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Cases'
),
'name'
=>
self
::
TAB_CASES
,
'value'
=>
self
::
TAB_CASES
,
'weight'
=>
3
,
],
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Activities'
),
'name'
=>
self
::
TAB_ACTIVITIES
,
'value'
=>
self
::
TAB_ACTIVITIES
,
'weight'
=>
4
,
],
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Contacts'
),
'name'
=>
self
::
TAB_CONTACTS
,
'value'
=>
self
::
TAB_CONTACTS
,
'weight'
=>
5
,
],
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Relationships'
),
'name'
=>
self
::
TAB_RELATIONSHIPS
,
'value'
=>
self
::
TAB_RELATIONSHIPS
,
'weight'
=>
6
,
],
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Memberships'
),
'name'
=>
self
::
TAB_MEMBERSHIPS
,
'value'
=>
self
::
TAB_MEMBERSHIPS
,
'weight'
=>
7
,
],
[
'option_group_id'
=>
CRM_CiviMobileAPI_Install_Entity_OptionGroup
::
TABS
,
'label'
=>
E
::
ts
(
'Contributions'
),
'name'
=>
self
::
TAB_CONTRIBUTIONS
,
'value'
=>
self
::
TAB_CONTRIBUTIONS
,
'weight'
=>
8
,