Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6828 Rev 6829
Línea 108... Línea 108...
108
            }
108
            }
Línea 109... Línea 109...
109
            
109
            
Línea 110... Línea 110...
110
            if($isJson) {
110
            if($isJson) {
Línea 111... Línea 111...
111
                
111
                
112
 
112
 
Línea 113... Línea 113...
113
                $capsule_uuid = filter_var($this->params()->fromQuery('capsule_uuid'), FILTER_SANITIZE_STRING); 
113
                $topic_uuid = filter_var($this->params()->fromQuery('topic_uuid'), FILTER_SANITIZE_STRING); 
114
            
114
            
115
                $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
115
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
116
                $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
116
                $topic = $topicMapper->fetchOneByUuid($topic_uuid);
117
                
117
                
Línea 118... Línea 118...
118
                if(!$capsule) {
118
                if(!$topic) {
Línea 119... Línea 119...
119
                    return new JsonModel([
119
                    return new JsonModel([
120
                       'success' => false, 
120
                       'success' => false, 
121
                       'data' => 'ERROR_TOPIC_NOT_FOUND'
121
                       'data' => 'ERROR_TOPIC_NOT_FOUND'
122
                    ]); 
122
                    ]); 
123
                   
123
                   
124
                }
124
                }
Línea 153... Línea 153...
153
                $allowEdit = $acl->isAllowed($currentUser->usertype_id, 'microlearning/content/capsules/edit');
153
                $allowEdit = $acl->isAllowed($currentUser->usertype_id, 'microlearning/content/capsules/edit');
154
                $allowDelete = $acl->isAllowed($currentUser->usertype_id, 'microlearning/content/capsules/delete');
154
                $allowDelete = $acl->isAllowed($currentUser->usertype_id, 'microlearning/content/capsules/delete');
155
                $allowUsers = $acl->isAllowed($currentUser->usertype_id, 'microlearning/content/capsules/users');
155
                $allowUsers = $acl->isAllowed($currentUser->usertype_id, 'microlearning/content/capsules/users');
Línea 156... Línea 156...
156
           
156
           
157
                $capsuleMapper = CompanyMicrolearningCapsuleMapper::getInstance($this->adapter);
157
                $capsuleMapper = CompanyMicrolearningCapsuleMapper::getInstance($this->adapter);
Línea 158... Línea 158...
158
                $paginator = $capsuleMapper->fetchAllDataTableByCompanyIdAndTopicId($capsule->company_id, $capsule->id, $search, $page, $records_x_page, $order_field, $order_direction);
158
                $paginator = $capsuleMapper->fetchAllDataTableByCompanyIdAndTopicId($topic->company_id, $topic->id, $search, $page, $records_x_page, $order_field, $order_direction);
159
                
159
                
Línea 166... Línea 166...
166
                foreach($records as $record)
166
                foreach($records as $record)
167
                {
167
                {
Línea 168... Línea 168...
168
                    
168
                    
Línea 169... Línea 169...
169
                    //print_r($record); 
169
                    //print_r($record); 
170
                    
170
                    
Línea 171... Línea 171...
171
                    $total_users        = $companyMicrolearningCapsuleUserMapper->fetchCountUsersByCompanyIdAndTopicIdAndCapsuleId($capsule->company_id, $capsule->id, $record->id);
171
                    $total_users        = $companyMicrolearningCapsuleUserMapper->fetchCountUsersByCompanyIdAndTopicIdAndCapsuleId($topic->company_id, $topic->id, $record->id);
172
                    $total_users_active = $companyMicrolearningCapsuleUserMapper->fetchCountUsersActiveByCompanyIdAndTopicIdAndCapsuleId($capsule->company_id, $capsule->id, $record->id);
172
                    $total_users_active = $companyMicrolearningCapsuleUserMapper->fetchCountUsersActiveByCompanyIdAndTopicIdAndCapsuleId($topic->company_id, $topic->id, $record->id);
Línea 220... Línea 220...
220
                            $privacy = '';
220
                            $privacy = '';
221
                            break;
221
                            break;
222
                    }
222
                    }
Línea 223... Línea 223...
223
 
223
 
224
                    $params = [
224
                    $params = [
225
                        'capsule_uuid'    => $capsule->uuid, 
225
                        'topic_uuid'    => $topic->uuid, 
226
                        'capsule_uuid'  => $record->uuid
226
                        'capsule_uuid'  => $record->uuid
Línea 227... Línea 227...
227
                    ];
227
                    ];
Línea 245... Línea 245...
245
                        ] ,
245
                        ] ,
