Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 16769 Rev 17002
Línea 330... Línea 330...
330
            $form->setData($dataPost);
330
            $form->setData($dataPost);
Línea 331... Línea 331...
331
            
331
            
332
            if($form->isValid()) {
332
            if($form->isValid()) {
Línea -... Línea 333...
-
 
333
                $dataPost = (array) $form->getData();
-
 
334
                
Línea 333... Línea -...
333
                $dataPost = (array) $form->getData();
-
 
334
                
-
 
335
                
-
 
336
                list($target_width, $target_height) = explode('x', $theme->imagesize_moodle);
-
 
337
                $path = $this->config['leaderslinked.fullpath.network'];
-
 
338
                
-
 
339
                $target_path = $path . $currentNetwork->uuid;
-
 
Línea 340... Línea 335...
340
                if(!file_exists($target_path)) {
335
                $image = Image::getInstance($this->config);
341
                    mkdir($target_path, 0755, true);
336
                $target_path = $image->getStorage()->getPathNetwork();
Línea 342... Línea 337...
342
                }
337
                
343
                
338
                
344
                
339
                
345
                $files         = $this->getRequest()->getFiles()->toArray();
340
                $files         = $this->getRequest()->getFiles()->toArray();
346
                $tmp_filename  = $files['file']['tmp_name'];
341
                $tmp_filename  = $files['file']['tmp_name'];
347
   
342
   
348
               try {
343
               try {
349
                    if($network->logo) {
344
                    if($network->logo) {
350
                       if(!image ::delete($target_path, $network->logo)) {
345
                       if(!$image->getStorage()->deleteFile($target_path, $network->uuid, $network->logo)) {
Línea 351... Línea -...
351
                            return new JsonModel([
-
 
-
 
346
                            return new JsonModel([
352
                                'success'   => false,
347
                                'success'   => false,
353
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
348
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
-
 
349
                            ]);
-
 
350
                        }
354
                            ]);
351
                    }
355
                        }
352
                        
356
                    }
-
 
357
                        
353
                    list($target_width, $target_height) = explode('x', $theme->imagesize_moodle);
358
                        
354
                    $filename = 'logo.png';
359
                    $filename = 'logo.png';
355
                    $crop_to_dimensions = false;
360
                    $crop_to_dimensions = false;
356
                    $unlink_source = true; 
Línea 455... Línea 451...
455
            $form->setData($dataPost);
451
            $form->setData($dataPost);
Línea 456... Línea 452...
456
            
452
            
457
            if($form->isValid()) {
453
            if($form->isValid()) {
Línea 458... Línea -...
458
                $dataPost = (array) $form->getData();
-
 
459
                
-
 
460
                
454
                $dataPost = (array) $form->getData();
461
                list($target_width, $target_height) = explode('x', $theme->imagesize_navbar);
-
 
462
                $path = $this->config['leaderslinked.fullpath.network'];
455
                
463
                
-
 
464
                $target_path = $path . $currentNetwork->uuid;
-
 
465
                if(!file_exists($target_path)) {
-
 
Línea 466... Línea 456...
466
                    mkdir($target_path, 0755, true);
456
                $image = Image::getInstance($this->config);
467
                }
457
                $target_path = $image->getStorage()->getPathNetwork();
Línea 468... Línea 458...
468
                
458
                
469
                
459
                
470
                $files         = $this->getRequest()->getFiles()->toArray();
460
                $files         = $this->getRequest()->getFiles()->toArray();
471
                $tmp_filename  = $files['file']['tmp_name'];
461
                $tmp_filename  = $files['file']['tmp_name'];
472
                
462
                
473
                try {
463
                try {
474
                    if($network->navbar) {
464
                    if($network->navbar) {
475
                        if(!image ::delete($target_path, $network->navbar)) {
465
                        if(!$image->getStorage()->deleteFile($target_path, $network->uuid, $network->navbar)) {
476
                            return new JsonModel([
466
                            return new JsonModel([
Línea 477... Línea -...
477
                                'success'   => false,
-
 
-
 
467
                                'success'   => false,
478
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
468
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
479
                            ]);
469
                            ]);
-
 
470
                        }
-
 
471
                    }
480
                        }
472
                    
481
                    }
473
                    list($target_width, $target_height) = explode('x', $theme->imagesize_navbar);
482
                    
-
 
483
                    
474
                    $filename = 'navbar.png';
484
                    $filename = 'navbar.png';
475
                    $crop_to_dimensions = false;
485
                    $crop_to_dimensions = false;
476
                    $unlink_source = true;
486
                    if(Image::uploadImage($tmp_filename, $target_path, $filename, $target_width, $target_height, $crop_to_dimensions)) {
477
                    
Línea 581... Línea 572...
581
            
572
            
582
            if($form->isValid()) {
573
            if($form->isValid()) {
Línea 583... Línea 574...
583
                $dataPost = (array) $form->getData();
574
                $dataPost = (array) $form->getData();
584
                
575
                
585
                
576
                
586
                list($target_width, $target_height) = explode('x', $theme->imagesize_favico);
-
 
587
                $path = $this->config['leaderslinked.fullpath.network'];
-
 
588
                
-
 
589
                $target_path = $path . $currentNetwork->uuid;
-
 
Línea 590... Línea 577...
590
                if(!file_exists($target_path)) {
577
                $image = Image::getInstance($this->config);
591
                    mkdir($target_path, 0755, true);
578
                $target_path = $image->getStorage()->getPathNetwork();
Línea 592... Línea 579...
592
                }
579
 
593
                
580
                
594
                
581
                
595
                $files         = $this->getRequest()->getFiles()->toArray();
582
                $files         = $this->getRequest()->getFiles()->toArray();
596
                $tmp_filename  = $files['file']['tmp_name'];
583
                $tmp_filename  = $files['file']['tmp_name'];
597
                
584
                
598
                try {
585
                try {
599
                    if($network->favico) {
586
                    if($network->favico) {
600
                        if(!image ::delete($target_path, $network->favico)) {
587
                        if(!$image->getStorage()->deleteFile($target_path, $network->uuid, $network->favico)) {
Línea 601... Línea -...
601
                            return new JsonModel([
-
 
-
 
588
                            return new JsonModel([
602
                                'success'   => false,
589
                                'success'   => false,
603
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
590
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
-
 
591
                            ]);
-
 
592
                        }
604
                            ]);
593
                    }
605
                        }
594
                    
606
                    }
-
 
607
                    
595
                    list($target_width, $target_height) = explode('x', $theme->imagesize_favico);
608
                    
596
                    $filename = 'favico.png';
609
                    $filename = 'favico.png';
597
                    $crop_to_dimensions = false;
610
                    $crop_to_dimensions = false;
598
                    $unlink_source = true;
Línea 817... Línea 805...
817
            $form->setData($dataPost);
805
            $form->setData($dataPost);
Línea 818... Línea 806...
818
            
806
            
819
            if($form->isValid()) {
807
            if($form->isValid()) {
Línea 820... Línea -...
820
                $dataPost = (array) $form->getData();
-
 
821
                
-
 
822
                
808
                $dataPost = (array) $form->getData();
823
                list($target_width, $target_height) = explode('x', $theme->imagesize_moodle);
-
 
824
                $path = $this->config['leaderslinked.fullpath.network'];
809
                
825
                
-
 
826
                $target_path = $path . $currentNetwork->uuid;
-
 
827
                if(!file_exists($target_path)) {
-
 
Línea 828... Línea 810...
828
                    mkdir($target_path, 0755, true);
810
                $image = Image::getInstance($this->config);
829
                }
811
                $target_path =  $image->getStorage()->getPathNetwork();
Línea 830... Línea 812...
830
                
812
                
831
                
813
                
832
                $files         = $this->getRequest()->getFiles()->toArray();
814
                $files         = $this->getRequest()->getFiles()->toArray();
833
                $tmp_filename  = $files['file']['tmp_name'];
815
                $tmp_filename  = $files['file']['tmp_name'];
834
                
816
                
835
                try {
817
                try {
836
                    if($network->moodle_image) {
818
                    if($network->moodle_image) {
837
                        if(!image ::delete($target_path, $network->logo)) {
819
                        if(!$image->getStorage()->deleteFile($target_path, $network->uuid, $network->logo)) {
838
                            return new JsonModel([
820
                            return new JsonModel([
Línea 839... Línea 821...
839
                                'success'   => false,
821
                                'success'   => false,
-
 
822
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
840
                                'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
823
                            ]);
-
 
824
                        }
-
 
825
                    }
841
                            ]);
826
                    
842
                        }
827
                    
843
                    }
828
                    $filename = 'moodle.png';
844
                    
829
                    list($target_width, $target_height) = explode('x', $theme->imagesize_moodle);
845
                    
830
                    $crop_to_dimensions = false;
846
                    $filename = 'moodle.png';
831
                    $unlink_source = true;