Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 510 Rev 513
Línea 354... Línea 354...
354
            $CompanyUserMapper = UserMapper::getInstance($this->adapter);
354
            $CompanyUserMapper = UserMapper::getInstance($this->adapter);
355
            $userMapper = $CompanyUserMapper->fetchOne($companySelfEvaluationTest->user_id);
355
            $userMapper = $CompanyUserMapper->fetchOne($companySelfEvaluationTest->user_id);
Línea 356... Línea 356...
356
 
356
 
Línea 357... Línea -...
357
            if ($companySelfEvaluationForm && $userMapper) {
-
 
358
 
357
            if ($companySelfEvaluationForm && $userMapper) {
359
               
-
 
360
                $pdf = new Pdf();
-
 
361
              
-
 
362
 
-
 
363
                $headerFormName = utf8_decode($companySelfEvaluationForm->name);
-
 
364
                $headerUserName = utf8_decode('Informe de Auto-evaluación: ' .trim($userMapper->first_name . ' ' . $userMapper->last_name) . ' al ' . date("m-d-Y H:i:s", strtotime($companySelfEvaluationTest->added_on)) );
358
 
365
 
359
                return new JsonModel([
366
                $pdf->AliasNbPages();
-
 
367
                $pdf->AddPage();
-
 
368
                $pdf->pageHeader($headerFormName, $headerUserName);
-
 
369
                
-
 
Línea 370... Línea -...
370
                
-
 
371
                $sections = json_decode($companySelfEvaluationTest->content, true);
-
 
372
            
-
 
373
                $valueFormSections = 0;
-
 
374
                $valueFormQuestions = 0;
-
 
375
                
-
 
376
                $countSection = 0;
-
 
377
                for($i = 0, $maxSection = count($sections); $i < $maxSection; $i++)
-
 
378
                {
-
 
379
                    if( $countSection > 1)
-
 
380
                    {
-
 
381
                        $countSection = 0;
-
 
382
                        $pdf->AddPage();
-
 
383
                        $pdf->pageHeader($headerFormName, $headerUserName);
-
 
384
                    }
-
 
385
                    
-
 
386
                    $pdf->SetY(70 + (92 * $countSection));
-
 
387
                    $totalQuestion = 0;
-
 
388
                    
-
 
389
                    $valueSection       =  floatval($sections[$i]['value']);
-
 
390
                    $valueFormSections  = $valueFormSections  + $valueSection;
-
 
391
                    
-
 
392
                    
-
 
393
                    for($j = 0, $maxQuestion = count($sections[$i]['questions']); $j < $maxQuestion; $j++)
-
 
394
                    {
-
 
395
                        //$valueQuestion = floatval($sections[$i]['questions'][$j]['user_evaluation']);
-
 
396
                        $totalQuestion = $totalQuestion + 1;
-
 
397
                    }
-
 
398
                    
-
 
399
                    $labels = [
-
 
400
                        'Total',
-
 
401
                        'Logrado'
-
 
402
                    ];
-
 
403
                    
-
 
404
                    $values = [
-
 
405
                        $valueSection,
-
 
406
                        $totalQuestion
-
 
407
                    ];
-
 
408
                    
-
 
409
                    $valueFormQuestions = $valueFormQuestions + $totalQuestion;
-
 
410
                    
-
 
411
                    
-
 
412
                    $title = '';
-
 
413
                    $filename = $_SERVER['DOCUMENT_ROOT']. '/../public/pdf/tmp/' . $sections[$i]['slug_section'] . '.png';
-
 
414
                    $pdf->barChart($labels, $values, $title, $filename);
-
 
415
                    $pdf->SetFont('Arial','',8);
-
 
416
                    $pdf->Cell(190,10, utf8_decode($sections[$i]['name']),0,0,'C');
-
 
417
                    $pdf->setY($pdf->getY() + 10);
-
 
418
                    // Salto de línea
-
 
419
                    
-
 
420
                    $pdf->Image($filename,60,$pdf->getY(),90);
-
 
421
                    $pdf->setY($pdf->getY() + 60);
-
 
422
                
-
 
423
                    $countSection++;
-
 
424
        
-
 
425
                }
-
 
426
                
-
 
427
                $pdf->AddPage();
-
 
428
                $pdf->pageHeader($headerFormName, $headerUserName);
-
 
429
                
-
 
430
                $pdf->SetFont('Arial','B', 10);
-
 
431
                $pdf->Cell(190,10, utf8_decode('Desempeño General'),0,0,'C');
-
 
432
                $pdf->setY($pdf->getY() + 10);
-
 
433
                
-
 
434
                
-
 
435
                $labels = [
-
 
436
                    'Total',
-
 
437
                    'Logrado'
-
 
438
                ];
-
 
439
                
-
 
440
                $values = [
-
 
441
                    $valueFormSections,
-
 
442
                    $valueFormQuestions
-
 
443
                ];
-
 
444
                
-
 
445
                $filenameGeneral = $_SERVER['DOCUMENT_ROOT']. '/../public/pdf/tmp/'  . uniqid() . '.png';
-
 
446
                $pdf->barChart($labels, $values, $title, $filenameGeneral);
-
 
447
                $pdf->Image($filenameGeneral,60,$pdf->getY(),90);
-
 
448
                $pdf->setY($pdf->getY() + 60);
-
 
449
                
-
 
450
                
-
 
451
                $pdf->SetFont('Arial','B', 10);
-
 
452
                $pdf->Cell(190,10, utf8_decode('Comentarios finales'),0,0,'C');
-
 
453
                $pdf->setY($pdf->getY() + 10);
-
 
454
                
-
 
455
                $pdf->SetFont('Arial','', 8);
-
 
456
                $pdf->setY(60);
-
 
Línea 457... Línea 360...
457
 
360
                    'data'=>$this->gerValueAnswer()
Línea 458... Línea 361...
458
                return $pdf->Output();
361
                ]);
459
 
362
            
Línea 477... Línea 380...
477
        }
380
        }
Línea 478... Línea 381...
478
 
381
 
479
        return new JsonModel($data);
382
        return new JsonModel($data);
Línea -... Línea 383...
-
 
383
    }
-
 
384
 
-
 
385
 
-
 
386
    public function getValueAnswer(){
-
 
387
        return 0;
480
    }
388
    }