Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blade conversion #2602

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Domain/Canvas/Controllers/EditCanvasComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ public function post($params)
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas' . '/editCanvasComment/' . $_GET['id']);
}

$this->tpl->assign('id', $_GET['id']);
$this->tpl->assign('canvasTypes', $this->canvasRepo->getCanvasTypes());
$this->tpl->assign('canvasItem', $this->canvasRepo->getSingleCanvasItem($_GET['id']));
return $this->tpl->displayPartial(static::CANVAS_NAME . 'canvas.canvasComment');
Expand Down
6 changes: 6 additions & 0 deletions app/Domain/Goalcanvas/Controllers/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ public function run()
}
}

$filter['status'] = $_GET['filter_status'] ?? (session("filter_status") ?? 'all');
muhtasimhafiz marked this conversation as resolved.
Show resolved Hide resolved
session(["filter_status" => $filter['status']]);
$filter['relates'] = $_GET['filter_relates'] ?? (session("filter_relates") ?? 'all');
session(["filter_relates" => $filter['relates']]);

$this->tpl->assign('filter', $filter);
$this->tpl->assign('currentCanvas', $currentCanvasId);
$this->tpl->assign('goalStats', $goalAnalytics);
$this->tpl->assign('canvasIcon', $this->canvasRepo->getIcon());
Expand Down
57 changes: 55 additions & 2 deletions app/Domain/Goalcanvas/Controllers/DelCanvas.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,69 @@
<?php

/**
* Controller / Delete Canvas
* delCanvas class - Generic canvas controller / Delete Canvas
*/

namespace Leantime\Domain\Goalcanvas\Controllers {

use Leantime\Core\Controller;
use Leantime\Domain\Auth\Models\Roles;
use Leantime\Domain\Auth\Services\Auth;
use Illuminate\Support\Str;
use Leantime\Core\Frontcontroller;

/**
*
*/
class DelCanvas extends \Leantime\Domain\Canvas\Controllers\DelCanvas
class DelCanvas extends Controller
{
/**
* Constant that must be redefined
*/
protected const CANVAS_NAME = 'goal';

private mixed $canvasRepo;

/**
* init - initialize private variables
*/
public function init()
{
$canvasName = Str::studly(static::CANVAS_NAME) . 'canvas';
$repoName = app()->getNamespace() . "Domain\\$canvasName\\Repositories\\$canvasName";
$this->canvasRepo = app()->make($repoName);
}

/**
* run - display template and edit data
*
* @access public
*/
public function run()
{

Auth::authOrRedirect([Roles::$owner, Roles::$admin, Roles::$manager, Roles::$editor]);

if (isset($_POST['del']) && isset($_GET['id'])) {
$id = (int)($_GET['id']);
$this->canvasRepo->deleteCanvas($id);

$allCanvas = $this->canvasRepo->getAllCanvas(session("currentProject"));
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $allCanvas[0]['id'] ?? -1]);

$this->tpl->setNotification($this->language->__('notification.board_deleted'), 'success', strtoupper(static::CANVAS_NAME) . 'canvas_deleted');

$allCanvas = $this->canvasRepo->getAllCanvas(session("currentProject"));

//Create default canvas.
if (!$allCanvas || count($allCanvas) == 0) {
return Frontcontroller::redirect(BASE_URL . '/strategy/showBoards');
} else {
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas');
}
}

return $this->tpl->displayPartial(static::CANVAS_NAME . 'canvas.delCanvas');
}
}
}
46 changes: 43 additions & 3 deletions app/Domain/Goalcanvas/Controllers/DelCanvasItem.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,57 @@
<?php

/**
* Controller / Delete Canvas Item
* delCanvasItem class - Generic canvas controller / Delete Canvas Item
*/

namespace Leantime\Domain\Goalcanvas\Controllers {

use Leantime\Core\Controller;
use Leantime\Domain\Auth\Models\Roles;
use Leantime\Domain\Auth\Services\Auth;
use Illuminate\Support\Str;
use Leantime\Core\Frontcontroller;

/**
*
*/
class DelCanvasItem extends \Leantime\Domain\Canvas\Controllers\DelCanvasItem
class DelCanvasItem extends Controller
{
/**
* Constant that must be redefined
*/
protected const CANVAS_NAME = 'goal';
}

muhtasimhafiz marked this conversation as resolved.
Show resolved Hide resolved
private mixed $canvasRepo;

/**
* init - initialize private variables
*/
public function init()
{
$canvasName ='goalcanvas';
$repoName = app()->getNamespace() . "Domain\\goalcanvas\\Repositories\\goalcanvas";
$this->canvasRepo = app()->make($repoName);
}

/**
* run - display template and edit data
*
* @access public
*/
public function run()
{
Auth::authOrRedirect([Roles::$owner, Roles::$admin, Roles::$manager, Roles::$editor]);

if (isset($_POST['del']) && isset($_GET['id'])) {
$id = (int)($_GET['id']);
$this->canvasRepo->delCanvasItem($id);

$this->tpl->setNotification($this->language->__('notification.element_deleted'), 'success', strtoupper(static::CANVAS_NAME) . 'canvasitem_deleted');
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas');
}

return $this->tpl->displayPartial(static::CANVAS_NAME . 'canvas.delCanvasItem');
}
}
}
Loading