Skip to content

Commit

Permalink
Merge branch '4.0-dev' into idea-wall-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ctanveer authored Dec 3, 2024
2 parents da6efce + 12329a7 commit ee059c7
Show file tree
Hide file tree
Showing 12 changed files with 837 additions and 357 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,8 @@ config/.env
caddy
frankenphp
frankenphp-worker.php
storage/event_cache.json
config/_configuration.php
.idea/codebuddy.xml
.codebuddy/summary.md

1 change: 1 addition & 0 deletions .idea/codeception.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .idea/leantime-oss.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions app/Domain/Files/Hxcontrollers/FileManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace Leantime\Domain\Files\Hxcontrollers;

use Leantime\Domain\Files\Repositories\Files as FileRepository;
use Leantime\Domain\Files\Services\Files as FileService;

use Leantime\Core\Controller\HtmxController;



class FileManager extends HtmxController
{

protected static string $view = 'files::components.file-manager';


private FileRepository $filesRepo;
private FileService $filesService;
/**
* Controller constructor
*
*/
public function init(FileRepository $filesRepo, FileService $filesService): void
{
$this->filesRepo = $filesRepo;
$this->filesService = $filesService;
}



public function get($params): void
{
$module = $params['module'];
$moduleId = $params['moduleId'];
$currentModule = session('currentProject');


if ($module === 'project') {
$moduleId = session('currentProject');
}

if (isset($_POST['upload']) || isset($_FILES['file'])) {
if (isset($_FILES['file'])) {
$this->filesRepo->upload($_FILES, $module, session('currentProject'));
// $this->tpl->setNotification('notifications.file_upload_success', 'success', 'file_created');
} else {
// $this->tpl->setNotification('notifications.file_upload_error', 'error');
}
}

if (isset($_GET['delFile']) === true) {
$result = $this->filesService->deleteFile($_GET['delFile']);

if ($result === true) {
// $this->tpl->setNotification($this->language->__('notifications.file_deleted'), 'success', 'file_deleted');

// return Frontcontroller::redirect(BASE_URL . '/files/showAll' . ($_GET['modalPopUp'] ?? '') ? '?modalPopUp=true' : '');
} else {
// $this->tpl->setNotification($result['msg'], 'success');
}
}


$this->tpl->assign('currentModule', $currentModule);
$this->tpl->assign('moduleId', $moduleId);
$this->tpl->assign('module', $module);
$this->tpl->assign('modules', $this->filesRepo->getModules(session('userdata.id')));
$this->tpl->assign('imgExtensions', ['jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv', 'webpe']);
$this->tpl->assign('files', $this->filesRepo->getFilesByModule($module, $moduleId));
}
}
27 changes: 27 additions & 0 deletions app/Domain/Files/Hxcontrollers/FileUpload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Leantime\Domain\Files\Hxcontrollers;

use Leantime\Core\Controller\HtmxController;


class FileUpload extends HtmxController
{
protected static string $view = 'goalcanvas::components.canvas';

/**
* Controller constructor
*
*/
public function init(): void
{

}



public function get($params): void
{

}
}
Loading

0 comments on commit ee059c7

Please sign in to comment.