Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7108 Rev 7120
Línea 103... Línea 103...
103
        $currentNetwork = $currentNetworkPlugin->getNetwork();
103
        $currentNetwork = $currentNetworkPlugin->getNetwork();
Línea 104... Línea 104...
104
 
104
 
105
        $request = $this->getRequest();
105
        $request = $this->getRequest();
Línea 106... Línea 106...
106
        if ($request->isGet()) {
106
        if ($request->isGet()) {
107
            
-
 
Línea -... Línea 107...
-
 
107
            
-
 
108
            $isJson = false;
-
 
109
            
-
 
110
            $headers  = $request->getHeaders();
-
 
111
            if ($headers->has('Accept')) {
-
 
112
                $accept = $headers->get('Accept');
-
 
113
                
-
 
114
                $prioritized = $accept->getPrioritized();
-
 
115
                
-
 
116
                foreach ($prioritized as $key => $value) {
-
 
117
                    $raw = trim($value->getRaw());
-
 
118
                    
-
 
119
                    if (!$isJson) {
-
 
120
                        $isJson = strpos($raw, 'json');
-
 
121
                    }
-
 
122
                }
-
 
123
            }
-
 
124
            
-
 
125
            // $isJson = true;
-
 
126
            if ($isJson) {
-
 
127
                
-
 
128
                $myCoachAccesControl = MyCoachAccessControl::getInstance($this->adapter);
-
 
129
                $categories = $myCoachAccesControl->getCategoriesWithAccessToFormSelect($currentUser->id, $currentNetwork->id);
-
 
130
               
-
 
131
                return new JsonModel([
-
 
132
                    'success' => true,
-
 
133
                    'data' => [
-
 
134
                        'categories' => $categories,
-
 
135
                    ]
-
 
136
                ]);
-
 
137
                
-
 
138
            } else {
-
 
139
            
108
            $myCoachAccesControl = MyCoachAccessControl::getInstance($this->adapter);
140
                $myCoachAccesControl = MyCoachAccessControl::getInstance($this->adapter);
109
            $categories = $myCoachAccesControl->getCategoriesWithAccessToFormSelect($currentUser->id, $currentNetwork->id);
141
                $categories = $myCoachAccesControl->getCategoriesWithAccessToFormSelect($currentUser->id, $currentNetwork->id);
110
            
142
                
111
            $formQuestion = new MyCoachQuestionForm($categories);
143
                $formQuestion = new MyCoachQuestionForm($categories);
112
            $formAnswer = new MyCoachAnswerForm();
144
                $formAnswer = new MyCoachAnswerForm();
113
 
145
    
114
 
146
    
115
            $this->layout()->setTemplate('layout/layout');
147
                $this->layout()->setTemplate('layout/layout');
116
            $viewModel = new ViewModel();
148
                $viewModel = new ViewModel();
117
            $viewModel->setTemplate('leaders-linked/my-coach/index');
149
                $viewModel->setTemplate('leaders-linked/my-coach/index');
118
            $viewModel->setVariables([
150
                $viewModel->setVariables([
119
                'categories' => $categories,
151
                    'categories' => $categories,
120
                'formQuestion' => $formQuestion,
152
                    'formQuestion' => $formQuestion,
-
 
153
                    'formAnswer' => $formAnswer,
Línea 121... Línea 154...
121
                'formAnswer' => $formAnswer,
154
                ]);
122
            ]);
155
                return $viewModel;
123
            return $viewModel;
156
            }
124
 
157