Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1610 Rev 1651
Línea 703... Línea 703...
703
                $max_date_changes_db = $dt->format($serviceDatetimeFormat);
703
                $max_date_changes_db = $dt->format($serviceDatetimeFormat);
704
            } else {
704
            } else {
705
                $max_date_changes_db = '';
705
                $max_date_changes_db = '';
706
            }
706
            }
Línea -... Línea 707...
-
 
707
            
-
 
708
            $ratingAndComments = [];
-
 
709
            
-
 
710
            $capsuleMapper = CompanyMicrolearningCapsuleMapper::getInstance($this->adapter);
-
 
711
            $capsuleCommentMapper = CompanyMicrolearningCapsuleCommentMapper::getInstance($this->adapter);
-
 
712
            
-
 
713
            $companyMicrolearningCapsuleUserMapper = CompanyMicrolearningCapsuleUserMapper::getInstance($this->adapter);
-
 
714
            $userCapsules = $companyMicrolearningCapsuleUserMapper->fetchAllActiveByUserId($user->id);
-
 
715
            
-
 
716
            foreach($userCapsules as $userCapsule) 
-
 
717
            {
-
 
718
                $capsule = $capsuleMapper->fetchOne($userCapsule->capsule_id);
-
 
719
                if($capsule) {
-
 
720
                    
-
 
721
                    $record = $capsuleCommentMapper->fetchCountAndRatingAverage($capsule->company_id, $capsule->topic_id, $capsule->id);
-
 
722
                    
-
 
723
                    
-
 
724
                    array_push($ratingAndComments, [
-
 
725
                        'uuid' => $capsule->uuid, 
-
 
726
                        'total_comments' => $record['total_comments'],
-
 
727
                        'total_rating' => $record['total_rating'],
-
 
728
                    ]);  
-
 
729
                }
-
 
730
                
-
 
731
            }
-
 
732
            
-
 
733
            
-
 
734
            
707
            
735
            
708
            $data = [
736
            $data = [
709
                'success'   => true,
737
                'success'   => true,
710
                'data'      =>[
738
                'data'      =>[
711
                    'user' => [
739
                    'user' => [
712
                        'uuid'          => $user->uuid,
740
                        'uuid'              => $user->uuid,
713
                        'first_name'    => $user->first_name,
741
                        'first_name'        => $user->first_name,
714
                        'last_name'     => $user->last_name,
742
                        'last_name'         => $user->last_name,
715
                        'email'         => $user->email,
743
                        'email'             => $user->email,
716
                        'image'         => $this->url()->fromRoute('services/storage',['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image], ['force_canonical' => true]),
744
                        'image'             => $this->url()->fromRoute('services/storage',['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image], ['force_canonical' => true]),
-
 
745
                    ],
717
                    ],
746
                    'rating_and_comments'   => $ratingAndComments,
718
                    'new_capsules'      => $newCapsules,
747
                    'new_capsules'          => $newCapsules,
Línea 719... Línea 748...
719
                    'max_date_changes'  => $max_date_changes_db,
748
                    'max_date_changes'      => $max_date_changes_db,
720
                    
749
                    
721
                    'topics'            => [],
750
                    'topics'            => [],
722
                    'quizzes'           => [],
751
                    'quizzes'           => [],
Línea 1498... Línea 1527...
1498
            
1527
            
1499
            if($user_uuid && $device->application_id = Application::TWOGETSKILLS  && $company_uuid && in_array($sync_type, ['microlearning-progress', 'microlearning-userlog', 'microlearning-quiz'])) {
1528
            if($user_uuid && $device->application_id = Application::TWOGETSKILLS  && $company_uuid && in_array($sync_type, ['microlearning-progress', 'microlearning-userlog', 'microlearning-quiz'])) {
1500
                $userMapper = UserMapper::getInstance($this->adapter);
1529
                $userMapper = UserMapper::getInstance($this->adapter);
Línea -... Línea 1530...
-
 
1530
                $user = $userMapper->fetchOneByUuid($user_uuid);
-
 
1531
                
1501
                $user = $userMapper->fetchOneByUuid($user_uuid);
1532
            
1502
                
1533
                
1503
                if(!$user) {
1534
                if(!$user) {
1504
                    return new JsonModel([
1535
                    return new JsonModel([
1505
                        'success' => false,
1536
                        'success' => false,
Línea 1586... Línea 1617...
1586
                        ]
1617
                        ]
1587
                    ]);
1618
                    ]);
1588
                }
1619
                }
Línea 1589... Línea 1620...
1589
                
1620
                
1590
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
1621
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
1591
                $topic_uuid = isset($data['topic_uuid']) ? filter_var($data['topic_uuid'], FILTER_SANITIZE_STRING) :  '';
1622
                $topic_uuid = isset($data['topic_uuid']) ? trim(filter_var($data['topic_uuid'], FILTER_SANITIZE_STRING)) :  '';
1592
                if($topic_uuid) {
1623
                if($topic_uuid) {
Línea 1593... Línea 1624...
1593
                    $topic = $topicMapper->fetchOneByUuid($topic_uuid);
1624
                    $topic = $topicMapper->fetchOneByUuid($topic_uuid);
1594
                    
1625
                    
Línea 1614... Línea 1645...
1614
                    
1645
                    
1615
                } else {
1646
                } else {
1616
                    $topic = null;
1647
                    $topic = null;
Línea 1617... Línea 1648...
1617
                }
1648
                }
1618
                
1649
                
1619
                $capsule_uuid     = isset($data['capsule_uuid']) ? filter_var($data['capsule_uuid'], FILTER_SANITIZE_STRING) :  '';
1650
                $capsule_uuid     = isset($data['capsule_uuid']) ? trim(filter_var($data['capsule_uuid'], FILTER_SANITIZE_STRING)) :  '';
Línea 1620... Línea 1651...
1620
                $capsuleMapper = CompanyMicrolearningCapsuleMapper::getInstance($this->adapter);
1651
                $capsuleMapper = CompanyMicrolearningCapsuleMapper::getInstance($this->adapter);
1621
                if($capsule_uuid) {
1652
                if($capsule_uuid) {
Línea 1675... Línea 1706...
1675
                            ]
1706
                            ]
1676
                        ]);
1707
                        ]);
1677
                    }
1708
                    }
1678
                }
1709
                }
