Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 7300 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 7300 Rev 7340
Línea 26... Línea 26...
26
use LeadersLinked\Mapper\RecruitmentSelectionCandidateMapper;
26
use LeadersLinked\Mapper\RecruitmentSelectionCandidateMapper;
27
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
27
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
28
use LeadersLinked\Model\RecruitmentSelectionInterview;
28
use LeadersLinked\Model\RecruitmentSelectionInterview;
29
use Laminas\Mvc\I18n\Translator;
29
use Laminas\Mvc\I18n\Translator;
30
use LeadersLinked\Cache\CacheInterface;
30
use LeadersLinked\Cache\CacheInterface;
-
 
31
use LeadersLinked\Mapper\SurveyTestMapper;
-
 
32
use LeadersLinked\Mapper\SurveyCampaignMapper;
Línea 31... Línea 33...
31
 
33
 
32
 
34
 
33
class CalendarController extends AbstractActionController
35
class CalendarController extends AbstractActionController
Línea 134... Línea 136...
134
              $last_day = intval(date('t', $t), 10);
136
              $last_day = intval(date('t', $t), 10);
Línea 135... Línea 137...
135
              
137
              
136
              $start = mktime(0, 0, 0, $month, 1, $year);
138
              $start = mktime(0, 0, 0, $month, 1, $year);
Línea 137... Línea 139...
137
              $start = date('Y-m-d H:i:s');
139
              $start = date('Y-m-d H:i:s');
138
              
140
              
Línea 139... Línea 141...
139
              $start = mktime(23, 56, 59, $month, $last_day, $year);
141
              $end = mktime(23, 56, 59, $month, $last_day, $year);
140
              $end = date('Y-m-d H:i:s');
142
              $end = date('Y-m-d H:i:s');
141
                
143
                
Línea 182... Línea 184...
182
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
184
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
183
            $userMapper = UserMapper::getInstance($this->adapter);
185
            $userMapper = UserMapper::getInstance($this->adapter);
Línea 184... Línea 186...
184
            
186
            
185
            $calendarEventMapper = CalendarEventMapper::getInstance($this->adapter);
187
            $calendarEventMapper = CalendarEventMapper::getInstance($this->adapter);
-
 
188
            $records = $calendarEventMapper->fetchAllByUserIdAndStartTimeAndEndTime($currentUser->id, $start, $end);
186
            $records = $calendarEventMapper->fetchAllByUserIdAndStartTimeAndEndTime($currentUser->id, $start, $end);
189
            
187
            foreach($records as $record) 
190
            foreach($records as $record) 
