191111 0158
Этот коммит содержится в:
@@ -12,7 +12,6 @@ class DefaultController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
(new View())->index();
|
||||
$Model = new \MyApp\Model\GroupsModel();
|
||||
$this->htmlResponse((new View())->index());
|
||||
}
|
||||
}
|
||||
|
@@ -3,13 +3,14 @@
|
||||
namespace MyApp\Controller;
|
||||
|
||||
use MyApp\Core\Controller;
|
||||
use MyApp\Core\View;
|
||||
|
||||
class ErrorsController extends Controller
|
||||
{
|
||||
public function get404()
|
||||
{
|
||||
http_response_code(404);
|
||||
echo 404;
|
||||
$this->htmlResponse((new View())->setTitle('404 Page not found')->render('404'),
|
||||
404);
|
||||
}
|
||||
|
||||
public function post404()
|
||||
|
43
src/controllers/GroupsController.php
Обычный файл
43
src/controllers/GroupsController.php
Обычный файл
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace MyApp\Controller;
|
||||
|
||||
use MyApp\Core\Controller;
|
||||
use MyApp\View\GroupsView as View;
|
||||
use MyApp\Service\GroupsService;
|
||||
|
||||
class GroupsController extends Controller
|
||||
{
|
||||
/**
|
||||
* @RouteRegExp = "|^/groups$|"
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->htmlResponse((new View())->index((new GroupsService())->getTableData()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @RouteRegExp = "|^/groups/add$|"
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @RouteRegExp = "|^/groups/edit/(?<id>\d+)$|"
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$group_service = new GroupsService();
|
||||
|
||||
$model = $group_service->getGroup($id);
|
||||
|
||||
if ($model) {
|
||||
$this->htmlResponse((new View())->edit($group_service->getGroup($id),
|
||||
$group_service->getTableData()));
|
||||
} else {
|
||||
$this->redirect('/groups');
|
||||
}
|
||||
}
|
||||
}
|
30
src/controllers/ServersController.php
Обычный файл
30
src/controllers/ServersController.php
Обычный файл
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MyApp\Controller;
|
||||
|
||||
use MyApp\Core\Controller;
|
||||
|
||||
class ServersController extends Controller
|
||||
{
|
||||
/**
|
||||
* @RouteRegExp = "|^/servers$|"
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @RouteRegExp = "|^/servers/add$|"
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @RouteRegExp = "|^/servers/edit/(?<id>\d+)$|"
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
}
|
||||
}
|
Ссылка в новой задаче
Block a user