Línea -... Línea 1710...
-
 
1710
                
-
 
1711
               
1679
                
1712
                
1680
                $slideMapper = CompanyMicrolearningSlideMapper::getInstance($this->adapter);
1713
                $slideMapper = CompanyMicrolearningSlideMapper::getInstance($this->adapter);
-
 
1714
                $slide_uuid      = isset($data['slide_uuid']) ? trim(filter_var($data['slide_uuid'], FILTER_SANITIZE_STRING)) :  '';
-
 
1715
           
1681
                $slide_uuid      = isset($data['slide_uuid']) ? filter_var($data['slide_uuid'], FILTER_SANITIZE_STRING) :  '';
1716
                
-
 
1717
                if($slide_uuid) {
1682
                if($slide_uuid) {
1718
  
1683
                    $slide = $slideMapper->fetchOneByUuid($slide_uuid);
1719
                    $slide = $slideMapper->fetchOneByUuid($slide_uuid);
1684
                    if(!$slide) {
1720
                    if(!$slide) {
1685
                        return new JsonModel([
1721
                        return new JsonModel([
1686
                            'success' => false,
1722
                            'success' => false,
Línea 1702... Línea 1738...
1702
                    }
1738
                    }
1703
                } else {
1739
                } else {
1704
                    $slide = null;
1740
                    $slide = null;
1705
                }
1741
                }
Línea -... Línea 1742...
-
 
1742
                
-
 
1743
      
-
 
1744
                
1706
                
1745
        
1707
                if($sync_type == 'microlearning-quiz') {
1746
                if($sync_type == 'microlearning-quiz') {
Línea 1708... Línea 1747...
1708
                    $ok = true;
1747
                    $ok = true;
1709
                    
1748
                    
Línea 1824... Línea 1863...
1824
                }
1863
                }
Línea 1825... Línea 1864...
1825
                
1864
                
1826
                
1865
                
-
 
1866
                if($sync_type == 'microlearning-progress') {
Línea 1827... Línea 1867...
1827
                if($sync_type == 'microlearning-progress') {
1867
                    $ok = true;
1828
                    $ok = true;
1868
      
1829
                    
1869
                    
1830
                    $type = isset($data['type']) ? $data['type'] : '';
1870
                    $type = isset($data['type']) ? $data['type'] : '';