246
                        'actions' => [ 
246
                        'actions' => [ 
247
                            'link_edit' => $allowEdit ? $this->url()->fromRoute('microlearning/content/capsules/edit', $params)  : '', 
247
                            'link_edit' => $allowEdit ? $this->url()->fromRoute('microlearning/content/capsules/edit', $params)  : '', 
248
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('microlearning/content/capsules/delete', $params)  : '', 
248
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('microlearning/content/capsules/delete', $params)  : '', 
249
                            'link_total_users' => $allowUsers && $total_users ? $this->url()->fromRoute('microlearning/content/capsules/users', [
249
                            'link_total_users' => $allowUsers && $total_users ? $this->url()->fromRoute('microlearning/content/capsules/users', [
250
                                'capsule_uuid'    => $capsule->uuid,
250
                                'topic_uuid'    => $topic->uuid,
251
                                'capsule_uuid'  => $record->uuid,
251
                                'capsule_uuid'  => $record->uuid,
252
                                'type' => 'all'
252
                                'type' => 'all'
253
                             ])  : '',
253
                             ])  : '',
254
                            'link_total_users_actives' => $allowUsers && $total_users_active ? $this->url()->fromRoute('microlearning/content/capsules/users', [
254
                            'link_total_users_actives' => $allowUsers && $total_users_active ? $this->url()->fromRoute('microlearning/content/capsules/users', [
255
                                'capsule_uuid'    => $capsule->uuid,
255
                                'topic_uuid'    => $topic->uuid,
256
                                'capsule_uuid'  => $record->uuid,
256
                                'capsule_uuid'  => $record->uuid,
257
                                'type' => 'active'
257
                                'type' => 'active'
258
                            ])  : '', 
258
                            ])  : '', 
259
                        ] ,
259
                        ] ,
Línea 268... Línea 268...
268
 
268
 
269
                
269
                
