Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6866 Rev 7016
Línea 117... Línea 117...
117
                        $isJson = strpos($raw, 'json');
117
                        $isJson = strpos($raw, 'json');
118
                    }
118
                    }
119
                }
119
                }
120
            }
120
            }
Línea 121... Línea -...
121
 
-
 
-
 
121
 
122
 
122
           // $isJson = true;
Línea 123... Línea 123...
123
            if ($isJson) {
123
            if ($isJson) {
-
 
124
 
124
 
125
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
125
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
126
                $allowAdd       = $acl->isAllowed($currentUser->usertype_id, 'knowledge-area/add') ? 1 : 0;
126
                $allowEdit = $acl->isAllowed($currentUser->usertype_id, 'knowledge-area/edit');
127
                $allowEdit = $acl->isAllowed($currentUser->usertype_id, 'knowledge-area/edit');
Línea 138... Línea 139...
138
                $records_x_page     = 12;
139
                $records_x_page     = 12;
Línea 139... Línea 140...
139
 
140
 
-
 
141
 
140
 
142
 
141
 
143
                $category_with_edition_ids = [];
Línea -... Línea 144...
-
 
144
                $category_with_edition_uuids = [];
-
 
145
                $category_ids = [];
Línea 142... Línea 146...
142
                $category_with_edition_ids = [];
146
                $categories = [];
143
                $category_ids = [];
147
 
144
                $categories = [];
148
                
145
 
149
                $knowledgeAreaCategoryMapper = KnowledgeAreaCategoryMapper::getInstance($this->adapter);
Línea 146... Línea 150...
146
 
150
 
-
 
151
                $knowledgeAreaCategoryUserMapper = KnowledgeAreaCategoryUserMapper::getInstance($this->adapter);
-
 
152
                $records =  $knowledgeAreaCategoryUserMapper->fetchAllByUserId($currentUser->id);
-
 
153
                foreach ($records as $record) {
-
 
154
                    if ($record->role == KnowledgeAreaCategoryUser::ROLE_ADMINISTRATOR || $record->role == KnowledgeAreaCategoryUser::ROLE_USER) {
-
 
155
 
-
 
156
                        array_push($category_with_edition_ids, $record->category_id);
147
                $knowledgeAreaCategoryUserMapper = KnowledgeAreaCategoryUserMapper::getInstance($this->adapter);
157
                        
Línea 148... Línea 158...
148
                $records =  $knowledgeAreaCategoryUserMapper->fetchAllByUserId($currentUser->id);
158
                        $knowledgeAreaCategory = $knowledgeAreaCategoryMapper->fetchOne($record->category_id);
149
                foreach ($records as $record) {
159
                        if($knowledgeAreaCategory) {
Línea 237... Línea 247...
237
                    }
247
                    }
Línea 238... Línea 248...
238
 
248
 
239
                    array_push($items, $item);
249
                    array_push($items, $item);
Línea -... Línea 250...
-
 
250
                }
-
 
251
 
-
 
252
 
-
 
253
                
240
                }
254
                $image_size = $this->config['leaderslinked.image_sizes.knowledge_area'];
241
 
255
 
242
                return new JsonModel([
256
                return new JsonModel([
243
                    'success' => true,
257
                    'success' => true,
244
                    'data' => [
258
                    'data' => [
245
                        'items' => $items,
259
                        'items' => $items,
246
                        'total' => $paginator->getTotalItemCount(),
260
                        'total' => $paginator->getTotalItemCount(),
-
 
261
                        'page' => $paginator->getCurrentPageNumber(),
-
 
262
                        'total_pages' => $paginator->getPages()->pageCount,
-
 
263
                        'categories' => $categories,
-
 
264
                        'categories_with_edition' => $category_with_edition_uuids,
-
 
265
                        'link_add' => $allowAdd ? $this->url('knowledge-area/add') : '',
247
                        'page' => $paginator->getCurrentPageNumber(),
266
                        'image_size' => $image_size,
248
                        'total_pages' => $paginator->getPageRange()
267
                       
249
                    ]
268
                    ]