Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6074 Rev 6084
Línea 283... Línea 283...
283
                                function ($test) use($option, $question) {
283
                                function ($test) use($option, $question) {
284
                                    return in_array($option['slug_option'], $test[$question['slug_question']]);
284
                                    return in_array($option['slug_option'], $test[$question['slug_question']]);
285
                                }
285
                                }
286
                            ));
286
                            ));
287
                        }
287
                        }
-
 
288
 
288
                        $averages[$question['slug_question']] = $totals;
289
                        $averages[$question['slug_question']] = $totals;
Línea 289... Línea 290...
289
 
290
 
290
                        break;
291
                        break;
291
                    case 'simple':
292
                    case 'simple':
Línea 301... Línea 302...
301
 
302
 
302
                        foreach($totals as $slug => $amount) {
303
                        foreach($totals as $slug => $amount) {
303
                            $totals[$slug] = ($amount / count($allTests)) * 100;
304
                            $totals[$slug] = ($amount / count($allTests)) * 100;
Línea 304... Línea 305...
304
                        }
305
                        }
305
 
306
 
Línea -... Línea 307...
-
 
307
                        $averages[$question['slug_question']] = $totals;
306
                        $valueSimple[$question['slug_question']] = $totals;
308
                    break;
307
                    break;
309
 
308
 
-
 
309
                    case 'rate-open':
-
 
310
                        $totals = [];
-
 
311
                        
-
 
Línea 312... Línea 310...
312
                        foreach($question['options'] as $option) {
310
                    case 'rate-range':
313
                            $totals[$option['slug_option']] = 0;
311
                    case 'rate-open':
314
                        }
312
                        $total = 0;
Línea 315... Línea -...
315
 
-
 
316
                        foreach ($allTests as $test) {
313
 
317
                            $totals[$test[$question['slug_question']]]++;
-
 
318
                        }
314
                        foreach ($allTests as $test) {
319
 
315
                            $totals[$question['slug_question']] += $test[$question['slug_question']];
320
                        foreach($totals as $slug => $amount){
316
                        }
321
                            $totals[$slugs] = ($amount + $allTest) / $amount;
317
 
Línea 322... Línea -...
322
                        }
-
 
323
                    break;
-
 
324
                }
-
 
325
            }
-
 
326
        }
-
 
327
 
-
 
328
        // return new JsonModel([
-
 
329
        //     'success' => false,
-
 
330
        //     'data' => $averages,
318
                        $averages[$question['slug_question']] = $total / count($allTests);
331
        // ]);
319
                    break;
Línea 332... Línea 320...
332
        
320
                }
333
        $labels = ['Total', 'Logrado'];
321
            }
Línea 334... Línea 322...
334
 
322
        }
335
 
323
 
Línea 336... Línea -...
336
        //Generate New PDF
-
 
337
        $pdf = new SurveyReport();
-
 
338
 
324
        //Generate New PDF
339
        $pdf->AliasNbPages();
325
        $pdf = new SurveyReport();
340
        $pdf->AddPage();
-
 
341
 
326
 
342
        // Set header secundary
327
        $pdf->AliasNbPages();
343
        $pdf->customHeader($headerFormName, $headerSurveyName);
328
        $pdf->AddPage();
Línea 344... Línea 329...
344
 
329
 
-
 
330
        // Set header secundary
-
 
331
        $pdf->customHeader($headerFormName, $headerSurveyName);
-
 
332
 
-
 
333
        for ($i = 0; $i < count($sections); $i++) {
-
 
334
            if ($i != 0 && $i % 2 == 0) {
345
        $countQuestions = 0;
335
                $pdf->AddPage();
346
 
336
                $pdf->customHeader($headerFormName, $headerUserName);
-
 
337
            }
347
        for ($i = 0; $i < count($sections); $i++) {
338
 
348
            if ($countQuestions > 1) {
339
            $section = $sections[$i];
-
 
340
        
-
 
341
            foreach ($section['questions'] as $question) {
349
                $countQuestions = 0;
342
                switch ($question['type']) {
350
                $pdf->AddPage();
343
                    case 'simple':
351
                $pdf->customHeader($headerFormName, $headerSurveyName);
344
                        $labels = [];
352
            }
-
 
353
 
-
 
354
            $pdf->SetY(70 + (92 * $countQuestions));
-
 
355
            $totalQuestion = 0;
-
 
356
 
-
 
357
            $values = [$valueSimple, $totalQuestion];
-
 
Línea 358... Línea 345...
358
            
345
                        $values = [];
-
 
346
                        
-
 
347
                        foreach($question['options'] as $option) {
359
            
348
                            $labels []= $option['text'];
Línea 360... Línea -...
360
            $filename = $target_path . DIRECTORY_SEPARATOR .  $sections[$i]['slug_section'] . '.png';
-
 
361
            $pdf->pieChart($labels, $values, '', $filename);
-
 
362
            $pdf->SetFont('Arial', '', 8);
-
 
363
            $pdf->Cell(190, 10, utf8_decode($sections[$i]['name']), 0, 0, 'C');
-
 
364
            $pdf->setY($pdf->getY() + 10);
-
 
365
            // Salto de línea
-
 
366
            $pdf->Image($filename, 60, $pdf->getY(), 90);
-
 
367
            $pdf->setY($pdf->getY() + 60);
-
 
368
 
-
 
369
            $countSection++;
-
 
370
        }
-
 
371
 
-
 
372
        $pdf->AddPage();
-
 
373
        $pdf->customHeader($headerFormName, $headerUserName);
349
                            
374
 
350
                            $values []= $averages[$question['slug_question']][$option['slug_option']];
Línea 375... Línea 351...
375
        $pdf->SetFont('Arial', 'B', 10);
351
                        }
376
        $pdf->Cell(190, 10, utf8_decode('General'), 0, 0, 'C');
352