Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 5655 Rev 5914
Línea 245... Línea 245...
245
                
245
                
246
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
246
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
247
                if($topicMapper->insert($topic)) {
247
                if($topicMapper->insert($topic)) {
248
                    $topic = $topicMapper->fetchOne($topic->id);
248
                    $topic = $topicMapper->fetchOne($topic->id);
249
                    $fileBase64Content = $this->params()->fromPost('file');
-
 
-
 
249
                    $fileBase64Content = $this->params()->fromPost('file');
250
                    //leaderslinked.fullpath.recruitment_selection/uuid vacante/uuid candidato 
250
 
Línea 251... Línea 251...
251
                    try {
251
                    try {
252
                       
252
                       
253
                        $fileBase64Content = base64_decode($fileBase64Content);
253
                        $fileBase64Content = base64_decode($fileBase64Content);
Línea 267... Línea 267...
267
                            $topic->image = basename($topic_filename);
267
                            $topic->image = basename($topic_filename);
268
                            $topicMapper->update($topic);
268
                            $topicMapper->update($topic);
269
                        }
269
                        }
270
                    } catch(\Throwable $e) {
270
                    } catch(\Throwable $e) {
271
                        error_log($e->getTraceAsString());
271
                        error_log($e->getTraceAsString());
272
                    }
272
                    }       
273
                    
-
 
274
                  /*  $target_path = $this->config['leaderslinked.fullpath.microlearning_topic'] .  $topic->uuid;
-
 
275
                    if(!file_exists($target_path)) {
-
 
276
                        mkdir($target_path, 0755, true);
-
 
277
                    }
-
 
278
                    
-
 
279
                    
-
 
280
                    $files = $this->getRequest()->getFiles()->toArray();
-
 
281
                    if(isset($files['file']) && empty($files['file']['error'])) {
-
 
282
                        $tmp_filename  = $files['file']['tmp_name'];
-
 
283
 
-
 
284
                        try {
-
 
285
                            list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.microlearning_image_size']);
-
 
286
                            
-
 
287
                            $filename = 'topic-' .uniqid() . '.png';
-
 
288
                            $crop_to_dimensions = true;
-
 
289
                            if(Image::uploadImage($tmp_filename, $target_path, $filename, $target_width, $target_height, $crop_to_dimensions)) {
-
 
290
                                $topic->image = $filename;
-
 
291
                                $topicMapper->update($topic);
-
 
292
                            }
-
 
293
                        } catch(\Throwable $e) {
-
 
294
                            error_log($e->getTraceAsString());
-
 
295
                        }
-
 
296
                    }
-
 
297
                    */
-
 
298
       
-
 
299
                    
-
 
Línea 300... Línea 273...
300
                   
273
                   
Línea 301... Línea 274...
301
                    $this->logger->info('Se agrego el tópico ' . $topic->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
274
                    $this->logger->info('Se agrego el tópico ' . $topic->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
302
                    
275
                    
Línea 459... Línea 432...
459
                'data' => [
432
                'data' => [
460
                    'name' => $topic->name,
433
                    'name' => $topic->name,
461
                    'description' => $topic->description,
434
                    'description' => $topic->description,
462
                    'order' => $topic->order,
435
                    'order' => $topic->order,
463
                    'status' => $topic->status,
436
                    'status' => $topic->status,
-
 
437
                    'image'=> $this->url()->fromRoute('storage', ['type' => 'microlearning-topic', 'code' => $record->uuid, 'filename' => $record->image])
464
                ]
438
                ]
465
            ];
439
            ];
Línea 466... Línea 440...
466
            
440
            
467
            return new JsonModel($data);
441
            return new JsonModel($data);