Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1098 Rev 1336
Línea 18... Línea 18...
18
use LeadersLinked\Form\CompanySelfEvaluationTestForm;
18
use LeadersLinked\Form\CompanySelfEvaluationTestForm;
19
use LeadersLinked\Model\CompanySelfEvaluationForm;
19
use LeadersLinked\Model\CompanySelfEvaluationForm;
20
use LeadersLinked\Model\CompanySelfEvaluationTest;
20
use LeadersLinked\Model\CompanySelfEvaluationTest;
21
use LeadersLinked\Mapper\UserMapper;
21
use LeadersLinked\Mapper\UserMapper;
22
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
22
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
23
use LeadersLinked\Library\SelfEvaluationPDF;
23
use LeadersLinked\Library\SelfEvaluationPdf;
24
use LeadersLinked\Mapper\CompanySelfEvaluationFormUserMapper;
24
use LeadersLinked\Mapper\CompanySelfEvaluationFormUserMapper;
Línea 25... Línea 25...
25
 
25
 
Línea 26... Línea 26...
26
class SelfEvaluationReviewController extends AbstractActionController {
26
class SelfEvaluationReviewController extends AbstractActionController {
Línea 378... Línea 378...
378
        return new JsonModel($data);
378
        return new JsonModel($data);
379
    }
379
    }
Línea 380... Línea 380...
380
 
380
 
381
    /**
381
    /**
382
     * Render Pdf document
382
     * Render Pdf document
383
     * @param type $companySelfEvaluationForm
383
     * @param CompanySelfEvaluationForm $companySelfEvaluationForm
384
     * @param type $companySelfEvaluationTest
384
     * @param CompanySelfEvaluationTest $companySelfEvaluationTest
385
     * @param type $userMapper
385
     * @param UserMapper $userMapper
386
     * @return type
386
     * @return mixed
387
     */
387
     */
Línea -... Línea 388...
-
 
388
    public function renderPDF($companySelfEvaluationForm, $companySelfEvaluationTest, $userMapper) {
-
 
389
 
-
 
390
        $target_path = $this->config['leaderslinked.fullpath.self_evaluation'] . DIRECTORY_SEPARATOR . $companySelfEvaluationTest->uuid;
-
 
391
        
-
 
392
        
-
 
393
        if(file_exists($target_path)) {
-
 
394
            Functions::deleteFiles($target_path);
-
 
395
        } else {
-
 
396
            @mkdir($target_path, 0755, true);
-
 
397
        }
-
 
398
        
-
 
399
        
-
 
400
        
-
 
401
        
-
 
402
        
388
    public function renderPDF($companySelfEvaluationForm, $companySelfEvaluationTest, $userMapper) {
403
        
389
 
404
        
390
        // Set Data
405
        // Set Data
391
        $headerFormName = utf8_decode($companySelfEvaluationForm->name);
406
        $headerFormName = utf8_decode($companySelfEvaluationForm->name);
392
        $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)));
407
        $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)));
Línea 393... Línea 408...
393
        $sections = json_decode($companySelfEvaluationTest->content, true);
408
        $sections = json_decode($companySelfEvaluationTest->content, true);
394
        $labels = ['Total', 'Logrado'];
409
        $labels = ['Total', 'Logrado'];
Línea 395... Línea 410...
395
 
410
 
396
 
411
 
Línea 397... Línea 412...
397
        //Generate New PDF
412
        //Generate New PDF
Línea 426... Línea 441...
426
            }
441
            }
Línea 427... Línea 442...
427
 
442
 
428
            $values = [$valueSection, $totalQuestion];
443
            $values = [$valueSection, $totalQuestion];
Línea -... Línea 444...
-
 
444
            $valueFormQuestions = $valueFormQuestions + $totalQuestion;
Línea 429... Línea 445...
429
            $valueFormQuestions = $valueFormQuestions + $totalQuestion;
445
 
430
 
446
            
431
 
447
 
432
            $filename = 'data' . DIRECTORY_SEPARATOR . 'self-evaluation' . $sections[$i]['slug_section'] . '.png';
448
            $filename = $target_path . DIRECTORY_SEPARATOR .  $sections[$i]['slug_section'] . '.png';
433
            $pdf->pieChart($labels, $values, '', $filename);
449
            $pdf->pieChart($labels, $values, '', $filename);
434
            $pdf->SetFont('Arial', '', 8);
450
            $pdf->SetFont('Arial', '', 8);
Línea 448... Línea 464...
448
        $pdf->Cell(190, 10, utf8_decode('Desempeño General'), 0, 0, 'C');
464
        $pdf->Cell(190, 10, utf8_decode('Desempeño General'), 0, 0, 'C');
449
        $pdf->setY($pdf->getY() + 10);
465
        $pdf->setY($pdf->getY() + 10);
Línea 450... Línea 466...
450
 
466
 
Línea 451... Línea 467...
451
        $values = [$valueFormSections, $valueFormQuestions];
467
        $values = [$valueFormSections, $valueFormQuestions];
452
 
468
 
453
        $filenameGeneral = 'data' . DIRECTORY_SEPARATOR . 'self-evaluation' . uniqid() . '.png';
469
        $filenameGeneral = $target_path . DIRECTORY_SEPARATOR . 'general.png';
454
        $pdf->pieChart($labels, $values, '', $filenameGeneral);
470
        $pdf->pieChart($labels, $values, '', $filenameGeneral);
Línea 455... Línea 471...
455
        $pdf->Image($filenameGeneral, 60, $pdf->getY(), 90);
471
        $pdf->Image($filenameGeneral, 60, $pdf->getY(), 90);
Línea 469... Línea 485...
469
        return $pdf->Output();
485
        return $pdf->Output();
470
    }
486
    }
Línea 471... Línea 487...
471
 
487
 
472
    /**
488
    /**
473
     * get total ptos Answer
489
     * get total ptos Answer
474
     * @param type $question
490
     * @param array $question
475
     * @return type
491
     * @return int
476
     */
492
     */
Línea 477... Línea 493...
477
    public function getPtosAnswer($question) {
493
    public function getPtosAnswer($question) {