| Línea 15... |
Línea 15... |
| 15 |
use Laminas\Mvc\Controller\AbstractActionController;
|
15 |
use Laminas\Mvc\Controller\AbstractActionController;
|
| 16 |
use Laminas\Log\LoggerInterface;
|
16 |
use Laminas\Log\LoggerInterface;
|
| 17 |
use Laminas\View\Model\ViewModel;
|
17 |
use Laminas\View\Model\ViewModel;
|
| 18 |
use Laminas\View\Model\JsonModel;
|
18 |
use Laminas\View\Model\JsonModel;
|
| 19 |
use LeadersLinked\Library\Functions;
|
19 |
use LeadersLinked\Library\Functions;
|
| 20 |
use LeadersLinked\Library\Image;
|
- |
|
| 21 |
use LeadersLinked\Mapper\KnowledgeAreaCategoryMapper;
|
20 |
use LeadersLinked\Mapper\KnowledgeAreaCategoryMapper;
|
| 22 |
use LeadersLinked\Mapper\KnowledgeAreaCategoryUserMapper;
|
21 |
use LeadersLinked\Mapper\KnowledgeAreaCategoryUserMapper;
|
| 23 |
use LeadersLinked\Mapper\UserMapper;
|
22 |
use LeadersLinked\Mapper\UserMapper;
|
| 24 |
use LeadersLinked\Model\KnowledgeAreaCategory;
|
23 |
use LeadersLinked\Model\KnowledgeAreaCategory;
|
| 25 |
use LeadersLinked\Model\KnowledgeAreaCategoryUser;
|
24 |
use LeadersLinked\Model\KnowledgeAreaCategoryUser;
|
| Línea 348... |
Línea 347... |
| 348 |
|
347 |
|
| 349 |
$knowledgeAreaContentMapper = KnowledgeAreaContentMapper::getInstance($this->adapter);
|
348 |
$knowledgeAreaContentMapper = KnowledgeAreaContentMapper::getInstance($this->adapter);
|
| 350 |
if ($knowledgeAreaContentMapper->insert($knowledgeAreaContent)) {
|
349 |
if ($knowledgeAreaContentMapper->insert($knowledgeAreaContent)) {
|
| Línea 351... |
Línea -... |
| 351 |
$knowledgeAreaContent = $knowledgeAreaContentMapper->fetchOne($knowledgeAreaContent->id);
|
- |
|
| 352 |
|
- |
|
| 353 |
//$target_size = $this->config['leaderslinked.image_sizes.knowledge_area'];
|
- |
|
| 354 |
//list($target_width, $target_height) = explode('x', $target_size);
|
- |
|
| 355 |
|
- |
|
| 356 |
|
350 |
$knowledgeAreaContent = $knowledgeAreaContentMapper->fetchOne($knowledgeAreaContent->id);
|
| 357 |
$image = Image::getInstance($this->config);
|
- |
|
| 358 |
$storage = Storage::getInstance($this->config, $this->adapter);
|
- |
|
| 359 |
|
351 |
|
| 360 |
|
- |
|
| 361 |
$target_path = $storage->getPathKnowledgeArea();
|
- |
|
| Línea 362... |
Línea 352... |
| 362 |
|
352 |
$storage = Storage::getInstance($this->config, $this->adapter);
|
| Línea 363... |
Línea -... |
| 363 |
|
- |
|
| 364 |
|
353 |
$target_path = $storage->getPathKnowledgeArea();
|
| 365 |
$files = $this->getRequest()->getFiles()->toArray();
|
354 |
|
| 366 |
|
355 |
$files = $this->getRequest()->getFiles()->toArray();
|
| 367 |
|
356 |
|
| 368 |
if (isset($files['image']) && empty($files['image']['error'])) {
|
- |
|
| Línea -... |
Línea 357... |
| - |
|
357 |
if (isset($files['image']) && empty($files['image']['error'])) {
|
| - |
|
358 |
$tmp_image_name = $files['image']['tmp_name'];
|
| - |
|
359 |
$original_image_name_parts = explode('.', $files['image']['name']);
|
| - |
|
360 |
$final_image_filename = Functions::normalizeString(uniqid() . '-' . $original_image_name_parts[0] . '.png');
|
| - |
|
361 |
|
| 369 |
$tmp_filename = $files['image']['tmp_name'];
|
362 |
$uuid_path_segment = $knowledgeAreaCategory->uuid;
|
| Línea 370... |
Línea -... |
| 370 |
$filename = explode('.', $files['image']['name']);
|
- |
|
| 371 |
$filename = Functions::normalizeString(uniqid() . '-' . $filename[0] . '.png');
|
363 |
$full_target_dir_for_image = $target_path . DIRECTORY_SEPARATOR . $uuid_path_segment;
|
| 372 |
|
364 |
if (!is_dir($full_target_dir_for_image)) {
|
| 373 |
|
365 |
mkdir($full_target_dir_for_image, 0775, true);
|
| 374 |
$full_tmp_filename = $image->uploadProcessWithOutChangeSize($tmp_filename, $filename);
|
- |
|
| 375 |
|
366 |
}
|
| 376 |
if($full_tmp_filename) {
|
- |
|
| 377 |
if($storage->putFile($target_path, $knowledgeAreaCategory->uuid, $full_tmp_filename)) {
|
- |
|
| 378 |
$knowledgeAreaContent->image = $filename;
|
367 |
$full_target_path_for_image = $full_target_dir_for_image . DIRECTORY_SEPARATOR . $final_image_filename;
|
| Línea 379... |
Línea 368... |
| 379 |
$knowledgeAreaContentMapper->update($knowledgeAreaContent);
|
368 |
|
| 380 |
}
|
369 |
if ($storage->uploadImageWithOutChangeSize($tmp_image_name, $full_target_path_for_image)) {
|
| 381 |
}
|
370 |
$knowledgeAreaContent->image = $final_image_filename;
|
| 382 |
|
- |
|
| Línea -... |
Línea 371... |
| - |
|
371 |
$knowledgeAreaContentMapper->update($knowledgeAreaContent);
|
| - |
|
372 |
}
|
| - |
|
373 |
}
|
| - |
|
374 |
|
| - |
|
375 |
if (isset($files['attachment']) && empty($files['attachment']['error'])) {
|
| - |
|
376 |
$tmp_attachment_name = $files['attachment']['tmp_name'];
|
| - |
|
377 |
$final_attachment_filename = Functions::normalizeString($files['attachment']['name']);
|
| 383 |
|
378 |
|
| 384 |
}
|
379 |
$uuid_path_segment = $knowledgeAreaCategory->uuid;
|
| 385 |
|
380 |
$full_target_dir_for_attachment = $target_path . DIRECTORY_SEPARATOR . $uuid_path_segment;
|
| 386 |
if (isset($files['attachment']) && empty($files['attachment']['error'])) {
|
381 |
if (!is_dir($full_target_dir_for_attachment)) {
|
| 387 |
$tmp_filename = $files['attachment']['tmp_name'];
|
382 |
mkdir($full_target_dir_for_attachment, 0775, true);
|
| Línea 645... |
Línea 640... |
| 645 |
$knowledgeAreaContent->description = $dataPost['description'];
|
640 |
$knowledgeAreaContent->description = $dataPost['description'];
|
| Línea 646... |
Línea 641... |
| 646 |
|
641 |
|
| Línea 647... |
Línea -... |
| 647 |
|
- |
|
| 648 |
if ($knowledgeAreaContentMapper->update($knowledgeAreaContent)) {
|
- |
|
| 649 |
|
- |
|
| 650 |
//$target_size = $this->config['leaderslinked.image_sizes.knowledge_area'];
|
- |
|
| 651 |
//list($target_width, $target_height) = explode('x', $target_size);
|
- |
|
| 652 |
|
642 |
|
| 653 |
|
643 |
if ($knowledgeAreaContentMapper->update($knowledgeAreaContent)) {
|
| Línea 654... |
Línea 644... |
| 654 |
$image = Image::getInstance($this->config);
|
644 |
|
| Línea 655... |
Línea 645... |
| 655 |
$storage = Storage::getInstance($this->config, $this->adapter);
|
645 |
$storage = Storage::getInstance($this->config, $this->adapter);
|
| Línea 656... |
Línea 646... |
| 656 |
$target_path = $image->getStorage()->getPathKnowledgeArea();
|
646 |
$target_path = $storage->getPathKnowledgeArea();
|
| 657 |
|
647 |
|
| 658 |
$files = $this->getRequest()->getFiles()->toArray();
|
648 |
$files = $this->getRequest()->getFiles()->toArray();
|
| Línea 659... |
Línea 649... |
| 659 |
|
649 |
|
| 660 |
|
650 |
|
| 661 |
if (isset($files['image']) && empty($files['image']['error'])) {
|
651 |
if (isset($files['image']) && empty($files['image']['error'])) {
|
| Línea -... |
Línea 652... |
| - |
|
652 |
|
| - |
|
653 |
|
| - |
|
654 |
if ($knowledgeAreaContent->image) {
|
| - |
|
655 |
$storage->deleteFile($target_path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->image);
|
| - |
|
656 |
}
|
| 662 |
|
657 |
|
| Línea 663... |
Línea -... |
| 663 |
|
- |
|
| 664 |
if ($knowledgeAreaContent->image) {
|
658 |
|
| 665 |
$image->getStorage()->deleteFile($target_path, $knowledgeAreaContent->uuid, $knowledgeAreaContent->image);
|
659 |
$tmp_image_name = $files['image']['tmp_name'];
|
| 666 |
}
|
660 |
$original_image_name_parts = explode('.', $files['image']['name']);
|
| 667 |
|
- |
|
| 668 |
|
661 |
$final_image_filename = Functions::normalizeString(uniqid() . '-' . $original_image_name_parts[0] . '.png');
|
| Línea 669... |
Línea 662... |
| 669 |
$tmp_filename = $files['image']['tmp_name'];
|
662 |
|
| Línea 670... |
Línea 663... |
| 670 |
$filename = explode('.', $files['image']['name']);
|
663 |
|
| 671 |
$filename = Functions::normalizeString(uniqid() . '-' . $filename[0] . '.png');
|
664 |
$uuid_path_segment = $knowledgeAreaCategory->uuid;
|
| 672 |
|
665 |
$full_target_dir_for_image = $target_path . DIRECTORY_SEPARATOR . $uuid_path_segment;
|
| Línea 673... |
Línea 666... |
| 673 |
|
666 |
if (!is_dir($full_target_dir_for_image)) {
|
| 674 |
$full_tmp_filename = $image->uploadProcessWithOutChangeSize($tmp_filename, $filename);
|
667 |
mkdir($full_target_dir_for_image, 0775, true);
|
| - |
|
668 |
}
|
| - |
|
669 |
$full_target_path_for_image = $full_target_dir_for_image . DIRECTORY_SEPARATOR . $final_image_filename;
|
| - |
|
670 |
|
| - |
|
671 |
if ($storage->uploadImageWithOutChangeSize($tmp_image_name, $full_target_path_for_image)) {
|
| - |
|
672 |
$knowledgeAreaContent->image = $final_image_filename;
|
| - |
|
673 |
$knowledgeAreaContentMapper->update($knowledgeAreaContent);
|
| 675 |
|
674 |
}
|
| - |
|
675 |
|
| Línea 676... |
Línea 676... |
| 676 |
if($full_tmp_filename) {
|
676 |
}
|
| 677 |
if($storage->putFile($target_path, $knowledgeAreaCategory->uuid, $full_tmp_filename)) {
|
677 |
|
| 678 |
$knowledgeAreaContent->image = $filename;
|
678 |
if (isset($files['attachment']) && empty($files['attachment']['error'])) {
|
| 679 |
$knowledgeAreaContentMapper->update($knowledgeAreaContent);
|
679 |
$tmp_attachment_name = $files['attachment']['tmp_name'];
|
| 680 |
}
|
680 |
$final_attachment_filename = Functions::normalizeString($files['attachment']['name']);
|