270
                return new JsonModel([
270
                return new JsonModel([
271
                    'success' => true,
271
                    'success' => true,
272
                    'data' => [
272
                    'data' => [
273
                        'link_add' => $allowAdd ? $this->url()->fromRoute('microlearning/content/capsules/add', ['capsule_uuid' => $capsule->uuid] )  : '', 
273
                        'link_add' => $allowAdd ? $this->url()->fromRoute('microlearning/content/capsules/add', ['topic_uuid' => $topic->uuid] )  : '', 
274
                        'items' => $items,
274
                        'items' => $items,
275
                        'total' => $paginator->getTotalItemCount(),
275
                        'total' => $paginator->getTotalItemCount(),
Línea 318... Línea 318...
318
        $currentUserPlugin  = $this->plugin('currentUserPlugin');
318
        $currentUserPlugin  = $this->plugin('currentUserPlugin');
319
        $currentUser        = $currentUserPlugin->getUser();
319
        $currentUser        = $currentUserPlugin->getUser();
320
        $currentCompany     = $currentUserPlugin->getCompany();
320
        $currentCompany     = $currentUserPlugin->getCompany();
Línea 321... Línea 321...
321
        
321
        
322
        $request    = $this->getRequest();
322
        $request    = $this->getRequest();
Línea 323... Línea 323...
323
        $capsule_uuid = $this->params()->fromRoute('capsule_uuid');
323
        $topic_uuid = $this->params()->fromRoute('topic_uuid');
324
        
324
        
325
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
325
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
326
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
326
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
327
        if(!$capsule) {
327
        if(!$topic) {
328
            return new JsonModel([
328
            return new JsonModel([
329
                'success'   => false,
329
                'success'   => false,
330
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
330
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
Línea 331... Línea 331...
331
            ]);
331
            ]);
332
        }
332
        }
333
        
333
        
334
        if($capsule->company_id != $currentCompany->id) {
334
        if($topic->company_id != $currentCompany->id) {
335
            return new JsonModel([
335
            return new JsonModel([
336
                'success'   => false,
336
                'success'   => false,
Línea 350... Línea 350...
350
                
350
                
351
                $hydrator = new ObjectPropertyHydrator();
351
                $hydrator = new ObjectPropertyHydrator();
352
                $capsule = new CompanyMicrolearningCapsule();
352
                $capsule = new CompanyMicrolearningCapsule();
Línea 353... Línea 353...
353
                $hydrator->hydrate($dataPost, $capsule);
353
                $hydrator->hydrate($dataPost, $capsule);
354
                
354
                
355
                $capsule->company_id = $capsule->company_id;
355
                $capsule->company_id = $topic->company_id;
356
                $capsule->capsule_id = $capsule->id;
356
                $capsule->topic_id = $topic->id;
Línea 357... Línea 357...
357
                $capsule->image = '';
357
                $capsule->image = '';
358
                $capsule->marketplace = '';
358
                $capsule->marketplace = '';
Línea 367... Línea 367...
367
                        mkdir($target_path, 0755, true);
367
                        mkdir($target_path, 0755, true);
368
                    }
368
                    }
Línea 369... Línea 369...
369
                    
369
                    
370
                    
370
                    
371
                    $files = $this->getRequest()->getFiles()->toArray();
371
                    $files = $this->getRequest()->getFiles()->toArray();
372
/*
372
 
Línea 373... Línea 373...
373
                    $fileBase64Content = $this->params()->fromPost('file');
373
                    $fileBase64Content = $this->params()->fromPost('file');
374
                    try {
374
                    try {
375
                        
375
                        
376
                        $fileBase64Content = base64_decode($fileBase64Content);
376
                        $fileBase64Content = base64_decode($fileBase64Content);
377
                        $target_path = $this->config['leaderslinked.fullpath.microlearning_capsule'] . $capsule->uuid;
377
                        $target_path = $this->config['leaderslinked.fullpath.microlearning_topic'] . $topic->uuid;
378
                        $capsule_filename      = 'capsule-' .uniqid() . '.png';
378
                        $topic_filename      = 'topic-' .uniqid() . '.png';
379
                        $capsule_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp';
379
                        $topic_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp';
380
                        if(!file_exists($capsule_tmp_filename)) {
380
                        if(!file_exists($topic_tmp_filename)) {
381
                            mkdir($capsule_tmp_filename, 0755, true);
381
                            mkdir($topic_tmp_filename, 0755, true);
Línea 382... Línea 382...
382
                        }
382
                        }
Línea 383... Línea 383...
383
                        $capsule_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $capsule_filename;
383
                        $topic_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $topic_filename;
384
                            file_put_contents($capsule_tmp_filename, $fileBase64Content);
384
                            file_put_contents($topic_tmp_filename, $fileBase64Content);
385
                        
385
                        
386
                        list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.microlearning_image_size']);
386
                        list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.microlearning_image_size']);
387
 
387
 
388
                        $crop_to_dimensions = false;
388
                        $crop_to_dimensions = false;
389
                        if(Image::uploadImage($capsule_tmp_filename, $target_path, $capsule_filename, $target_width, $target_height, $crop_to_dimensions )) {
389
                        if(Image::uploadImage($topic_tmp_filename, $target_path, $topic_filename, $target_width, $target_height, $crop_to_dimensions )) {
390
                            $capsule->file = basename($capsule_filename);
390
                            $topic->image = basename($topic_filename);
Línea 391... Línea -...
391
                            $capsuleMapper->update($capsule);
-
 
-
 
391
                            $topicMapper->update($topic);
392
                        }
392
                        }
393
                    } catch(\Throwable $e) {
393
                    } catch(\Throwable $e) {
394
                        error_log($e->getTraceAsString());
394
                        error_log($e->getTraceAsString());
Línea 395... Línea 395...
395
                    }  */     
395
                    }       
Línea 411... Línea 411...
411
                            }
411
                            }
412
                        } catch(\Throwable $e) {
412
                        } catch(\Throwable $e) {
413
                            error_log($e->getTraceAsString());
413
                            error_log($e->getTraceAsString());
414
                        }
414
                        }
415
                    }
415
                    }
416
                    
-
 
-
 
416
                    */
Línea 417... Línea 417...
417
                    
417
                    
418
                    
418
                    
419
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
419
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
Línea 433... Línea 433...
433
                        } catch(\Throwable $e) {
433
                        } catch(\Throwable $e) {
434
                            error_log($e->getTraceAsString());
434
                            error_log($e->getTraceAsString());
435
                        }
435
                        }
436
                    }
