Bristol SU Support Package
EventFired.php
Go to the documentation of this file.
1 <?php
2 
4 
11 
16 {
17 
24 
30  {
31  parent::__construct($moduleAlias);
32  $this->eventRepository = $eventRepository;
33  }
34 
41  public function options(): Form
42  {
43  return \FormSchema\Generator\Form::make()->withField(
44  Field::select('event_type')->label('Event')->required(true)->hint('What event should be fired to mark this as complete?')
45  ->help('Select an event which occurs within the module. When this event is fired, the module will be marked as complete. This cannot be undone.')
46  ->values(collect($this->eventRepository->allForModule($this->moduleAlias()))->map(function($event) {
47  return ['id' => $event['event'], 'name' => $event['name']];
48  })->toArray())->selectOptions(['noneSelectedText' => 'Please Select an Event', 'hideNoneSelectedText' => false])
49  )->getSchema();
50  }
51 
57  public function name(): string
58  {
59  return 'Event Fired.';
60  }
61 
67  public function description(): string
68  {
69  return 'Event Fired. Warning: this will not be dynamically calculated so reverting a change to undo the condition will not mark the module as incomplete.';
70  }
71 
77  public function alias(): string
78  {
79  return 'portalsystem_event_fired';
80  }
81 
92  public function isComplete($settings, ActivityInstance $activityInstance, ModuleInstance $moduleInstance): bool
93  {
94  return true;
95  }
96 }
isComplete($settings, ActivityInstance $activityInstance, ModuleInstance $moduleInstance)
Definition: EventFired.php:92
__construct(string $moduleAlias, EventRepository $eventRepository)
Definition: EventFired.php:29