Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 302 Rev 307
Línea 2860... Línea 2860...
2860
            'success' => false,
2860
            'success' => false,
2861
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
2861
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
2862
        ]);
2862
        ]);
Línea -... Línea 2863...
-
 
2863
        
-
 
2864
        
-
 
2865
      
2863
        
2866
        
Línea -... Línea 2867...
-
 
2867
        
-
 
2868
    }
-
 
2869
    
-
 
2870
    public function habitsAndSkillsAction()
-
 
2871
    {
-
 
2872
        $request = $this->getRequest();
-
 
2873
        $request = $this->getRequest();
-
 
2874
        if ($request->isGet()) {
-
 
2875
            $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
2876
            $currentUser = $currentUserPlugin->getUser();
-
 
2877
            
-
 
2878
            $company_ids = [];
-
 
2879
            $habitUserMapper = \LeadersLinked\Mapper\HabitUserMapper::getInstance($this->adapter);
-
 
2880
            $records = $habitUserMapper->fetchAllActiveByUserId($currentUser->id);
-
 
2881
            foreach($records as $record)
-
 
2882
            {
-
 
2883
                if($record->company_id) {
-
 
2884
                
-
 
2885
                    if(!in_array($record->company_id, $company_ids)) {
-
 
2886
                        array_push($company_ids, $record->company_id);
-
 
2887
                    }
-
 
2888
                }
-
 
2889
            }
-
 
2890
            
-
 
2891
            $items = [];
-
 
2892
            if($company_ids) {
-
 
2893
            
-
 
2894
                $habitSkillMapper = \LeadersLinked\Mapper\HabitSkillMapper::getInstance($this->adapter);
-
 
2895
                $records = $habitSkillMapper->fetchAllTemplateByCompayIds($company_ids);
-
 
2896
                foreach($records as $record)
-
 
2897
                {
-
 
2898
                    array_push($items, [
-
 
2899
                        'uuid'              => $record->uuid, 
-
 
2900
                        'name'              => $record->name, 
-
 
2901
                        'monday_active'     => $record->monday_active,
-
 
2902
                        'monday_time'       => $record->monday_time,
-
 
2903
                        'tuesday_active'    => $record->tuesday_active,
-
 
2904
                        'tuesday_time'      => $record->tuesday_time,
-
 
2905
                        'wednesday_active'  => $record->wednesday_active,
-
 
2906
                        'wednesday_time'    => $record->wednesday_time,
-
 
2907
                        'thursday_active'   => $record->thursday_active,
-
 
2908
                        'thursday_time'     => $record->thursday_time,
-
 
2909
                        'friday_active'     => $record->friday_active,
-
 
2910
                        'friday_time'       => $record->friday_time,
-
 
2911
                        'saturday_active'   => $record->saturday_active,
-
 
2912
                        'saturday_time'     => $record->saturday_time,
-
 
2913
                        'sunday_active'     => $record->sunday_active,
-
 
2914
                        'sunday_time'       => $record->sunday_time,
-
 
2915
                        
-
 
2916
                    ]);
-
 
2917
                }
-
 
2918
            }
-
 
2919
            
-
 
2920
            
-
 
2921
            return new JsonModel([
-
 
2922
                'success' => true,
-
 
2923
                'data' => $items,
-
 
2924
            ]);
-
 
2925
            
-
 
2926
        }
-
 
2927
        return new JsonModel([
-
 
2928
            'success' => false,
Línea 2864... Línea 2929...
2864
        
2929
            'data' => 'ERROR_METHOD_NOT_ALLOWED'