436
                    }
Línea 437... Línea 437...
437
                    
437
                    
Línea 438... Línea 438...
438
                    $this->logger->info('Se agrego la cápsula ' . $capsule->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
438
                    $this->logger->info('Se agrego la cápsula ' . $topic->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
439
                    
439
                    
440
                    $data = [
440
                    $data = [
441
                        'success'   => true,
441
                        'success'   => true,
442
                        'data'   => 'LABEL_RECORD_ADDED'
442
                        'data'   => 'LABEL_RECORD_ADDED'
443
                    ];
443
                    ];
444
                } else {
444
                } else {
445
                    $data = [
445
                    $data = [
446
                        'success'   => false,
446
                        'success'   => false,
Línea 447... Línea 447...
447
                        'data'      => $capsuleMapper->getError()
447
                        'data'      => $topicMapper->getError()
Línea 448... Línea 448...
448
                    ];
448
                    ];
Línea 488... Línea 488...
488
        $currentUserPlugin = $this->plugin('currentUserPlugin');
488
        $currentUserPlugin = $this->plugin('currentUserPlugin');
489
        $currentUser    = $currentUserPlugin->getUser();
489
        $currentUser    = $currentUserPlugin->getUser();
490
        $currentCompany = $currentUserPlugin->getCompany();
490
        $currentCompany = $currentUserPlugin->getCompany();
Línea 491... Línea 491...
491
        
491
        
492
        $request        = $this->getRequest();
492
        $request        = $this->getRequest();
493
        $capsule_uuid     = $this->params()->fromRoute('capsule_uuid');
493
        $topic_uuid     = $this->params()->fromRoute('topic_uuid');
Línea 494... Línea 494...
494
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
494
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
495
        
495
        
496
 
496
 
497
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
497
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
498
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
498
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
499
        if(!$capsule) {
499
        if(!$topic) {
500
            return new JsonModel([
500
            return new JsonModel([
501
                'success'   => false,
501
                'success'   => false,
Línea 502... Línea 502...
502
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
502
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
503
            ]);
503
            ]);
504
        }
504
        }
505
        
505
        
506
        if($capsule->company_id != $currentCompany->id) {
506
        if($topic->company_id != $currentCompany->id) {
507
            return new JsonModel([
507
            return new JsonModel([
Línea 517... Línea 517...
517
                'success'   => false,
517
                'success'   => false,
518
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
518
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
519
            ]);
519
            ]);
520
        }
520
        }
Línea 521... Línea 521...
521
        
521
        
522
        if($capsule->capsule_id != $capsule->id) {
522
        if($capsule->topic_id != $topic->id) {
523
            return new JsonModel([
523
            return new JsonModel([
524
                'success'   => false,
524
                'success'   => false,
525
                'data'   => 'ERROR_UNAUTHORIZED'
525
                'data'   => 'ERROR_UNAUTHORIZED'
526
            ]);
526
            ]);
Línea 573... Línea 573...
573
        $currentUserPlugin = $this->plugin('currentUserPlugin');
573
        $currentUserPlugin = $this->plugin('currentUserPlugin');
574
        $currentUser    = $currentUserPlugin->getUser();
574
        $currentUser    = $currentUserPlugin->getUser();
575
        $currentCompany = $currentUserPlugin->getCompany();
575
        $currentCompany = $currentUserPlugin->getCompany();
Línea 576... Línea 576...
576
 
576
 
577
        $request    = $this->getRequest();
577
        $request    = $this->getRequest();
578
        $capsule_uuid     = $this->params()->fromRoute('capsule_uuid');
578
        $topic_uuid     = $this->params()->fromRoute('topic_uuid');
Línea 579... Línea 579...
579
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
579
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
580
        
580
        
581
        
581
        
582
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
582
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
583
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
583
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
584
        if(!$capsule) {
584
        if(!$topic) {
585
            return new JsonModel([
585
            return new JsonModel([
586
                'success'   => false,
586
                'success'   => false,
Línea 587... Línea 587...
587
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
587
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
588
            ]);
588
            ]);
589
        }
589
        }
590
        
590
        
591
  
591
  
592
        
592
        
Línea 605... Línea 605...
605
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
605
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
606
            ]);
606
            ]);