188
            {
191
            {
189
                switch($record->type)
192
                switch($record->type)
-
 
193
                {
-
 
194
                    case CalendarEvent::TYPE_SURVEY_NORMAL:
-
 
195
                        $backgroundColor = $currentNetwork->css_calendar_survey_bg_color;
-
 
196
                        $textColor = $currentNetwork->css_calendar_survey_text_color;
-
 
197
                        
-
 
198
                        $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
-
 
199
                        $surveyTest = $surveyTestMapper->fetchOne($record->relational_id);
-
 
200
                        
-
 
201
                        if($surveyTest && $surveyTest->user_id == $currentUser->id) {
-
 
202
                            
-
 
203
                            $surveyCampaingMapper = SurveyCampaignMapper::getInstance($this->adapter);
-
 
204
                            $surveyCampaing = $surveyCampaingMapper->fetchOne($surveyTest->campaign_id);
-
 
205
                            
-
 
206
                            $url = '';
-
 
207
                            $hasLink = !empty($companyUsers[$surveyTest->company_id]);
-
 
208
                            
-
 
209
                            if ($hasLink) {
-
 
210
                                
-
 
211
                                if (!isset($companies[$surveyTest->company_id])) {
-
 
212
                                    $company  = $companyMapper->fetchOne($surveyTest->company_id);
-
 
213
                                    
-
 
214
                                    $companies[$company->id]  = $company;
-
 
215
                                } else {
-
 
216
                                    $company = $companies[$surveyTest->company_id];
-
 
217
                                }
-
 
218
                                
-
 
219
                                
-
 
220
                                $url = $this->url()->fromRoute('backend/signin-company', [
-
 
221
                                    'id' => $company->uuid,
-
 
222
                                    'relational' => $surveyTest->uuid,
-
 
223
                                    'type' => CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE,
-
 
224
                                ]);
-
 
225
                            }
-
 
226
                            
-
 
227
                            $dtStart = \DateTime::createFromFormat('Y-m-d', $surveyCampaing->end_date);
-
 
228
                            
-
 
229
                            
-
 
230
                            array_push($events, [
-
 
231
                                'id'                => $surveyTest->uuid,
-
 
232
                                'title'             => $surveyCampaing->name,
-
 
233
                                'start'             => $dtStart->format('d/m/Y'),
-
 
234
                                'url'               => $url,
-
 
235
                                'backgroundColor'   => $backgroundColor,
-
 
236
                                'textColor'         => $textColor,
-
 
237
                                'allDay'            => true,
-
 
238
                                'type'              => 'task',
-
 
239
                            ]);
-
 
240
                        }
-
 
241
                        
-
 
242
                        break;
-
 
243
                        
-
 
244
                    case CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE:
-
 
245
                        $backgroundColor = $currentNetwork->css_calendar_organizational_climate_bg_color;
-
 
246
                        $textColor = $currentNetwork->css_calendar_organizational_climate_text_color;
-
 
247
                        
-
 
248
                        $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
-
 
249
                        $surveyTest = $surveyTestMapper->fetchOne($record->relational_id);
-
 
250
                        
-
 
251
                        if($surveyTest && $surveyTest->user_id == $currentUser->id) {
-
 
252
                            
-
 
253
                            $surveyCampaingMapper = SurveyCampaignMapper::getInstance($this->adapter);
-
 
254
                            $surveyCampaing = $surveyCampaingMapper->fetchOne($surveyTest->campaign_id);
-
 
255
                            
-
 
256
                            $url = '';
-
 
257
                            $hasLink = !empty($companyUsers[$surveyTest->company_id]);
-
 
258
                            
-
 
259
                            if ($hasLink) {
-
 
260
                                
-
 
261
                                if (!isset($companies[$surveyTest->company_id])) {
-
 
262
                                    $company  = $companyMapper->fetchOne($surveyTest->company_id);
-
 
263
                                    
-
 
264
                                    $companies[$company->id]  = $company;
-
 
265
                                } else {
-
 
266
                                    $company = $companies[$surveyTest->company_id];
-
 
267
                                }
-
 
268
                                
-
 
269
                                
-
 
270
                                $url = $this->url()->fromRoute('backend/signin-company', [
-
 
271
                                    'id' => $company->uuid,
-
 
272
                                    'relational' => $surveyTest->uuid,
-
 
273
                                    'type' => CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE,
-
 
274
                                ]);
-
 
275
                            }
-
 
276
                            
-
 
277
                            $dtStart = \DateTime::createFromFormat('Y-m-d', $surveyCampaing->end_date);
-
 
278
                            
-
 
279
                            
-
 
280
                            array_push($events, [
-
 
281
                                'id'                => $surveyTest->uuid,
-
 
282
                                'title'             => $surveyCampaing->name,
-
 
283
                                'start'             => $dtStart->format('d/m/Y'),
-
 
284
                                'url'               => $url,
-
 
285
                                'backgroundColor'   => $backgroundColor,
-
 
286
                                'textColor'         => $textColor,
-
 
287
                                'allDay'            => true,
-
 
288
                                'type'              => 'task',
-
 
289
                            ]);
-
 
290
                        }
-
 
291
                        
-
 
292
                        break;
-
 
293
                        
-
 
294
                        
-
 
295
                        
-
 
296
                    
190
                {
297
                    
191
                    case CalendarEvent::TYPE_RECRUITMENT_SELECTION_INTERVIEW  : 
298
                    case CalendarEvent::TYPE_RECRUITMENT_SELECTION_INTERVIEW  : 
192
                        $backgroundColor = $currentNetwork->css_calendar_recruitment_and_selection_bg_color ;
299
                        $backgroundColor = $currentNetwork->css_calendar_recruitment_and_selection_bg_color ;