Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 725 Rev 726
Línea 427... Línea 427...
427
    public function addAction()
427
    public function addAction()
428
    {
428
    {
429
        $currentUserPlugin  = $this->plugin('currentUserPlugin');
429
        $currentUserPlugin  = $this->plugin('currentUserPlugin');
430
        $currentUser        = $currentUserPlugin->getUser();
430
        $currentUser        = $currentUserPlugin->getUser();
Línea -... Línea 431...
-
 
431
 
-
 
432
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
-
 
433
        $currentNetwork = $currentNetworkPlugin->getNetwork();
431
 
434
 
Línea 432... Línea 435...
432
        $request            = $this->getRequest();
435
        $request            = $this->getRequest();
433
 
436
 
434
        if ($request->isPost()) {
437
        if ($request->isPost()) {
Línea 547... Línea 550...
547
                        ]);
550
                        ]);
548
                    }
551
                    }
Línea 549... Línea 552...
549
 
552
 
Línea -... Línea 553...
-
 
553
                    $this->logger->info('Se agrego el contenido ' . $knowledgeAreaContent->title, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
-
 
554
 
-
 
555
                    $categoryData = $this->getAccessibleCategories($currentUser, $currentNetwork);
-
 
556
                    $path = $storage->getPathKnowledgeArea();
-
 
557
 
-
 
558
                    $knowledgeData = [
-
 
559
                        'uuid' => $knowledgeAreaContent->uuid,
-
 
560
                        'title' => $knowledgeAreaContent->title,
-
 
561
                        'description' => $knowledgeAreaContent->description,
-
 
562
                        'link' => $knowledgeAreaContent->link,
-
 
563
                        'image' => $storage->getGenericImage($path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->image),
-
 
564
                        'attachment' => $knowledgeAreaContent->attachment ? $storage->getGenericFile($path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->attachment) : '',
-
 
565
                        'category' => $knowledgeAreaCategory->name,
-
 
566
                        'link_view' => '',
-
 
567
                        'link_edit' => '',
-
 
568
                        'link_delete' => '',
-
 
569
                    ];
-
 
570
 
-
 
571
                    if($categoryData['allow_view']) {
-
 
572
                        $knowledgeData['link_view'] = $this->url()->fromRoute('knowledge-area/view', ['id' => $knowledgeAreaContent->uuid]);
-
 
573
                    }
-
 
574
 
-
 
575
                    if(in_array($knowledgeAreaContent->category_id, $categoryData['category_with_edition_ids'])) {
-
 
576
                        if($categoryData['allow_edit']) {
-
 
577
                            $knowledgeData['link_edit'] = $this->url()->fromRoute('knowledge-area/edit', ['id' => $knowledgeAreaContent->uuid]);
-
 
578
                        }
-
 
579
                        if($categoryData['allow_delete']) {
-
 
580
                            $knowledgeData['link_delete'] = $this->url()->fromRoute('knowledge-area/delete', ['id' => $knowledgeAreaContent->uuid]);
-
 
581
                        }
550
                    $this->logger->info('Se agrego el contenido ' . $knowledgeAreaContent->title, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
582
                    }
551
 
583
 
552
                    $data = [
584
                    $data = [
553
                        'success'   => true,
585
                        'success'   => true,
554
                        'data'      => [
586
                        'data'      => [
555
                            'message' => 'LABEL_RECORD_ADDED',
587
                            'message' => 'LABEL_RECORD_ADDED',
556
                            'knowledge'    => $knowledgeAreaContent
588
                            'knowledge'    => $knowledgeData
557
                        ]
589
                        ]
558
                    ];
590
                    ];
559
                } else {
591
                } else {