|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
/** Applications controllers */ |
|
11
|
|
|
namespace Applications\Controller; |
|
12
|
|
|
|
|
13
|
|
|
use Applications\Entity\Contact; |
|
14
|
|
|
use Applications\Listener\Events\ApplicationEvent; |
|
15
|
|
|
use Zend\Mvc\Controller\AbstractActionController; |
|
16
|
|
|
use Zend\Mvc\MvcEvent; |
|
17
|
|
|
use Applications\Entity\Application; |
|
18
|
|
|
use Zend\View\Model\ViewModel; |
|
19
|
|
|
use Zend\View\Model\JsonModel; |
|
20
|
|
|
use Core\Form\Container; |
|
21
|
|
|
use Core\Form\SummaryForm; |
|
22
|
|
|
use Core\Entity\PermissionsInterface; |
|
23
|
|
|
use Applications\Entity\Status; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* there are basically two ways to use this controller, |
|
27
|
|
|
* (1) either you have a form, and want to accumulate inputs, or you want to create a form on an existing or new application |
|
28
|
|
|
* (2) or want to do some action on a concrete form. |
|
29
|
|
|
* |
|
30
|
|
|
* for both you need the applyId, which is NOT the application-id, the applyId is an alias for the Job, it can be some human-readable text or an external ID. |
|
31
|
|
|
* the application to an applyId is found by the combination of the user and the job, that is represented by the applyId. |
|
32
|
|
|
* this approach ensures, that applications stick to the related job. |
|
33
|
|
|
* |
|
34
|
|
|
* nonetheless, there is an exception, for the posts for updating the application, the application-id is needed. |
|
35
|
|
|
* |
|
36
|
|
|
* if you use the do as query-parameter, you have to customize the do-Action for the special purpose that is assigned to the do parameter in the query |
|
37
|
|
|
* |
|
38
|
|
|
* @method \Acl\Controller\Plugin\Acl acl() |
|
39
|
|
|
* @method \Core\Controller\Plugin\Notification notification() |
|
40
|
|
|
* @method \Core\Controller\Plugin\Mailer mailer() |
|
41
|
|
|
* @method \Auth\Controller\Plugin\Auth auth() |
|
42
|
|
|
* @author Mathias Gelhausen <[email protected]> |
|
43
|
|
|
*/ |
|
44
|
|
|
class ApplyController extends AbstractActionController |
|
45
|
|
|
{ |
|
46
|
|
|
|
|
47
|
|
|
protected $container; |
|
48
|
|
|
|
|
49
|
|
View Code Duplication |
public function attachDefaultListeners() |
|
|
|
|
|
|
50
|
|
|
{ |
|
51
|
|
|
parent::attachDefaultListeners(); |
|
52
|
|
|
$events = $this->getEventManager(); |
|
53
|
|
|
$events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 10); |
|
54
|
|
|
$serviceLocator = $this->getServiceLocator(); |
|
55
|
|
|
$defaultServices = $serviceLocator->get('DefaultListeners'); |
|
56
|
|
|
$events->attach($defaultServices); |
|
|
|
|
|
|
57
|
|
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function preDispatch(MvcEvent $e) |
|
61
|
|
|
{ |
|
62
|
|
|
/* @var $application \Applications\Entity\Application */ |
|
63
|
|
|
if ($this->params()->fromQuery('do')) { |
|
64
|
|
|
$e->getRouteMatch()->setParam('action', 'do'); |
|
65
|
|
|
return; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/* @var $request \Zend\Http\Request */ |
|
69
|
|
|
/* @var $repository \Applications\Repository\Application */ |
|
70
|
|
|
/* @var $container \Applications\Form\Apply */ |
|
71
|
|
|
$request = $this->getRequest(); |
|
72
|
|
|
$services = $this->getServiceLocator(); |
|
73
|
|
|
$repositories = $services->get('repositories'); |
|
74
|
|
|
$repository = $repositories->get('Applications/Application'); |
|
75
|
|
|
$container = $services->get('forms')->get('Applications/Apply'); |
|
76
|
|
|
|
|
77
|
|
|
if ($request->isPost()) { |
|
78
|
|
|
$appId = $this->params()->fromPost('applicationId'); |
|
79
|
|
|
if (!$appId) { |
|
80
|
|
|
throw new \RuntimeException('Missing application id.'); |
|
81
|
|
|
} |
|
82
|
|
|
$routeMatch = $e->getRouteMatch(); |
|
83
|
|
|
|
|
84
|
|
|
if ('recruiter-preview' == $appId) { |
|
85
|
|
|
$routeMatch->setParam('action', 'process-preview'); |
|
86
|
|
|
return; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
$application = $repository->find($appId); |
|
90
|
|
|
if (!$application) { |
|
91
|
|
|
throw new \RuntimeException('Invalid application id.'); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
$action = 'process'; |
|
95
|
|
|
|
|
96
|
|
|
$routeMatch->setParam('action', $action); |
|
97
|
|
|
} else { |
|
98
|
|
|
$user = $this->auth()->getUser(); |
|
99
|
|
|
$appId = $this->params('applyId'); |
|
100
|
|
|
if (!$appId) { |
|
101
|
|
|
throw new \RuntimeException('Missing apply id'); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/* @var \Jobs\Entity\Job $job */ |
|
105
|
|
|
$job = $repositories->get('Jobs/Job')->findOneByApplyId($appId); |
|
106
|
|
|
|
|
107
|
|
|
if (!$job) { |
|
108
|
|
|
$e->getRouteMatch()->setParam('action', 'job-not-found'); |
|
109
|
|
|
return; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
switch ($job->getStatus()) { |
|
113
|
|
|
case \Jobs\Entity\Status::ACTIVE: |
|
114
|
|
|
break; |
|
115
|
|
|
default: |
|
116
|
|
|
$e->getRouteMatch()->setParam('action', 'job-not-found'); |
|
117
|
|
|
return; |
|
118
|
|
|
break; |
|
|
|
|
|
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
if ($user === $job->getUser()) { |
|
122
|
|
|
$application = new \Applications\Entity\Application(); |
|
123
|
|
|
$application->setContact(new Contact()); |
|
124
|
|
|
$application->setJob($job); |
|
125
|
|
|
$application->setId('recruiter-preview'); |
|
126
|
|
|
} else { |
|
127
|
|
|
$subscriberUri = $this->params()->fromQuery('subscriber'); |
|
128
|
|
|
$application = $repository->findDraft($user, $appId); |
|
129
|
|
|
|
|
130
|
|
|
if ($application) { |
|
131
|
|
|
/* @var $form \Auth\Form\UserInfo */ |
|
132
|
|
|
$form = $container->getForm('contact.contact'); |
|
133
|
|
|
$form->setDisplayMode('summary'); |
|
134
|
|
|
|
|
135
|
|
|
if ($subscriberUri) { |
|
136
|
|
|
$subscriber = $application->getSubscriber(); |
|
137
|
|
|
if (!$subscriber || $subscriber->uri != $subscriberUri) { |
|
138
|
|
|
$subscriber = $repositories->get('Applications/Subscriber')->findbyUri($subscriberUri, /*create*/ true); |
|
139
|
|
|
$application->setSubscriber($subscriber); |
|
140
|
|
|
$subscriber->getname(); |
|
141
|
|
|
} |
|
142
|
|
|
} |
|
143
|
|
|
} else { |
|
144
|
|
|
if (!$job) { |
|
145
|
|
|
$e->getRouteMatch()->setParam('action', 'job-not-found'); |
|
146
|
|
|
return; |
|
147
|
|
|
} |
|
148
|
|
|
if ($job->getUriApply()) { |
|
149
|
|
|
return $this->redirect($job->getUriApply()); |
|
|
|
|
|
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/* @var $application \Applications\Entity\Application */ |
|
153
|
|
|
$application = $repository->create(); |
|
154
|
|
|
$application->setIsDraft(true) |
|
155
|
|
|
->setContact($user->getInfo()) |
|
156
|
|
|
->setUser($user) |
|
157
|
|
|
->setJob($job); |
|
158
|
|
|
|
|
159
|
|
|
if ($subscriberUri) { |
|
160
|
|
|
$subscriber = $repositories->get('Applications/Subscriber')->findbyUri($subscriberUri, /*create*/ true); |
|
161
|
|
|
$application->setSubscriber($subscriber); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
$repositories->store($application); |
|
165
|
|
|
/* |
|
166
|
|
|
* If we had copy an user image, we need to refresh its data |
|
167
|
|
|
* to populate the length property. |
|
168
|
|
|
*/ |
|
169
|
|
|
if ($image = $application->getContact()->getImage()) { |
|
170
|
|
|
$repositories->refresh($image); |
|
171
|
|
|
} |
|
172
|
|
|
} |
|
173
|
|
|
} |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
$container->setEntity($application); |
|
177
|
|
|
$this->configureContainer($container); |
|
178
|
|
|
$this->container = $container; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
public function jobNotFoundAction() |
|
182
|
|
|
{ |
|
183
|
|
|
$this->response->setStatusCode(410); |
|
|
|
|
|
|
184
|
|
|
$model = new ViewModel( |
|
185
|
|
|
[ 'content' => /*@translate*/ 'Invalid apply id'] |
|
186
|
|
|
); |
|
187
|
|
|
$model->setTemplate('applications/error/not-found'); |
|
188
|
|
|
return $model; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
public function indexAction() |
|
192
|
|
|
{ |
|
193
|
|
|
/* @var \Applications\Form\Apply $form */ |
|
194
|
|
|
$form = $this->container; |
|
195
|
|
|
$serviceLocator = $this->getServiceLocator(); |
|
196
|
|
|
$translator = $serviceLocator->get('Translator'); |
|
197
|
|
|
/* @var \Auth\Form\SocialProfiles $profiles */ |
|
198
|
|
|
|
|
199
|
|
|
$profiles=$form->get('profiles'); |
|
200
|
|
|
/* |
|
201
|
|
|
* can we add the description to Applications\Form\Apply ? |
|
202
|
|
|
*/ |
|
203
|
|
|
$profiles->getBaseFieldset()->setOption('description', $translator->translate("you can add your social profile to your application. You can preview and remove the attached profile before submitting the application.")); |
|
204
|
|
|
|
|
205
|
|
|
$application = $form->getEntity(); |
|
206
|
|
|
|
|
207
|
|
|
$form->setParam('applicationId', $application->id); |
|
|
|
|
|
|
208
|
|
|
|
|
209
|
|
|
$model = new ViewModel( |
|
210
|
|
|
array( |
|
211
|
|
|
'form' => $form, |
|
212
|
|
|
'isApplicationValid' => $this->checkApplication($application), |
|
213
|
|
|
'application' => $application, |
|
214
|
|
|
) |
|
215
|
|
|
); |
|
216
|
|
|
$model->setTemplate('applications/apply/index'); |
|
217
|
|
|
return $model; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
public function oneClickApplyAction() |
|
221
|
|
|
{ |
|
222
|
|
|
/* @var \Applications\Entity\Application $application */ |
|
223
|
|
|
$application = $this->container->getEntity(); |
|
224
|
|
|
$job = $application->getJob(); |
|
225
|
|
|
$atsMode = $job->getAtsMode(); |
|
226
|
|
|
|
|
227
|
|
|
// check for one click apply |
|
228
|
|
|
if (!($atsMode->isIntern() && $atsMode->getOneClickApply())) |
|
229
|
|
|
{ |
|
230
|
|
|
// redirect to regular application |
|
231
|
|
|
return $this->redirect() |
|
232
|
|
|
->toRoute('lang/apply', ['applyId' => $job->getApplyId()]); |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
$network = $this->params('network'); |
|
236
|
|
|
|
|
237
|
|
|
$hybridAuth = $this->getServiceLocator() |
|
238
|
|
|
->get('HybridAuthAdapter') |
|
239
|
|
|
->getHybridAuth(); |
|
240
|
|
|
/* @var $authProfile \Hybrid_User_Profile */ |
|
241
|
|
|
$authProfile = $hybridAuth->authenticate($network) |
|
242
|
|
|
->getUserProfile(); |
|
243
|
|
|
|
|
244
|
|
|
/* @var \Auth\Entity\SocialProfiles\AbstractProfile $profile */ |
|
245
|
|
|
$profile = $this->plugin('Auth/SocialProfiles')->fetch($network); |
|
246
|
|
|
|
|
247
|
|
|
$contact = $application->getContact(); |
|
248
|
|
|
$contact->setEmail($authProfile->emailVerified ?: $authProfile->email); |
|
249
|
|
|
$contact->setFirstName($authProfile->firstName); |
|
250
|
|
|
$contact->setLastName($authProfile->lastName); |
|
251
|
|
|
$contact->setBirthDay($authProfile->birthDay); |
|
252
|
|
|
$contact->setBirthMonth($authProfile->birthMonth); |
|
253
|
|
|
$contact->setBirthYear($authProfile->birthYear); |
|
254
|
|
|
$contact->setPostalCode($authProfile->zip); |
|
255
|
|
|
$contact->setCity($authProfile->city); |
|
256
|
|
|
$contact->setStreet($authProfile->address); |
|
257
|
|
|
$contact->setPhone($authProfile->phone); |
|
258
|
|
|
$contact->setGender($authProfile->gender); |
|
259
|
|
|
|
|
260
|
|
|
$profiles = $application->getProfiles(); |
|
261
|
|
|
$profiles->add($profile); |
|
262
|
|
|
|
|
263
|
|
|
$cv = $application->getCv(); |
|
264
|
|
|
$cv->setEmployments($profile->getEmployments()); |
|
265
|
|
|
$cv->setEducations($profile->getEducations()); |
|
266
|
|
|
|
|
267
|
|
|
if ($authProfile->photoURL) |
|
268
|
|
|
{ |
|
269
|
|
|
$response = (new \Zend\Http\Client($authProfile->photoURL, ['sslverifypeer' => false]))->send(); |
|
270
|
|
|
$file = new \Doctrine\MongoDB\GridFSFile(); |
|
271
|
|
|
$file->setBytes($response->getBody()); |
|
272
|
|
|
|
|
273
|
|
|
$image = new \Applications\Entity\Attachment(); |
|
274
|
|
|
$image->setName($contact->getLastName().$contact->getFirstName()); |
|
275
|
|
|
$image->setType($response->getHeaders()->get('Content-Type')->getFieldValue()); |
|
|
|
|
|
|
276
|
|
|
$image->setFile($file); |
|
277
|
|
|
$image->setPermissions($application->getPermissions()); |
|
278
|
|
|
|
|
279
|
|
|
$contact->setImage($image); |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
$urlOptions = []; |
|
283
|
|
|
|
|
284
|
|
|
if ($this->params('immediately')) |
|
285
|
|
|
{ |
|
286
|
|
|
$application->getAttributes()->setAcceptedPrivacyPolicy(true); |
|
287
|
|
|
$urlOptions = [ |
|
288
|
|
|
'query' => [ |
|
289
|
|
|
'do' => 'send' |
|
290
|
|
|
] |
|
291
|
|
|
]; |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
return $this->redirect() |
|
295
|
|
|
->toRoute('lang/apply', ['applyId' => $job->getApplyId()], $urlOptions); |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
public function processPreviewAction() |
|
299
|
|
|
{ |
|
300
|
|
|
return new JsonModel(array('valid' => false, 'errors' => array())); |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
public function processAction() |
|
|
|
|
|
|
304
|
|
|
{ |
|
305
|
|
|
$formName = $this->params()->fromQuery('form'); |
|
306
|
|
|
$form = $this->container->getForm($formName); |
|
307
|
|
|
$postData = $form->getOption('use_post_array') ? $_POST : array(); |
|
308
|
|
|
$filesData = $form->getOption('use_files_array') ? $_FILES : array(); |
|
309
|
|
|
$data = array_merge($postData, $filesData); |
|
310
|
|
|
|
|
311
|
|
|
$form->setData($data); |
|
312
|
|
|
|
|
313
|
|
View Code Duplication |
if (!$form->isValid()) { |
|
|
|
|
|
|
314
|
|
|
return new JsonModel( |
|
315
|
|
|
array( |
|
316
|
|
|
'valid' => false, |
|
317
|
|
|
'errors' => $form->getMessages(), |
|
318
|
|
|
) |
|
319
|
|
|
); |
|
320
|
|
|
} |
|
321
|
|
|
$application = $this->container->getEntity(); |
|
322
|
|
|
$this->getServiceLocator()->get('repositories')->store($application); |
|
323
|
|
|
|
|
324
|
|
|
if ('file-uri' === $this->params()->fromPost('return')) { |
|
325
|
|
|
$basepath = $this->getServiceLocator()->get('ViewHelperManager')->get('basepath'); |
|
326
|
|
|
$content = $basepath($form->getHydrator()->getLastUploadedFile()->getUri()); |
|
327
|
|
View Code Duplication |
} else { |
|
|
|
|
|
|
328
|
|
|
if ($form instanceof SummaryForm) { |
|
329
|
|
|
$form->setRenderMode(SummaryForm::RENDER_SUMMARY); |
|
330
|
|
|
$viewHelper = 'summaryform'; |
|
331
|
|
|
} else { |
|
332
|
|
|
$viewHelper = 'form'; |
|
333
|
|
|
} |
|
334
|
|
|
$content = $this->getServiceLocator()->get('ViewHelperManager')->get($viewHelper)->__invoke($form); |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
return new JsonModel( |
|
338
|
|
|
array( |
|
339
|
|
|
'valid' => $form->isValid(), |
|
340
|
|
|
'content' => $content, |
|
341
|
|
|
'isApplicationValid' => $this->checkApplication($application) |
|
342
|
|
|
) |
|
343
|
|
|
); |
|
344
|
|
|
} |
|
345
|
|
|
|
|
346
|
|
|
public function doAction() |
|
347
|
|
|
{ |
|
348
|
|
|
$services = $this->getServiceLocator(); |
|
349
|
|
|
$config = $services->get('Config'); |
|
350
|
|
|
$repositories = $services->get('repositories'); |
|
351
|
|
|
$repository = $repositories->get('Applications/Application'); |
|
352
|
|
|
/* @var Application $application*/ |
|
353
|
|
|
$application = $repository->findDraft( |
|
354
|
|
|
$this->auth()->getUser(), |
|
355
|
|
|
$this->params('applyId') |
|
356
|
|
|
); |
|
357
|
|
|
|
|
358
|
|
|
if (!$application) { |
|
359
|
|
|
throw new \Exception('No application draft found.'); |
|
360
|
|
|
} |
|
361
|
|
|
|
|
362
|
|
|
if ('abort' == $this->params()->fromQuery('do')) { |
|
363
|
|
|
$repositories->remove($application); |
|
364
|
|
|
return $this->redirect()->toRoute('lang/apply', array('applyId' => $this->params('applyId'))); |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
if (!$this->checkApplication($application)) { |
|
368
|
|
|
$this->notification()->error(/*@translate*/ 'There are missing required informations. Your application cannot be send.'); |
|
369
|
|
|
return $this->redirect()->toRoute('lang/apply', array('applyId' => $this->params('applyId'))); |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
if ('sendmail' == $this->params()->fromQuery('do')) { |
|
373
|
|
|
$jobEntity = $application->getJob(); |
|
374
|
|
|
|
|
375
|
|
|
$mailData = array( |
|
376
|
|
|
'application' => $application, |
|
377
|
|
|
'to' => $jobEntity->getContactEmail() |
|
378
|
|
|
); |
|
379
|
|
|
if (array_key_exists('mails', $config) && array_key_exists('from', $config['mails']) && array_key_exists('email', $config['mails']['from'])) { |
|
380
|
|
|
$mailData['from'] = $config['mails']['from']['email']; |
|
381
|
|
|
} |
|
382
|
|
|
$this->mailer('Applications/CarbonCopy', $mailData, true); |
|
|
|
|
|
|
383
|
|
|
$repositories->remove($application); |
|
384
|
|
|
//$this->notification()->success(/*@translate*/ 'Application has been send.'); |
|
|
|
|
|
|
385
|
|
|
$model = new ViewModel( |
|
386
|
|
|
array( |
|
387
|
|
|
'success' => true, |
|
388
|
|
|
'job' => $jobEntity, |
|
389
|
|
|
) |
|
390
|
|
|
); |
|
391
|
|
|
$model->setTemplate('applications/apply/success'); |
|
392
|
|
|
return $model; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
$application->setIsDraft(false) |
|
396
|
|
|
->setStatus(new Status()) |
|
397
|
|
|
->getPermissions() |
|
398
|
|
|
->revoke($this->auth()->getUser(), PermissionsInterface::PERMISSION_CHANGE) |
|
399
|
|
|
->inherit($application->getJob()->getPermissions()); |
|
400
|
|
|
|
|
401
|
|
|
$events = $services->get('Applications/Events'); |
|
402
|
|
|
$events->trigger(ApplicationEvent::EVENT_APPLICATION_POST_CREATE, $this, [ 'application' => $application ]); |
|
403
|
|
|
|
|
404
|
|
|
$model = new ViewModel( |
|
405
|
|
|
array( |
|
406
|
|
|
'success' => true, |
|
407
|
|
|
'application' => $application, |
|
408
|
|
|
) |
|
409
|
|
|
); |
|
410
|
|
|
$model->setTemplate('applications/apply/index'); |
|
411
|
|
|
|
|
412
|
|
|
return $model; |
|
413
|
|
|
} |
|
414
|
|
|
|
|
415
|
|
|
protected function checkApplication($application) |
|
416
|
|
|
{ |
|
417
|
|
|
return $this->getServiceLocator()->get('validatormanager')->get('Applications/Application') |
|
418
|
|
|
->isValid($application); |
|
419
|
|
|
} |
|
420
|
|
|
|
|
421
|
|
|
/** |
|
422
|
|
|
* Configures the apply form container. |
|
423
|
|
|
* |
|
424
|
|
|
* Currently only disables elements. |
|
425
|
|
|
* |
|
426
|
|
|
* @param Container $container |
|
427
|
|
|
*/ |
|
428
|
|
|
protected function configureContainer(Container $container) |
|
429
|
|
|
{ |
|
430
|
|
|
/* @var $application Application */ |
|
431
|
|
|
$application = $container->getEntity(); |
|
432
|
|
|
$job = $application->getJob(); |
|
433
|
|
|
|
|
434
|
|
|
/** @var $settings \Applications\Entity\Settings */ |
|
435
|
|
|
$settings = $job->getUser()->getSettings('Applications'); |
|
436
|
|
|
$formSettings = $settings->getApplyFormSettings(); |
|
437
|
|
|
|
|
438
|
|
|
if ($formSettings && $formSettings->isActive()) { |
|
439
|
|
|
$container->disableElements($formSettings->getDisableElements()); |
|
440
|
|
|
return; |
|
441
|
|
|
} |
|
442
|
|
|
|
|
443
|
|
|
$config = $this->getServiceLocator()->get('Config'); |
|
444
|
|
|
$config = isset($config['form_elements_config']['Applications/Apply']['disable_elements']) |
|
445
|
|
|
? $config['form_elements_config']['Applications/Apply']['disable_elements'] |
|
446
|
|
|
: null; |
|
447
|
|
|
if ($config) { |
|
448
|
|
|
$container->disableElements($config); |
|
449
|
|
|
} |
|
450
|
|
|
} |
|
451
|
|
|
} |
|
452
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.