Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1458 Rev 6827
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
                $topic_uuid = filter_var($this->params()->fromQuery('topic_uuid'), FILTER_SANITIZE_STRING); 
113
                $capsule_uuid = filter_var($this->params()->fromQuery('capsule_uuid'), FILTER_SANITIZE_STRING); 
114
            
114
            
115
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
115
                $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
116
                $topic = $topicMapper->fetchOneByUuid($topic_uuid);
116
                $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
117
                
117
                
Línea 118... Línea 118...
118
                if(!$topic) {
118
                if(!$capsule) {
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($topic->company_id, $topic->id, $search, $page, $records_x_page, $order_field, $order_direction);
158
                $paginator = $capsuleMapper->fetchAllDataTableByCompanyIdAndTopicId($capsule->company_id, $capsule->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($topic->company_id, $topic->id, $record->id);
171
                    $total_users        = $companyMicrolearningCapsuleUserMapper->fetchCountUsersByCompanyIdAndTopicIdAndCapsuleId($capsule->company_id, $capsule->id, $record->id);
172
                    $total_users_active = $companyMicrolearningCapsuleUserMapper->fetchCountUsersActiveByCompanyIdAndTopicIdAndCapsuleId($topic->company_id, $topic->id, $record->id);
172
                    $total_users_active = $companyMicrolearningCapsuleUserMapper->fetchCountUsersActiveByCompanyIdAndTopicIdAndCapsuleId($capsule->company_id, $capsule->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
                        'topic_uuid'    => $topic->uuid, 
225
                        'capsule_uuid'    => $capsule->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
                                'topic_uuid'    => $topic->uuid,
250
                                'capsule_uuid'    => $capsule->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
                                'topic_uuid'    => $topic->uuid,
255
                                'capsule_uuid'    => $capsule->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', ['topic_uuid' => $topic->uuid] )  : '', 
273
                        'link_add' => $allowAdd ? $this->url()->fromRoute('microlearning/content/capsules/add', ['capsule_uuid' => $capsule->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
        $topic_uuid = $this->params()->fromRoute('topic_uuid');
323
        $capsule_uuid = $this->params()->fromRoute('capsule_uuid');
324
        
324
        
325
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
325
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
326
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
326
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
327
        if(!$topic) {
327
        if(!$capsule) {
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($topic->company_id != $currentCompany->id) {
334
        if($capsule->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 = $topic->company_id;
355
                $capsule->company_id = $capsule->company_id;
356
                $capsule->topic_id = $topic->id;
356
                $capsule->capsule_id = $capsule->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
                    
-
 
371
                    $files = $this->getRequest()->getFiles()->toArray();
-
 
372
 
-
 
373
                    $fileBase64Content = $this->params()->fromPost('file');
-
 
374
                    try {
-
 
375
                        
-
 
376
                        $fileBase64Content = base64_decode($fileBase64Content);
-
 
377
                        $target_path = $this->config['leaderslinked.fullpath.microlearning_capsule'] . $capsule->uuid;
-
 
378
                        $capsule_filename      = 'capsule-' .uniqid() . '.png';
-
 
379
                        $capsule_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp';
-
 
380
                        if(!file_exists($capsule_tmp_filename)) {
-
 
381
                            mkdir($capsule_tmp_filename, 0755, true);
-
 
382
                        }
-
 
383
                        $capsule_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $capsule_filename;
-
 
384
                            file_put_contents($capsule_tmp_filename, $fileBase64Content);
-
 
385
                        
-
 
386
                        list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.microlearning_image_size']);
-
 
387
 
-
 
388
                        $crop_to_dimensions = false;
-
 
389
                        if(Image::uploadImage($capsule_tmp_filename, $target_path, $capsule_filename, $target_width, $target_height, $crop_to_dimensions )) {
-
 
390
                            $capsule->file = basename($capsule_filename);
-
 
391
                            $capsuleMapper->update($capsule);
-
 
392
                        }
-
 
393
                    } catch(\Throwable $e) {
-
 
394
                        error_log($e->getTraceAsString());
-
 
395
                    }       
-
 
396
 
370
                    
397
 
371
                    $files = $this->getRequest()->getFiles()->toArray();
398
                    /*
372
                    if(isset($files['file']) && empty($files['file']['error'])) {
399
                    if(isset($files['file']) && empty($files['file']['error'])) {
Línea 373... Línea 400...
373
                        $tmp_filename  = $files['file']['tmp_name'];
400
                        $tmp_filename  = $files['file']['tmp_name'];
Línea 384... Línea 411...
384
                            }
411
                            }
385
                        } catch(\Throwable $e) {
412
                        } catch(\Throwable $e) {
386
                            error_log($e->getTraceAsString());
413
                            error_log($e->getTraceAsString());
387
                        }
414
                        }
388
                    }
415
                    }
389
                    
-
 
-
 
416
                    */
Línea 390... Línea 417...
390
                    
417
                    
391
                    
418
                    
392
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
419
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
Línea 406... Línea 433...
406
                        } catch(\Throwable $e) {
433
                        } catch(\Throwable $e) {
407
                            error_log($e->getTraceAsString());
434
                            error_log($e->getTraceAsString());
408
                        }
435
                        }
409
                    }
436
                    }
Línea 410... Línea 437...
410
                    
437
                    
Línea 411... Línea 438...
411
                    $this->logger->info('Se agrego la cápsula ' . $topic->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
438
                    $this->logger->info('Se agrego la cápsula ' . $capsule->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
412
                    
439
                    
413
                    $data = [
440
                    $data = [
414
                        'success'   => true,
441
                        'success'   => true,
415
                        'data'   => 'LABEL_RECORD_ADDED'
442
                        'data'   => 'LABEL_RECORD_ADDED'
416
                    ];
443
                    ];
417
                } else {
444
                } else {
418
                    $data = [
445
                    $data = [
419
                        'success'   => false,
446
                        'success'   => false,
Línea 420... Línea 447...
420
                        'data'      => $topicMapper->getError()
447
                        'data'      => $capsuleMapper->getError()
Línea 421... Línea 448...
421
                    ];
448
                    ];
Línea 461... Línea 488...
461
        $currentUserPlugin = $this->plugin('currentUserPlugin');
488
        $currentUserPlugin = $this->plugin('currentUserPlugin');
462
        $currentUser    = $currentUserPlugin->getUser();
489
        $currentUser    = $currentUserPlugin->getUser();
463
        $currentCompany = $currentUserPlugin->getCompany();
490
        $currentCompany = $currentUserPlugin->getCompany();
Línea 464... Línea 491...
464
        
491
        
465
        $request        = $this->getRequest();
492
        $request        = $this->getRequest();
466
        $topic_uuid     = $this->params()->fromRoute('topic_uuid');
493
        $capsule_uuid     = $this->params()->fromRoute('capsule_uuid');
Línea 467... Línea 494...
467
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
494
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
468
        
495
        
469
 
496
 
470
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
497
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
471
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
498
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
472
        if(!$topic) {
499
        if(!$capsule) {
473
            return new JsonModel([
500
            return new JsonModel([
474
                'success'   => false,
501
                'success'   => false,
Línea 475... Línea 502...
475
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
502
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
476
            ]);
503
            ]);
477
        }
504
        }
478
        
505
        
479
        if($topic->company_id != $currentCompany->id) {
506
        if($capsule->company_id != $currentCompany->id) {
480
            return new JsonModel([
507
            return new JsonModel([
Línea 490... Línea 517...
490
                'success'   => false,
517
                'success'   => false,
491
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
518
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
492
            ]);
519
            ]);
493
        }
520
        }
Línea 494... Línea 521...
494
        
521
        
495
        if($capsule->topic_id != $topic->id) {
522
        if($capsule->capsule_id != $capsule->id) {
496
            return new JsonModel([
523
            return new JsonModel([
497
                'success'   => false,
524
                'success'   => false,
498
                'data'   => 'ERROR_UNAUTHORIZED'
525
                'data'   => 'ERROR_UNAUTHORIZED'
499
            ]);
526
            ]);
Línea 546... Línea 573...
546
        $currentUserPlugin = $this->plugin('currentUserPlugin');
573
        $currentUserPlugin = $this->plugin('currentUserPlugin');
547
        $currentUser    = $currentUserPlugin->getUser();
574
        $currentUser    = $currentUserPlugin->getUser();
548
        $currentCompany = $currentUserPlugin->getCompany();
575
        $currentCompany = $currentUserPlugin->getCompany();
Línea 549... Línea 576...
549
 
576
 
550
        $request    = $this->getRequest();
577
        $request    = $this->getRequest();
551
        $topic_uuid     = $this->params()->fromRoute('topic_uuid');
578
        $capsule_uuid     = $this->params()->fromRoute('capsule_uuid');
Línea 552... Línea 579...
552
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
579
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
553
        
580
        
554
        
581
        
555
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
582
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
556
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
583
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
557
        if(!$topic) {
584
        if(!$capsule) {
558
            return new JsonModel([
585
            return new JsonModel([
559
                'success'   => false,
586
                'success'   => false,
Línea 560... Línea 587...
560
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
587
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
561
            ]);
588
            ]);
562
        }
589
        }
563
        
590
        
564
  
591
  
565
        
592
        
Línea 578... Línea 605...
578
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
605
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
579
            ]);
606
            ]);
580
        }
607
        }
Línea 581... Línea 608...
581
        
608
        
582
 
609
 
583
        if($capsule->topic_id != $topic->id) {
610
        if($capsule->capsule_id != $capsule->id) {
584
            return new JsonModel([
611
            return new JsonModel([
585
                'success'   => false,
612
                'success'   => false,
586
                'data'   => 'ERROR_UNAUTHORIZED'
613
                'data'   => 'ERROR_UNAUTHORIZED'
Línea 631... Línea 658...
631
                    if(isset($files['file']) && empty($files['file']['error'])) {
658
                    if(isset($files['file']) && empty($files['file']['error'])) {
632
                        $tmp_filename  = $files['file']['tmp_name'];
659
                        $tmp_filename  = $files['file']['tmp_name'];
633
                        //$filename      = $this->normalizeString($files['file']['name']);
660
                        //$filename      = $this->normalizeString($files['file']['name']);
Línea 634... Línea 661...
634
                        
661
                        
635
                        try {
662
                        try {
Línea 636... Línea 663...
636
                            if($topic->image) {
663
                            if($capsule->image) {
637
                                
664
                                
638
                                if(!image ::delete($target_path, $capsule->image)) {
665
                                if(!image ::delete($target_path, $capsule->image)) {
639
                                    return new JsonModel([
666
                                    return new JsonModel([
Línea 661... Línea 688...
661
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
688
                    if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
662
                        $tmp_filename  = $files['marketplace']['tmp_name'];
689
                        $tmp_filename  = $files['marketplace']['tmp_name'];
663
                        //$filename      = $this->normalizeString($files['marketplace']['name']);
690
                        //$filename      = $this->normalizeString($files['marketplace']['name']);
Línea 664... Línea 691...
664
                        
691
                        
665
                        try {
692
                        try {
Línea 666... Línea 693...
666
                            if($topic->marketplace) {
693
                            if($capsule->marketplace) {
667
                                
694
                                
668
                                if(!image ::delete($target_path, $capsule->marketplace)) {
695
                                if(!image ::delete($target_path, $capsule->marketplace)) {
669
                                    return new JsonModel([
696
                                    return new JsonModel([
Línea 734... Línea 761...
734
        $currentUserPlugin = $this->plugin('currentUserPlugin');
761
        $currentUserPlugin = $this->plugin('currentUserPlugin');
735
        $currentUser    = $currentUserPlugin->getUser();
762
        $currentUser    = $currentUserPlugin->getUser();
736
        $currentCompany = $currentUserPlugin->getCompany();
763
        $currentCompany = $currentUserPlugin->getCompany();
Línea 737... Línea 764...
737
        
764
        
738
        $request        = $this->getRequest();
765
        $request        = $this->getRequest();
739
        $topic_uuid     = $this->params()->fromRoute('topic_uuid');
766
        $capsule_uuid     = $this->params()->fromRoute('capsule_uuid');
740
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
767
        $capsule_uuid   = $this->params()->fromRoute('capsule_uuid');
Línea 741... Línea 768...
741
        $type           = $this->params()->fromRoute('type'); 
768
        $type           = $this->params()->fromRoute('type'); 
742
        
769
        
743
        
770
        
744
        $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
771
        $capsuleMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
745
        $topic = $topicMapper->fetchOneByUuid($topic_uuid);
772
        $capsule = $capsuleMapper->fetchOneByUuid($capsule_uuid);
746
        if(!$topic) {
773
        if(!$capsule) {
747
            return new JsonModel([
774
            return new JsonModel([
748
                'success'   => false,
775
                'success'   => false,
Línea 749... Línea 776...
749
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
776
                'data'   => 'ERROR_TOPIC_NOT_FOUND'
750
            ]);
777
            ]);
751
        }
778
        }
752
        
779
        
753
        if($topic->company_id != $currentCompany->id) {
780
        if($capsule->company_id != $currentCompany->id) {
754
            return new JsonModel([
781
            return new JsonModel([
Línea 764... Línea 791...
764
                'success'   => false,
791
                'success'   => false,
765
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
792
                'data'   => 'ERROR_CAPSULE_NOT_FOUND'
766
            ]);
793
            ]);
767
        }
794
        }
Línea 768... Línea 795...
768
        
795
        
769
        if($capsule->topic_id != $topic->id) {
796
        if($capsule->capsule_id != $capsule->id) {
770
            return new JsonModel([
797
            return new JsonModel([
771
                'success'   => false,
798
                'success'   => false,
772
                'data'   => 'ERROR_UNAUTHORIZED'
799
                'data'   => 'ERROR_UNAUTHORIZED'
773
            ]);
800
            ]);
Línea 781... Línea 808...
781
            $select = $sql->select();
808
            $select = $sql->select();
782
            $select->columns(['access', 'paid_from', 'paid_to', 'added_on']);
809
            $select->columns(['access', 'paid_from', 'paid_to', 'added_on']);
783
            $select->from(['tb1' => CompanyMicrolearningCapsuleUserMapper::_TABLE] );
810
            $select->from(['tb1' => CompanyMicrolearningCapsuleUserMapper::_TABLE] );
784
            $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']);
785
            $select->where->equalTo('tb1.company_id', $capsule->company_id);
812
            $select->where->equalTo('tb1.company_id', $capsule->company_id);
786
            $select->where->equalTo('tb1.topic_id', $capsule->topic_id);
813
            $select->where->equalTo('tb1.capsule_id', $capsule->capsule_id);
787
            $select->where->equalTo('tb1.capsule_id', $capsule->id);
814
            $select->where->equalTo('tb1.capsule_id', $capsule->id);
Línea 788... Línea 815...
788
            
815
            
789
            if($type == 'active') {
816
            if($type == 'active') {
790
                $now = date('Y-m-d H:i:s');
817
                $now = date('Y-m-d H:i:s');
Línea 861... Línea 888...
861
            }
888
            }
Línea 862... Línea 889...
862
            
889
            
863
            return new JsonModel([
890
            return new JsonModel([
864
                'success' => true,
891
                'success' => true,
865
                'data' => [
892
                'data' => [
866
                    'topic' => $topic->name,
893
                    'capsule' => $capsule->name,
867
                    'capsule' => $capsule->name,
894
                    'capsule' => $capsule->name,
868
                    'items' => $items, 
895
                    'items' => $items, 
869
                ]    
896
                ]