Этот коммит содержится в:
2019-11-11 01:58:17 +03:00
родитель a54744ffb9
Коммит e2ac280221
26 изменённых файлов: 732 добавлений и 16 удалений

Просмотреть файл

@@ -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 Обычный файл
Просмотреть файл

@@ -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 Обычный файл
Просмотреть файл

@@ -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)
{
}
}