Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 231 Rev 258
Línea 69... Línea 69...
69
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserPartnerMapper;
69
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserPartnerMapper;
70
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserProgramMapper;
70
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserProgramMapper;
71
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserStudentTypeMapper;
71
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserStudentTypeMapper;
72
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserSectorMapper;
72
use LeadersLinked\Mapper\CompanyMicrolearningExtendUserSectorMapper;
73
use Nullix\CryptoJsAes\CryptoJsAes;
73
use Nullix\CryptoJsAes\CryptoJsAes;
-
 
74
use LeadersLinked\Model\CompanyMicrolearningTopic;
-
 
75
use LeadersLinked\Model\CompanyMicrolearningCapsule;
Línea 74... Línea 76...
74
 
76
 
75
 
77
 
Línea 580... Línea 582...
580
 
582
 
581
            //Si la que tiene el dispositivo es diferente a la fecha máxima almacenada
583
            //Si la que tiene el dispositivo es diferente a la fecha máxima almacenada
582
            $newCapsules = 0;
584
            $newCapsules = 0;
583
            if($max_date_changes != $max_date_changes_db) {
585
            if($max_date_changes != $max_date_changes_db) {
-
 
586
                if(is_array($ids)) {
584
                if(is_array($ids)) {
587
                    /*
585
                    $companyMicrolearningTopicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
588
                    $companyMicrolearningTopicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
Línea 586... Línea 589...
586
                    $companyMicrolearningTopics = $companyMicrolearningTopicMapper->fetchAllActive();
589
                    $companyMicrolearningTopics = $companyMicrolearningTopicMapper->fetchAllActive();
587
                        
590
                        
Línea 597... Línea 600...
597
                    $capsules = [];
600
                    $capsules = [];
598
                    foreach($companyMicrolearningCapsules as $capsule)
601
                    foreach($companyMicrolearningCapsules as $capsule)
599
                    {                            
602
                    {                            
600
                        $capsules[$capsule->id] = $capsule->uuid;
603
                        $capsules[$capsule->id] = $capsule->uuid;
601
                    }
604
                    }
-
 
605
                    */
-
 
606
                    
-
 
607
                    $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
-
 
608
                    $capsuleMapper = CompanyMicrolearningCapsuleMapper::getInstance($this->adapter);
-
 
609
                    
Línea 602... Línea 610...
602
                        
610
                        
603
                    $companyMicrolearningCapsuleUserMapper = CompanyMicrolearningCapsuleUserMapper::getInstance($this->adapter);
611
                    $companyMicrolearningCapsuleUserMapper = CompanyMicrolearningCapsuleUserMapper::getInstance($this->adapter);
Línea 604... Línea 612...
604
                    $user_capsules = $companyMicrolearningCapsuleUserMapper->fetchAllActiveByUserId($user->id);
612
                    $userCapsules = $companyMicrolearningCapsuleUserMapper->fetchAllActiveByUserId($user->id);
Línea 605... Línea 613...
605
                        
613
                        
606
                    
614
                    
607
                    //print_r($user_capsules); 
-
 
608
                    
-
 
609
                    foreach($user_capsules as $user_capsule) 
-
 
610
                    {
-
 
611
                        $topic_uuid     = isset($topics[$user_capsule->topic_id]) ? $topics[$user_capsule->topic_id] : '';
-
 
612
                        $capsule_uuid   = isset($capsules[$user_capsule->capsule_id]) ?  $capsules[$user_capsule->capsule_id] : '';
-
 
613
                            
-
 
614
                        if(!$topic_uuid || !$capsule_uuid) {
-
 
615
                            continue;
-
 
Línea -... Línea 615...
-
 
615
                    //print_r($user_capsules); 
-
 
616
                    
Línea -... Línea 617...
-
 
617
                    foreach($userCapsules as $userCapsule) 
-
 
618
                    {
-
 
619
                        
616
                        }
620
                        $topic  = $topicMapper->fetchOne($userCapsule->topic_id);
617
                            
621
                        $capsule = $capsuleMapper->fetchOne($userCapsule->capsule_id);
-
 
622
                        
-
 
623
                        if($topic && $capsule) {
618
                        $key = $topic_uuid . '|' . $capsule_uuid;
624
                            if($topic->status == CompanyMicrolearningTopic::STATUS_ACTIVE && $capsule->status == CompanyMicrolearningCapsule::STATUS_ACTIVE) {
619
                        //echo 'key =  ' . $key . PHP_EOL;
625
                                $key = $topic->uuid . '|' . $capsule->uuid;
620
                        
626
                                if(!in_array($key, $ids)) {
621
                        
627
                                    $newCapsules++;
Línea 678... Línea 684...
678
                        
684
                        
679
                        $pushMapper->insert($push);
685
                        $pushMapper->insert($push);
680
                    }
686
                    }
Línea -... Línea 687...
-
 
687
                }
681
                }
688
                
682
                
689
                /*
683
                if(!$is_foreground) {
690
                if(!$is_foreground) {
-
 
691
                    $dataSync = $this->getSyncData($user,false, false);
684
                    $dataSync = $this->getSyncData($user,false, false);
692
                }
Línea 685... Línea 693...
685
                }
693
                */
Línea 697... Línea 705...
697
            
705
            
698
            $data = [
706
            $data = [
699
                'success'   => true,
707
                'success'   => true,
700
                'data'      =>[
708
                'data'      =>[
-
 
709
                    'user' => [
-
 
710
                        'uuid'          => $user->uuid,
-
 
711
                        'first_name'    => $user->first_name,
-
 
712
                        'last_name'     => $user->last_name,
-
 
713
                        'email'         => $user->email,
-
 
714
                        'image'         => $this->url()->fromRoute('services/storage',['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image], ['force_canonical' => true]),
-
 
715
                    ],
-
 
716
                    'new_capsules'      => $newCapsules,
-
 
717
                    'max_date_changes'  => $max_date_changes_db,
-
 
718
                    'topics'            => [],
-
 
719
                    'quizzes'           => [],
-
 
720
                    'extended'          => [],
-
 
721
                ]
-
 
722
            ];
-
 
723
            
-
 
724
            /*
-
 
725
            
-
 
726
            
-
 
727
            $data = [
-
 
728
                'success'   => true,
-
 
729
                'data'      =>[
701
                    'user' => [
730
                    'user' => [
702
                        'uuid' => $user->uuid,
731
                        'uuid' => $user->uuid,
703
                        'first_name' => $user->first_name,
732
                        'first_name' => $user->first_name,
704
                        'last_name' => $user->last_name,
733
                        'last_name' => $user->last_name,
705
                        'email' => $user->email,
734
                        'email' => $user->email,
Línea 710... Línea 739...
710
                    'topics'    => isset( $dataSync['topics'] ) ? $dataSync['topics'] : [],
739
                    'topics'    => isset( $dataSync['topics'] ) ? $dataSync['topics'] : [],
711
                    'quizzes'   => isset( $dataSync['quizzes'] ) ? $dataSync['quizzes'] : [],
740
                    'quizzes'   => isset( $dataSync['quizzes'] ) ? $dataSync['quizzes'] : [],
712
                    'extended'=> isset( $dataSync['extended'] ) ? $dataSync['extended'] : [],
741
                    'extended'=> isset( $dataSync['extended'] ) ? $dataSync['extended'] : [],
713
                ]
742
                ]
714
            ];
743
            ];
715
            
-
 
716
            //error_log(print_r($data, true));
744
            */
717
            
-
 
718
            return new JsonModel($data);
745
            return new JsonModel($data);
719
        }
746
        }
Línea 720... Línea 747...
720
        
747
        
721
        return new JsonModel([
748
        return new JsonModel([