607
        }
607
        }
Línea 608... Línea 608...
608
        
608
        
609
 
609
 
610
        if($capsule->capsule_id != $capsule->id) {
610
        if($capsule->topic_id != $topic->id) {
611
            return new JsonModel([
611
            return new JsonModel([
612
                'success'   => false,
612
                'success'   => false,
613
                'data'   => 'ERROR_UNAUTHORIZED'
613
                'data'   => 'ERROR_UNAUTHORIZED'
Línea 658... Línea 658...
658
                    if(isset($files['file']) && empty($files['file']['error'])) {
658
                    if(isset($files['file']) && empty($files['file']['error'])) {
659
                        $tmp_filename  = $files['file']['tmp_name'];
659
                        $tmp_filename  = $files['file']['tmp_name'];
660
                        //$filename      = $this->normalizeString($files['file']['name']);
660
                        //$filename      = $this->normalizeString($files['file']['name']);
Línea 661... Línea 661...
661
                        
661
                        
662
                        try {
662
                        try {
Línea 663... Línea 663...
663
                            if($capsule->image) {
663
                            if($topic->image) {
664
                                
664
                                
665
                                if(!image ::delete($target_path, $capsule->image)) {
665
                                if(!image ::delete($target_path, $capsule->image)) {
666
                                    return new JsonModel([
666
                                    return new JsonModel([
Línea 688... Línea 688...
688
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
688
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
689
                        $tmp_filename  = $files['marketplace']['tmp_name'];
689
                        $tmp_filename  = $files['marketplace']['tmp_name'];
690
                        //$filename      = $this->normalizeString($files['marketplace']['name']);
690
                        //$filename      = $this->normalizeString($files['marketplace']['name']);
Línea 691... Línea 691...
691
                        
691
                        
692
                        try {
692
                        try {
Línea 693... Línea 693...
693
                            if($capsule->marketplace) {
693
                            if($topic->marketplace) {
694
                                
694
                                
695
                                if(!image ::delete($target_path, $capsule->marketplace)) {
695
                                if(!image ::delete($target_path, $capsule->marketplace)) {
696
                                    return new JsonModel([
696
                                    return new JsonModel([
Línea 761... Línea 761...
761
        $currentUserPlugin = $this->plugin('currentUserPlugin');
761
        $currentUserPlugin = $this->plugin('currentUserPlugin');
762
        $currentUser    = $currentUserPlugin->getUser();
762
        $currentUser    = $currentUserPlugin->getUser();
763
        $currentCompany = $currentUserPlugin->getCompany();
763
        $currentCompany = $currentUserPlugin->getCompany();
Línea 764... Línea 764...
764
        
764
        
765
        $request        = $this->getRequest();
765
        $request        = $this->getRequest();
766
        $capsule_uuid     = $this->params()->fromRoute('capsule_uuid');
766
        $topic_uuid     = $this->params()->fromRoute('topic_uuid');
767
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
767
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
Línea 768... Línea 768...
768
        $type           = $this->params()->fromRoute('type'); 
768
        $type           = $this->params()->fromRoute('type'); 
769
        
769
        
770
        
770
        
771
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
771
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
772
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
772
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
773
        if(!$capsule) {
773
        if(!$topic) {
774
            return new JsonModel([
774
            return new JsonModel([
775
                'success'   => false,
775
                'success'   => false,
Línea 776... Línea 776...
776
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
776
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
777
            ]);
777
            ]);
778
        }
778
        }
779
        
779
        
780
        if($capsule->company_id != $currentCompany->id) {
780
        if($topic->company_id != $currentCompany->id) {
781
            return new JsonModel([
781
            return new JsonModel([
Línea 791... Línea 791...
791
                'success'   => false,
791
                'success'   => false,
792
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
792
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
793
            ]);
793
            ]);
794
        }
794
        }
Línea 795... Línea 795...
795
        
795
        
796
        if($capsule->capsule_id != $capsule->id) {
796
        if($capsule->topic_id != $topic->id) {
797
            return new JsonModel([
797
            return new JsonModel([
798
                'success'   => false,
798
                'success'   => false,
799
                'data'   => 'ERROR_UNAUTHORIZED'
799
                'data'   => 'ERROR_UNAUTHORIZED'
800
            ]);
800
            ]);
Línea 808... Línea 808...
808
            $select = $sql->select();
808
            $select = $sql->select();
809
            $select->columns(['access', 'paid_from', 'paid_to', 'added_on']);
809
            $select->columns(['access', 'paid_from', 'paid_to', 'added_on']);
810
            $select->from(['tb1' => CompanyMicrolearningCapsuleUserMapper::_TABLE] );
810
            $select->from(['tb1' => CompanyMicrolearningCapsuleUserMapper::_TABLE] );
811
            $select->join(['tb2' => UserMapper::_TABLE], 'tb1.user_id = tb2.id', ['uuid', 'first_name', 'last_name', 'email']);
811
            $select->join(['tb2' => UserMapper::_TABLE], 'tb1.user_id = tb2.id', ['uuid', 'first_name', 'last_name', 'email']);
812
            $select->where->equalTo('tb1.company_id', $capsule->company_id);
812
            $select->where->equalTo('tb1.company_id', $capsule->company_id);
813
            $select->where->equalTo('tb1.capsule_id', $capsule->capsule_id);
813
            $select->where->equalTo('tb1.topic_id', $capsule->topic_id);
814
            $select->where->equalTo('tb1.capsule_id', $capsule->id);
814
            $select->where->equalTo('tb1.capsule_id', $capsule->id);
Línea 815... Línea 815...
815
            
815
            
816
            if($type == 'active') {
816
            if($type == 'active') {
817
                $now = date('Y-m-d H:i:s');
817
                $now = date('Y-m-d H:i:s');
Línea 888... Línea 888...
888
            }
888
            }
Línea 889... Línea 889...
889
            
889
            
890
            return new JsonModel([
890
            return new JsonModel([
891
                'success' => true,
891
                'success' => true,
892
                'data' => [
892
                'data' => [
893
                    'capsule' => $capsule->name,
893
                    'topic' => $topic->name,
894
                    'capsule' => $capsule->name,
894
                    'capsule' => $capsule->name,
895
                    'items' => $items, 
895
                    'items' => $items, 
896
                ]    
896
                ]