Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 5085 | Rev 5171 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5085 Rev 5150
Línea 211... Línea 211...
211
                $surveyFormMapper = SurveyFormMapper::getInstance($this->adapter);
211
                $surveyFormMapper = SurveyFormMapper::getInstance($this->adapter);
212
                $surveyForm = $surveyFormMapper->fetchOneByUuid($dataPost['form_id']);
212
                $surveyForm = $surveyFormMapper->fetchOneByUuid($dataPost['form_id']);
213
                $survey->form_id = $surveyForm->id;
213
                $survey->form_id = $surveyForm->id;
Línea 214... Línea 214...
214
 
214
 
215
                $surveyMapper = SurveyMapper::getInstance($this->adapter);
215
                $surveyMapper = SurveyMapper::getInstance($this->adapter);
-
 
216
                //$result = $surveyMapper->insert($survey);
-
 
217
 
-
 
218
                if($surveyMapper->insert($survey)) {
-
 
219
                    $survey = $surveyMapper->fetchOne($survey->id);
-
 
220
 
-
 
221
                    $jobDescription = new SurveyJobDescription();
-
 
222
                    $skill = new SurveySkill();
-
 
223
                    $industry = new SurveyIndustry();
-
 
224
                    $language = new SurveyLanguage();
-
 
225
 
-
 
226
                    if(!empty($dataPost['job_description_id'])){ 
-
 
227
 
-
 
228
                       // print_r($dataPost['job_description_id']);
-
 
229
 
-
 
230
                        $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
-
 
231
                        $surveyJobDescriptionMapper = SurveyJobDescriptionMapper::getInstance($this->adapter);
-
 
232
 
-
 
233
                        $ok = true;
-
 
234
 
-
 
235
                        foreach($dataPost['job_description_id'] as $jobDescriptionUuid) {
-
 
236
                        
-
 
237
                           // echo '$jobDescriptionUuid = ' . $jobDescriptionUuid ; 
-
 
238
 
-
 
239
 
-
 
240
                            $jobDescription = $jobDescriptionMapper->fetchOneByUuid($jobDescriptionUuid);
-
 
241
 
-
 
242
                           // print_r($jobDescription);
-
 
243
                            //print_r($currentCompany);
-
 
244
 
-
 
245
                            if($jobDescription && $jobDescription->company_id == $currentCompany->id) {
-
 
246
                                $record = new SurveyJobDescription();
-
 
247
                                $record->job_description_id = $jobDescription->id;
-
 
248
                                $record->survey_id = $survey->id;
-
 
249
 
-
 
250
                            
-
 
251
 
-
 
252
                                $result = $surveyJobDescriptionMapper->insert($record);
-
 
253
                                $ok = $ok && $result;
-
 
254
                            }
-
 
255
                        }
-
 
256
                    
-
 
257
                        if($ok){
-
 
258
 
-
 
259
                        }
-
 
260
                    }
-
 
261
 
-
 
262
                    $data = [
-
 
263
                        'success' => true,
-
 
264
                        'data' => 'LABEL_RECORD_ADDED'
-
 
265
                    ];
-
 
266
                    //      return new JsonModel($data); 
-
 
267
 
-
 
268
                    if(!empty($dataPost['skill_id'])){ 
-
 
269
 
-
 
270
                        // print_r($dataPost['skill_id']);
-
 
271
 
-
 
272
                         $skillMapper = SkillMapper::getInstance($this->adapter);
-
 
273
                         $surveySkillMapper = SurveySkillMapper::getInstance($this->adapter);
-
 
274
 
-
 
275
                         $ok = true;
-
 
276
 
-
 
277
                         foreach($dataPost['skill_id'] as $skillUuid) {
-
 
278
 
-
 
279
                            // echo '$jobCategoryUuid = ' . $jobCategoryUuid ; 
-
 
280
 
-
 
281
 
-
 
282
                             $skill = $skillMapper->fetchOneByUuid($skillUuid);
-
 
283
 
-
 
284
                            // print_r($skill);
-
 
285
                            //print_r($currentCompany);
-
 
286
 
-
 
287
                            //if($skill && $skill->company_id == $currentCompany->id) {
-
 
288
                                $record = new SurveySkill();
-
 
289
                                $record->skill_id = $skill->id;
-
 
290
                                $record->survey_id = $survey->id;
-
 
291
 
-
 
292
 
-
 
293
                                $result = $surveySkillMapper->insert($record);
-
 
294
                                $ok = $ok && $result;
-
 
295
                            // }
-
 
296
                         }
-
 
297
                     
-
 
298
                         if($ok){
-
 
299
 
-
 
300
                         }
-
 
301
                     }
-
 
302
 
-
 
303
                    $data = [
-
 
304
                        'success' => true,
-
 
305
                        'data' => 'test'
-
 
306
                    ];
-
 
307
                    //      return new JsonModel($data); exit;
-
 
308
 
-
 
309
                    if(!empty($dataPost['industry_id'])){ 
-
 
310
 
-
 
311
                        // print_r($dataPost['industry_id']);
-
 
312
 
-
 
313
                         $industryMapper = IndustryMapper::getInstance($this->adapter);
-
 
314
                         $surveyIndustryMapper = SurveyIndustryMapper::getInstance($this->adapter);
-
 
315
 
-
 
316
                         $ok = true;
-
 
317
 
-
 
318
                         foreach($dataPost['industry_id'] as $industryUuid) {
-
 
319
 
-
 
320
                            // echo '$industryUuid = ' . $industryUuid ; 
-
 
321
 
-
 
322
 
-
 
323
                             $industry = $industryMapper->fetchOneByUuid($industryUuid);
-
 
324
 
-
 
325
                            // print_r($industry);
-
 
326
                             //print_r($currentCompany);
-
 
327
 
-
 
328
                             //if($industry && $industry->company_id == $currentCompany->id) {
-
 
329
                                 $record = new SurveyIndustry();
-
 
330
                                 $record->industry_id = $industry->id;
-
 
331
                                 $record->survey_id = $survey->id;
-
 
332
 
-
 
333
                            
-
 
334
 
-
 
335
                                 $result = $surveyIndustryMapper->insert($record);
-
 
336
                                 $ok = $ok && $result;
-
 
337
                             //}
-
 
338
                         }
-
 
339
                     
-
 
340
                         if($ok){
-
 
341
 
-
 
342
                         }
-
 
343
                     }
-
 
344
 
-
 
345
                    $data = [
-
 
346
                        'success' => true,
-
 
347
                        'data' => 'test industry'
-
 
348
                    ];
-
 
349
                    // return new JsonModel($data); exit;
-
 
350
                
-
 
351
                    if(!empty($dataPost['language_id'])){ 
-
 
352
 
-
 
353
                        $surveyLanguageMapper = SurveyLanguageMapper::getInstance($this->adapter);
-
 
354
 
-
 
355
                        $ok = true;
-
 
356
 
216
                $result = $surveyMapper->insert($survey);
357
                        foreach($dataPost['language_id'] as $language_id) {
-
 
358
 
-
 
359
                                $record = new SurveyLanguage();
-
 
360
                                $record->language_id = $language_id;
-
 
361
                                $record->survey_id = $survey->id;
-
 
362
 
-
 
363
 
-
 
364
                                $result = $surveyLanguageMapper->insert($record);
-
 
365
                                $ok = $ok && $result;
-
 
366
                           //}
-
 
367
                        }
-
 
368
                          if($ok){
-
 
369
 
-
 
370
                        }
-
 
371
                     }
-
 
372
 
-
 
373
                    $data = [
-
 
374
                        'success' => true,
-
 
375
                        'data' => 'LABEL_RECORD_ADDED'
-
 
376
                    ];
-
 
377
 
-
 
378
                } else {
-
 
379
                    $data = [
-
 
380
                        'success'   => false,
-
 
381
                        'data'      => $surveyMapper->getError()
-
 
382
                    ];
-
 
383
                }
217
               
384
                
Línea 218... Línea 385...
218
                if ($result) {
385
                if ($result) {
Línea 219... Línea 386...
219
                  
386