Activity
in package
Table of Contents
Properties
- $aclService : AclService
- $activityForm : Activity
- $categoryService : ActivityCategory
- $companyService : Company
- $emailService : Email
- $entityManager : EntityManager
- $organService : Organ
- $translator : Translator
Methods
- __construct() : mixed
- approve() : void
- Approve of an activity.
- createActivity() : bool
- Create an activity from the creation form.
- createSignupField() : SignupField
- Create a new field.
- createSignupList() : SignupList
- Creates a SignupList for the specified Activity.
- createUpdateProposal() : bool
- Create a new update proposal from user form.
- disapprove() : void
- Disapprove of an activity.
- getActivityForm() : Activity
- Return activity creation form.
- reset() : void
- Reset the approval status of an activity.
- revokeUpdateProposal() : void
- Revoke a proposed activity update NB: This action permanently removes the proposal, so this cannot be undone.
- updateActivity() : void
- Apply a proposed activity update.
- arrayDiffAssocRecursive() : array<string|int, mixed>
- `array_diff_assoc` but recursively. Used to compare an update proposal of an activity to the original activity.
- arrayFilterRecursive() : array<string|int, mixed>
- `array_filter` but recursively. Used to compare an update proposal of an activity to the original activity.
- canApplyUpdateProposal() : bool
- Checks whether the current user is allowed to apply an update proposal for the given activity.
- createSignupOption() : void
- Creates options for both languages specified and adds it to $field.
- findOrgan() : Organ
- Find the organ the activity belongs to, and see if the user has permission to create an activity for this organ.
- isUpdateProposalNew() : bool
- Check if an update proposal is actually an update.
- recursiveUnsetKey() : void
- Recursively unset a key in an array (by reference).
- saveActivityData() : Activity
- Create an activity from parameters.
- requestFacility() : void
Properties
$aclService read-only
private
AclService
$aclService
$activityForm read-only
private
Activity
$activityForm
$categoryService read-only
private
ActivityCategory
$categoryService
$companyService read-only
private
Company
$companyService
$emailService read-only
private
Email
$emailService
$entityManager read-only
private
EntityManager
$entityManager
$organService read-only
private
Organ
$organService
$translator read-only
private
Translator
$translator
Methods
__construct()
public
__construct(AclService $aclService, Translator $translator, EntityManager $entityManager, ActivityCategory $categoryService, Organ $organService, Company $companyService, Email $emailService, Activity $activityForm) : mixed
Parameters
- $aclService : AclService
- $translator : Translator
- $entityManager : EntityManager
- $categoryService : ActivityCategory
- $organService : Organ
- $companyService : Company
- $emailService : Email
- $activityForm : Activity
approve()
Approve of an activity.
public
approve(Activity $activity) : void
Parameters
- $activity : Activity
createActivity()
Create an activity from the creation form.
public
createActivity(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
-
Parameters describing activity
Tags
Return values
bool —activity that was created
createSignupField()
Create a new field.
public
createSignupField(array<string|int, mixed> $data, SignupList $signupList) : SignupField
Parameters
- $data : array<string|int, mixed>
-
parameters for the new field
- $signupList : SignupList
-
the SignupList the field belongs to
Tags
Return values
SignupField —the new field
createSignupList()
Creates a SignupList for the specified Activity.
public
createSignupList(array<string|int, mixed> $data, Activity $activity) : SignupList
Parameters
- $data : array<string|int, mixed>
- $activity : Activity
Tags
Return values
SignupListcreateUpdateProposal()
Create a new update proposal from user form.
public
createUpdateProposal(Activity $currentActivity, array<string|int, mixed> $data) : bool
Parameters
- $currentActivity : Activity
- $data : array<string|int, mixed>
Tags
Return values
bool —indicating whether the update was applied or is pending
disapprove()
Disapprove of an activity.
public
disapprove(Activity $activity) : void
Parameters
- $activity : Activity
getActivityForm()
Return activity creation form.
public
getActivityForm() : Activity
Return values
Activityreset()
Reset the approval status of an activity.
public
reset(Activity $activity) : void
Parameters
- $activity : Activity
revokeUpdateProposal()
Revoke a proposed activity update NB: This action permanently removes the proposal, so this cannot be undone.
public
revokeUpdateProposal(ActivityUpdateProposal $proposal) : void
(The potentially updated activity remains untouched).
Parameters
- $proposal : ActivityUpdateProposal
updateActivity()
Apply a proposed activity update.
public
updateActivity(ActivityUpdateProposal $proposal) : void
Parameters
- $proposal : ActivityUpdateProposal
arrayDiffAssocRecursive()
`array_diff_assoc` but recursively. Used to compare an update proposal of an activity to the original activity.
protected
arrayDiffAssocRecursive(array<string|int, mixed> $array1, array<string|int, mixed> $array2) : array<string|int, mixed>
Adapted from https://www.php.net/manual/en/function.array-diff-assoc.php#usernotes.
Parameters
- $array1 : array<string|int, mixed>
- $array2 : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>arrayFilterRecursive()
`array_filter` but recursively. Used to compare an update proposal of an activity to the original activity.
protected
arrayFilterRecursive(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>canApplyUpdateProposal()
Checks whether the current user is allowed to apply an update proposal for the given activity.
protected
canApplyUpdateProposal(Activity $activity) : bool
Parameters
- $activity : Activity
Return values
bool —indicating whether the update may be applied
createSignupOption()
Creates options for both languages specified and adds it to $field.
protected
createSignupOption(array<string|int, mixed> $data, SignupField $field) : void
If no languages are specified, this method does nothing.
Parameters
- $data : array<string|int, mixed>
-
the array containing the options strings
- $field : SignupField
-
the field to add the options to
Tags
findOrgan()
Find the organ the activity belongs to, and see if the user has permission to create an activity for this organ.
protected
findOrgan(int $organId) : Organ
Parameters
- $organId : int
-
The id of the organ associated with the activity
Tags
Return values
Organ —The organ associated with the activity, if the user is a member of that organ
isUpdateProposalNew()
Check if an update proposal is actually an update.
protected
isUpdateProposalNew(array<string|int, mixed> $current, array<string|int, mixed> $proposal) : bool
Parameters
- $current : array<string|int, mixed>
- $proposal : array<string|int, mixed>
Tags
Return values
boolrecursiveUnsetKey()
Recursively unset a key in an array (by reference).
protected
recursiveUnsetKey(array<string|int, mixed> &$array, string $key) : void
Parameters
- $array : array<string|int, mixed>
- $key : string
Tags
saveActivityData()
Create an activity from parameters.
protected
saveActivityData(array<string|int, mixed> $data, Member $user, Organ|null $organ, Company|null $company, int $status) : Activity
Parameters
- $data : array<string|int, mixed>
-
Parameters describing activity
- $user : Member
-
The user that creates this activity
- $organ : Organ|null
-
The organ this activity is associated with
- $company : Company|null
-
The company this activity is associated with
- $status : int
Tags
Return values
Activity —activity that was created
requestFacility()
private
requestFacility(string $facilityType, Activity $activity, Member $user, Organ|null $organ) : void