Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 17075 Rev 17076
Línea 579... Línea 579...
579
        $currentUserPlugin = $this->plugin('currentUserPlugin');
579
        $currentUserPlugin = $this->plugin('currentUserPlugin');
580
        $currentUser    = $currentUserPlugin->getUser();
580
        $currentUser    = $currentUserPlugin->getUser();
581
        $currentCompany = $currentUserPlugin->getCompany();
581
        $currentCompany = $currentUserPlugin->getCompany();
Línea 582... Línea 582...
582
 
582
 
583
        $request    = $this->getRequest();
-
 
584
        $topic_uuid     = $this->params()->fromRoute('topic_uuid');
583
        $request    = $this->getRequest();
Línea 585... Línea -...
585
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
-
 
586
        
-
 
587
        
-
 
588
        $topicMapper = MicrolearningTopicMapper::getInstance($this->adapter);
-
 
589
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
-
 
590
        if(!$topic) {
-
 
591
            return new JsonModel([
-
 
592
                'success'   => false,
-
 
593
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
-
 
594
            ]);
-
 
595
        }
-
 
596
        
-
 
597
  
-
 
598
        
-
 
599
        if($topic->company_id != $currentCompany->id) {
-
 
600
            return new JsonModel([
-
 
601
                'success'   => false,
-
 
602
                'data'   => 'ERROR_UNAUTHORIZED'
-
 
603
            ]);
-
 
604
        }
584
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
605
        
585
        
606
        $capsuleMapper = MicrolearningCapsuleMapper::getInstance($this->adapter);
586
        $capsuleMapper = MicrolearningCapsuleMapper::getInstance($this->adapter);
607
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
587
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
608
        if(!$capsule) {
588
        if(!$capsule) {
609
            return new JsonModel([
589
            return new JsonModel([
610
                'success'   => false,
590
                'success'   => false,
611
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
591
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
Línea 612... Línea -...
612
            ]);
-
 
613
        }
592
            ]);
614
        
593
        }
615
 
594
        
616
        if($capsule->company_id != $currentCompany->id) {
595
        if($capsule->company_id != $currentCompany->id) {
617
            return new JsonModel([
596
            return new JsonModel([
Línea 622... Línea 601...
622
        
601
        
623
        if($request->isGet()) {
602
        if($request->isGet()) {
624
            $storage = Storage::getInstance($this->config, $this->adapter);
603
            $storage = Storage::getInstance($this->config, $this->adapter);
Línea 625... Línea -...
625
            $path = $storage->getPathMicrolearningCapsule();
-
 
626
            
604
            $path = $storage->getPathMicrolearningCapsule();
627
            
605
            
628
            $data = [
606
            $data = [
629
                'success' => true,
607
                'success' => true,
630
                'data' => [
608
                'data' => [
631
                    'name' => $capsule->name,
609
                    'name' => $capsule->name,
632
                    'description' => $capsule->description,
610
                    'description' => $capsule->description,
633
                    'status' => $capsule->status,
611
                    'status' => $capsule->status,
634
                    'privacy' => $capsule->privacy,
612
                    'privacy' => $capsule->privacy,
635
                    'type' => $capsule->type,
613
                    'type' => $capsule->type,
636
                    'cost' => $capsule->cost,
-
 
637
                    'image' => $storage->getGenericImage($path, $capsule->uuid, $capsule->image),
-
 
638
                    'marketplace' => $capsule->marketplace ?  $storage->getGenericImage($path, $capsule->uuid, $capsule->marketplace) : '',
614
                    'cost' => $capsule->cost,
639
                
615
                    'image' => $storage->getGenericImage($path, $capsule->uuid, $capsule->image)
Línea 640... Línea 616...
640
                ]
616
                ]
641
            ];
617
            ];