Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1662 Rev 1683
Línea 451... Línea 451...
451
        
451
        
452
        if($request->isPost()) {
452
        if($request->isPost()) {
453
            $currentUserPlugin = $this->plugin('currentUserPlugin');
453
            $currentUserPlugin = $this->plugin('currentUserPlugin');
Línea 454... Línea 454...
454
            $user = $currentUserPlugin->getUser();
454
            $user = $currentUserPlugin->getUser();
455
            
455
            
456
            /*
456
    
457
            $rawdata = file_get_contents("php://input");
457
            //$rawdata = file_get_contents("php://input");
458
            error_log('url = ' . $_SERVER['REQUEST_URI']);
458
            //error_log('url = ' . $_SERVER['REQUEST_URI']);
459
            error_log('query = ' . $_SERVER['QUERY_STRING']);
459
           // error_log('query = ' . $_SERVER['QUERY_STRING']);
Línea 460... Línea 460...
460
            error_log('$rawdata = ' . $rawdata );
460
           // error_log('$rawdata = ' . $rawdata );
Línea 461... Línea 461...
461
            */
461
        
462
            
462
            
463
            $serviceDatetimeFormat = $this->config['leaderslinked.services.datetime'];
463
            $serviceDatetimeFormat = $this->config['leaderslinked.services.datetime'];
464
            
464
            
Línea -... Línea 465...
-
 
465
            
-
 
466
            $device_uuid        = filter_var($this->params()->fromPost('device_uuid', ''), FILTER_SANITIZE_STRING);
465
            
467
            $max_date_changes   = filter_var($this->params()->fromPost('max_date_changes', ''), FILTER_SANITIZE_STRING);
466
            $device_uuid        = filter_var($this->params()->fromPost('device_uuid', ''), FILTER_SANITIZE_STRING);
468
            $max_ids            = filter_var($this->params()->fromPost('max_ids', 0), FILTER_SANITIZE_NUMBER_INT);
467
            $max_date_changes   = filter_var($this->params()->fromPost('max_date_changes', ''), FILTER_SANITIZE_STRING);
469
            $is_foreground      = filter_var($this->params()->fromPost('is_foreground', 0), FILTER_SANITIZE_NUMBER_INT);
468
            $max_ids            = filter_var($this->params()->fromPost('max_ids', 0), FILTER_SANITIZE_NUMBER_INT);
470
            
-
 
471
      
-
 
472
            
-
 
473
            $ids = [];
469
            $is_foreground      = filter_var($this->params()->fromPost('is_foreground', 0), FILTER_SANITIZE_NUMBER_INT);
474
            for($i = 1; $i <= $max_ids; $i++)
470
            
475
            {
471
            $ids = [];
476
                $id = trim(filter_var($this->params()->fromPost('id_' . $i, ''), FILTER_SANITIZE_STRING));
Línea -... Línea 477...
-
 
477
               
-
 
478
 
-
 
479
                
472
            for($i = 1; $i <= $max_ids; $i++)
480
                if(empty($id)) {
-
 
481
                    continue;
473
            {
482
                }
-
 
483
                
-
 
484
              
-
 
485
                
474
                $id = filter_var($this->params()->fromPost('id_' . $i, ''), FILTER_SANITIZE_STRING);
486
       
475
                if(empty($id)) {
487
                $pattern = '/[A-Za-z0-9\-]+\|[A-Za-z0-9\-]+/';
476
                    continue;
488
                $matches = [];  
477
                }
-
 
478
                
489
                preg_match($pattern, $id, $matches, PREG_OFFSET_CAPTURE);
-
 
490
       
Línea 479... Línea 491...
479
                $pattern = '/[A-Za-z0-9\-]+\|[A-Za-z0-9\-]+/';
491
                
480
                $matches = [];  preg_match($pattern, $id, $matches, PREG_OFFSET_CAPTURE);
492
                
481
                if(count($matches) > 1) {
493
                if($matches) {
Línea 499... Línea 511...
499
                } else {
511
                } else {
500
                    $max_date_changes = '';
512
                    $max_date_changes = '';
501
                } 
513
                } 
502
            }
514
            }
Línea 503... Línea -...
503
            
-
 
504
            
-
 
505
            
-
 
506
            //error_log('device_uuid = ' . $device_uuid . ' max_date_changes = ' . $max_date_changes);
-
 
507
            
515
            
Línea 508... Línea 516...
508
            $ok = $device_uuid && strlen($device_uuid);
516
            $ok = $device_uuid && strlen($device_uuid);
509
            
517
            
510
            if(!$ok) {
518
            if(!$ok) {
Línea 674... Línea 682...
674
                                    
682
                                    
675
                                    
683
                                    
676
                                ],
684
                                ],
677
                                'content_available' => true,
685
                                'content_available' => true,
678
                                'data' => [
686
                                'data' => [
679
                                    'new_capsules' => $newCapsules,
687
                                    'new_capsules' => strval($newCapsules),
680
                                ]
688
                                ]
Línea 742... Línea 750...
742
                        'last_name'         => $user->last_name,
750
                        'last_name'         => $user->last_name,
743
                        'email'             => $user->email,
751
                        'email'             => $user->email,
744
                        'image'             => $this->url()->fromRoute('services/storage',['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image], ['force_canonical' => true]),
752
                        'image'             => $this->url()->fromRoute('services/storage',['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image], ['force_canonical' => true]),
745
                    ],
753
                    ],
746
                    'rating_and_comments'   => $ratingAndComments,
754
                    'rating_and_comments'   => $ratingAndComments,
747
                    'new_capsules'          => $newCapsules,
755
                    'new_capsules'          => strval($newCapsules),
748
                    'max_date_changes'      => $max_date_changes_db,
756
                    'max_date_changes'      => $max_date_changes_db,
Línea 749... Línea 757...
749
                    
757
                    
750
                    'topics'            => [],
758
                    'topics'            => [],
751
                    'quizzes'           => [],
759
                    'quizzes'           => [],
Línea 3404... Línea 3412...
3404
                        'image' => $capsule->image ? $this->url()->fromRoute('services/storage',['type' => 'microlearning-capsule', 'code' => $capsule->uuid, 'filename' => $capsule->image ], ['force_canonical' => true])  : '',
3412
                        'image' => $capsule->image ? $this->url()->fromRoute('services/storage',['type' => 'microlearning-capsule', 'code' => $capsule->uuid, 'filename' => $capsule->image ], ['force_canonical' => true])  : '',
3405
                        'position' => $capsule->order,
3413
                        'position' => $capsule->order,
3406
                        'slides' => $record_slides,
3414
                        'slides' => $record_slides,
3407
                        'link_comments' => $this->url()->fromRoute('services/microlearning/capsules/comments', ['capsule_id' => $capsule->uuid], ['force_canonical' => true]),
3415
                        'link_comments' => $this->url()->fromRoute('services/microlearning/capsules/comments', ['capsule_id' => $capsule->uuid], ['force_canonical' => true]),
3408
                        'link_comment_add' => $this->url()->fromRoute('services/microlearning/capsules/comments/add', ['capsule_id' => $capsule->uuid],['force_canonical' => true]),
3416
                        'link_comment_add' => $this->url()->fromRoute('services/microlearning/capsules/comments/add', ['capsule_id' => $capsule->uuid],['force_canonical' => true]),
3409
                        'total_comments' => $dataCountrAndRatingAverage['total_comments'],
3417
                        'total_comments' => strval($dataCountrAndRatingAverage['total_comments']),
3410
                        'total_rating' => $dataCountrAndRatingAverage['total_rating'],
3418
                        'total_rating' => strval($dataCountrAndRatingAverage['total_rating']),
3411
                        'added_on'  => $dtAddedOn->format($serviceDatetimeFormat),
3419
                        'added_on'  => $dtAddedOn->format($serviceDatetimeFormat),
3412
                        'updated_on'    => $dtUpdatedOn->format($serviceDatetimeFormat),
3420
                        'updated_on'    => $dtUpdatedOn->format($serviceDatetimeFormat),
3413
                    ]);
3421
                    ]);
