|
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
|
|
|
/** ActionController of Jobs */ |
|
11
|
|
|
namespace Jobs\Controller; |
|
12
|
|
|
|
|
13
|
|
|
use Core\Form\SearchForm; |
|
14
|
|
|
use Jobs\Form\ListFilter; |
|
15
|
|
|
use Zend\Mvc\Controller\AbstractActionController; |
|
16
|
|
|
use Zend\Session\Container as Session; |
|
17
|
|
|
use Jobs\Repository; |
|
18
|
|
|
use Zend\View\Model\ViewModel; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @method \Auth\Controller\Plugin\Auth auth() |
|
22
|
|
|
* @method \Core\Controller\Plugin\CreatePaginatorService paginatorService() |
|
23
|
|
|
* |
|
24
|
|
|
* Controller for jobboard actions |
|
25
|
|
|
*/ |
|
26
|
|
|
class JobboardController extends AbstractActionController |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* @var Repository\Job $jobRepository |
|
30
|
|
|
*/ |
|
31
|
|
|
private $jobRepository; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Formular for searching job postings |
|
35
|
|
|
* |
|
36
|
|
|
* @var ListFilter $searchForm |
|
37
|
|
|
*/ |
|
38
|
|
|
private $searchForm; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Construct the jobboard controller |
|
42
|
|
|
* |
|
43
|
|
|
* @param Repository\Job $jobRepository |
|
44
|
|
|
* @param ListFilter $searchForm |
|
|
|
|
|
|
45
|
|
|
*/ |
|
46
|
|
|
public function __construct(Repository\Job $jobRepository) |
|
47
|
|
|
{ |
|
48
|
|
|
$this->jobRepository = $jobRepository; |
|
49
|
|
|
} |
|
50
|
|
|
/** |
|
51
|
|
|
* attaches further Listeners for generating / processing the output |
|
52
|
|
|
* @return $this |
|
53
|
|
|
*/ |
|
54
|
|
View Code Duplication |
public function attachDefaultListeners() |
|
|
|
|
|
|
55
|
|
|
{ |
|
56
|
|
|
parent::attachDefaultListeners(); |
|
57
|
|
|
$serviceLocator = $this->serviceLocator; |
|
58
|
|
|
$defaultServices = $serviceLocator->get('DefaultListeners'); |
|
59
|
|
|
$events = $this->getEventManager(); |
|
60
|
|
|
$events->attach($defaultServices); |
|
|
|
|
|
|
61
|
|
|
return $this; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* List jobs |
|
66
|
|
|
* |
|
67
|
|
|
* @return ViewModel |
|
68
|
|
|
*/ |
|
69
|
|
|
public function indexAction() |
|
70
|
|
|
{ |
|
71
|
|
|
|
|
72
|
|
|
$result = $this->pagination([ |
|
|
|
|
|
|
73
|
|
|
'params' => ['Jobs_Board', ['q', 'page' => 1, 'l', 'd']], |
|
74
|
|
|
'form' => ['as' => 'filterForm', 'Jobs/JobboardSearch'], |
|
75
|
|
|
'paginator' => ['as' => 'jobs', 'Jobs/Board'] |
|
76
|
|
|
]); |
|
77
|
|
|
// /* @var \Zend\Http\Request $request */ |
|
|
|
|
|
|
78
|
|
|
// $request = $this->getRequest(); |
|
79
|
|
|
// $params = $request->getQuery(); |
|
80
|
|
|
// $jsonFormat = 'json' == $request->getQuery()->get('format'); |
|
81
|
|
|
// $event = $this->getEvent(); |
|
82
|
|
|
// $routeMatch = $event->getRouteMatch(); |
|
83
|
|
|
// $matchedRouteName = $routeMatch->getMatchedRouteName(); |
|
84
|
|
|
// $url = $this->url()->fromRoute($matchedRouteName, array(), array('force_canonical' => true)); |
|
85
|
|
|
// |
|
86
|
|
|
// if (!$jsonFormat && !$request->isXmlHttpRequest()) { |
|
87
|
|
|
// $session = new Session('Jobs\Index'); |
|
88
|
|
|
// $sessionKey = $this->auth()->isLoggedIn() ? 'userParams' : 'guestParams'; |
|
89
|
|
|
// $sessionParams = $session[$sessionKey]; |
|
90
|
|
|
// if ($sessionParams) { |
|
91
|
|
|
// foreach ($sessionParams as $key => $value) { |
|
92
|
|
|
// $params->set($key, $params->get($key, $value)); |
|
93
|
|
|
// } |
|
94
|
|
|
// } |
|
95
|
|
|
// $session[$sessionKey] = $params->toArray(); |
|
96
|
|
|
// |
|
97
|
|
|
// $this->searchForm->bind($params); |
|
98
|
|
|
// } |
|
99
|
|
|
// |
|
100
|
|
|
// $params = $params->get('params', []); |
|
101
|
|
|
// |
|
102
|
|
|
// if (isset($params['l']['data']) && |
|
103
|
|
|
// isset($params['l']['name']) && |
|
104
|
|
|
// !empty($params['l']['name'])) { |
|
105
|
|
|
// /* @var \Geo\Form\GeoText $geoText */ |
|
106
|
|
|
// $geoText = $this->searchForm->get('params')->get('l'); |
|
107
|
|
|
// |
|
108
|
|
|
// $geoText->setValue($params['l']); |
|
109
|
|
|
// $params['location'] = $geoText->getValue('entity'); |
|
110
|
|
|
// } |
|
111
|
|
|
// |
|
112
|
|
|
// if (!isset($params['sort'])) { |
|
113
|
|
|
// $params['sort']='-date'; |
|
114
|
|
|
// } |
|
115
|
|
|
// |
|
116
|
|
|
// $this->searchForm->setAttribute('action', $url); |
|
117
|
|
|
|
|
118
|
|
|
$params['by'] = "guest"; |
|
|
|
|
|
|
119
|
|
|
|
|
120
|
|
|
// $paginator = $this->paginator('Jobs/Board', $params); |
|
|
|
|
|
|
121
|
|
|
|
|
122
|
|
|
// $options = $this->searchForm->getOptions(); |
|
|
|
|
|
|
123
|
|
|
// $options['showButtons'] = false; |
|
124
|
|
|
// $this->searchForm->setOptions($options); |
|
125
|
|
|
$organizationImageCache = $this->serviceLocator->get('Organizations\ImageFileCache\Manager'); |
|
126
|
|
|
|
|
127
|
|
|
$result['organizationImageCache'] = $organizationImageCache; |
|
128
|
|
|
|
|
129
|
|
|
return $result; |
|
130
|
|
|
$return = array( |
|
|
|
|
|
|
131
|
|
|
'by' => $params['by'], |
|
132
|
|
|
'jobs' => $paginator, |
|
133
|
|
|
'filterForm' => $this->searchForm, |
|
134
|
|
|
'organizationImageCache' => $organizationImageCache |
|
135
|
|
|
); |
|
136
|
|
|
$model = new ViewModel($return); |
|
137
|
|
|
|
|
138
|
|
|
return $model; |
|
139
|
|
|
} |
|
140
|
|
|
} |
|
141
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.