Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 17236 Rev 17241
Línea 319... Línea 319...
319
        $dataPost = (array) $form->getData();
319
        $dataPost = (array) $form->getData();
Línea 320... Línea 320...
320
        
320
        
321
        $capsule = new MicrolearningCapsule();
321
        $capsule = new MicrolearningCapsule();
322
        $capsule->name = $dataPost['name'];
322
        $capsule->name = $dataPost['name'];
323
        $capsule->description = $dataPost['description'];
-
 
324
        $capsule->status = $dataPost['status'];
-
 
325
        $capsule->privacy = $dataPost['privacy'];
-
 
326
        $capsule->type = $dataPost['type'];
-
 
327
        $capsule->cost = $dataPost['cost'];
323
        $capsule->description = $dataPost['description'];
328
        $capsule->company_id = $currentCompany->id;
324
        $capsule->company_id = $currentCompany->id;
Línea 329... Línea 325...
329
        $capsule->image = '';
325
        $capsule->image = '';
Línea 516... Línea 512...
516
            $data = [
512
            $data = [
517
                'success' => true,
513
                'success' => true,
518
                'data' => [
514
                'data' => [
519
                    'name' => $capsule->name,
515
                    'name' => $capsule->name,
520
                    'description' => $capsule->description,
516
                    'description' => $capsule->description,
521
                    'status' => $capsule->status,
-
 
522
                    'privacy' => $capsule->privacy,
-
 
523
                    'type' => $capsule->type,
-
 
524
                    'cost' => $capsule->cost,
-
 
525
                    'image' => $storage->getGenericImage($path, $capsule->uuid, $capsule->image)
517
                    'image' => $storage->getGenericImage($path, $capsule->uuid, $capsule->image)
526
                ]
518
                ]
527
            ];
519
            ];
Línea 528... Línea 520...
528
            
520
            
Línea 537... Línea 529...
537
            if($form->isValid()) {
529
            if($form->isValid()) {
538
                $dataPost = (array) $form->getData();
530
                $dataPost = (array) $form->getData();
Línea 539... Línea 531...
539
                
531
                
540
                $capsule->name = $dataPost['name'];
532
                $capsule->name = $dataPost['name'];
541
                $capsule->description = $dataPost['description'];
-
 
542
                $capsule->status = $dataPost['status'];
-
 
543
                $capsule->privacy = $dataPost['privacy'];
-
 
544
                $capsule->type = $dataPost['type'];
-
 
545
                $capsule->cost = $dataPost['cost'];
533
                $capsule->description = $dataPost['description'];
Línea 546... Línea 534...
546
                $capsule->image = '';
534
                $capsule->image = '';
547
                
535
                
548
                if(!$capsuleMapper->update($capsule)) {
536
                if(!$capsuleMapper->update($capsule)) {
Línea 593... Línea 581...
593
                    return new JsonModel([
581
                    return new JsonModel([
594
                        'success'   => false,
582
                        'success'   => false,
595
                        'data'      => $capsuleMapper->getError()
583
                        'data'      => $capsuleMapper->getError()
596
                    ]);
584
                    ]);
597
                }
585
                }
598
             
-
 
599
                /* if(isset($files['marketplace']) && empty($files['marketplace']['error'])) {
-
 
600
                    
-
 
601
                    
-
 
602
                    
-
 
603
                    $tmp_filename  = $files['marketplace']['tmp_name'];
-
 
604
                    // $filename      = \LeadersLinked\Library\Functions::normalizeStringFilename($files['file']['name']);
-
 
605
                    
-
 
606
                    try {
-
 
607
                        if($capsule->marketplace) {
-
 
608
                            
-
 
609
                            if(!$image->getStorage()->deleteFile($target_path, $capsule->uuid, $capsule->marketplace)) {
-
 
610
                                return new JsonModel([
-
 
611
                                    'success'   => false,
-
 
612
                                    'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
-
 
613
                                ]);
-
 
614
                            }
-
 
615
                        }
-
 
616
                        
-
 
617
                        list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.marketplace']);
-
 
618
                        
-
 
619
                        $filename = 'marketplace-' .uniqid() . '.jpg';
-
 
620
                        $crop_to_dimensions = false;
-
 
621
                        $unlink_source = true;
-
 
622
                        
-
 
623
                        if($image->uploadProcessChangeSize($tmp_filename, $target_path, $capsule->uuid, $filename, $target_width, $target_height, $crop_to_dimensions, $unlink_source)) {
-
 
624
                     
-
 
625
                            $capsule->marketplace = $filename;
-
 
626
                            $capsuleMapper->update($capsule);
-
 
627
                        }
-
 
628
                    } catch(\Throwable $e) {
-
 
629
                        error_log($e->getTraceAsString());
-
 
630
                    }
-
 
631
                } */
-
 
Línea 632... Línea 586...
632
               
586
               
Línea 633... Línea 587...
633
                $this->logger->info('Se edito la cápsula ' . $capsule->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
587
                $this->logger->info('Se edito la cápsula ' . $capsule->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
634
                
588