3414
                }
3422
                }
Línea 3471... Línea 3479...
3471
                    
3479
                    
3472
                    array_push($record_answers, [
3480
                    array_push($record_answers, [
3473
                        'uuid' => $answer->uuid,
3481
                        'uuid' => $answer->uuid,
3474
                        'text' => trim($answer->text),
3482
                        'text' => trim($answer->text),
3475
                        'correct' => $answer->correct ? $answer->correct  : 0 ,
3483
                        'correct' => $answer->correct ? $answer->correct  : 0 ,
3476
                        'points' => intval($answer->points, 10),
3484
                        'points' => strval(intval($answer->points, 10)),
3477
                        'added_on'  => $dtAddedOn->format($serviceDatetimeFormat),
3485
                        'added_on'  => $dtAddedOn->format($serviceDatetimeFormat),
3478
                        'updated_on'    => $dtUpdatedOn->format($serviceDatetimeFormat),
3486
                        'updated_on'    => $dtUpdatedOn->format($serviceDatetimeFormat),
3479
                    ]);
3487
                    ]);
Línea 3484... Línea 3492...
3484
                
3492
                
3485
                array_push($record_questions, [
3493
                array_push($record_questions, [
3486
                    'uuid'          => $question->uuid,
3494
                    'uuid'          => $question->uuid,
3487
                    'text'          => trim($question->text),
3495
                    'text'          => trim($question->text),
3488
                    'type'          => $question->type,
3496
                    'type'          => $question->type,
3489
                    'maxlength'     => $question->maxlength,
3497
                    'maxlength'     => strval($question->maxlength),
3490
                    'points'        => $question->points,
3498
                    'points'        => strval($question->points),
3491
                    'answers'       => $record_answers,
3499
                    'answers'       => $record_answers,
3492
                    'added_on'      => $dtAddedOn->format($serviceDatetimeFormat),
3500
                    'added_on'      => $dtAddedOn->format($serviceDatetimeFormat),
3493
                    'updated_on'    => $dtUpdatedOn->format($serviceDatetimeFormat),
3501
                    'updated_on'    => $dtUpdatedOn->format($serviceDatetimeFormat),
3494
                ]);
3502
                ]);
Línea 3501... Línea 3509...
3501
            array_push($data['quizzes'], [
3509
            array_push($data['quizzes'], [
3502
                'uuid' => $quiz->uuid,
3510
                'uuid' => $quiz->uuid,
3503
                'name' => $quiz->name,
3511
                'name' => $quiz->name,
3504
                'text' => trim($quiz->text ? $quiz->text : ''),
3512
                'text' => trim($quiz->text ? $quiz->text : ''),
3505
                'failed' => trim($quiz->failed ? $quiz->failed : ''),
3513
                'failed' => trim($quiz->failed ? $quiz->failed : ''),
3506
                'points' => $quiz->points,
3514
                'points' => strval($quiz->points),
3507
                'minimum_points_required' => $quiz->minimum_points_required,
3515
                'minimum_points_required' => strval($quiz->minimum_points_required),
3508
                'max_time' => $quiz->max_time ? $quiz->max_time : 5,
3516
                'max_time' => $quiz->max_time ? $quiz->max_time : 5,
3509
                'company_uuid' => $company->uuid,
3517
                'company_uuid' => $company->uuid,
3510
                'company_name' => $company->name,
3518
                'company_name' => $company->name,
3511
                'company_image' => $this->url()->fromRoute('services/storage',['type' => 'company', 'code' => $company->uuid, 'filename' => $company->image], ['force_canonical' => true]),
3519
                'company_image' => $this->url()->fromRoute('services/storage',['type' => 'company', 'code' => $company->uuid, 'filename' => $company->image], ['force_canonical' => true]),
3512
                'questions'     => $record_questions,
3520
                'questions'     => $record_questions,