mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 19:16:37 +00:00
Applied PHP formatting rules
This commit is contained in:
@@ -4,19 +4,6 @@ namespace Grocy\Controllers;
|
||||
|
||||
class GenericEntityController extends BaseController
|
||||
{
|
||||
public function __construct(\DI\Container $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
}
|
||||
|
||||
public function UserfieldsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
return $this->renderPage($response, 'userfields', [
|
||||
'userfields' => $this->getUserfieldsService()->GetAllFields(),
|
||||
'entities' => $this->getUserfieldsService()->GetEntities()
|
||||
]);
|
||||
}
|
||||
|
||||
public function UserentitiesList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
return $this->renderPage($response, 'userentities', [
|
||||
@@ -24,16 +11,22 @@ class GenericEntityController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
public function UserobjectsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
public function UserentityEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
|
||||
if ($args['userentityId'] == 'new')
|
||||
{
|
||||
return $this->renderPage($response, 'userentityform', [
|
||||
'mode' => 'create'
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->renderPage($response, 'userentityform', [
|
||||
'mode' => 'edit',
|
||||
'userentity' => $this->getDatabase()->userentities($args['userentityId'])
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->renderPage($response, 'userobjects', [
|
||||
'userentity' => $userentity,
|
||||
'userobjects' => $this->getDatabase()->userobjects()->where('userentity_id = :1', $userentity->id),
|
||||
'userfields' => $this->getUserfieldsService()->GetFields('userentity-' . $args['userentityName']),
|
||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('userentity-' . $args['userentityName'])
|
||||
]);
|
||||
}
|
||||
|
||||
public function UserfieldEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
@@ -50,28 +43,20 @@ class GenericEntityController extends BaseController
|
||||
{
|
||||
return $this->renderPage($response, 'userfieldform', [
|
||||
'mode' => 'edit',
|
||||
'userfield' => $this->getUserfieldsService()->GetField($args['userfieldId']),
|
||||
'userfield' => $this->getUserfieldsService()->GetField($args['userfieldId']),
|
||||
'userfieldTypes' => $this->getUserfieldsService()->GetFieldTypes(),
|
||||
'entities' => $this->getUserfieldsService()->GetEntities()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function UserentityEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
public function UserfieldsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
if ($args['userentityId'] == 'new')
|
||||
{
|
||||
return $this->renderPage($response, 'userentityform', [
|
||||
'mode' => 'create'
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->renderPage($response, 'userentityform', [
|
||||
'mode' => 'edit',
|
||||
'userentity' => $this->getDatabase()->userentities($args['userentityId'])
|
||||
]);
|
||||
}
|
||||
return $this->renderPage($response, 'userfields', [
|
||||
'userfields' => $this->getUserfieldsService()->GetAllFields(),
|
||||
'entities' => $this->getUserfieldsService()->GetEntities()
|
||||
]);
|
||||
}
|
||||
|
||||
public function UserobjectEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
@@ -91,9 +76,28 @@ class GenericEntityController extends BaseController
|
||||
return $this->renderPage($response, 'userobjectform', [
|
||||
'userentity' => $userentity,
|
||||
'mode' => 'edit',
|
||||
'userobject' => $this->getDatabase()->userobjects($args['userobjectId']),
|
||||
'userobject' => $this->getDatabase()->userobjects($args['userobjectId']),
|
||||
'userfields' => $this->getUserfieldsService()->GetFields('userentity-' . $args['userentityName'])
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function UserobjectsList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
$userentity = $this->getDatabase()->userentities()->where('name = :1', $args['userentityName'])->fetch();
|
||||
|
||||
return $this->renderPage($response, 'userobjects', [
|
||||
'userentity' => $userentity,
|
||||
'userobjects' => $this->getDatabase()->userobjects()->where('userentity_id = :1', $userentity->id),
|
||||
'userfields' => $this->getUserfieldsService()->GetFields('userentity-' . $args['userentityName']),
|
||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('userentity-' . $args['userentityName'])
|
||||
]);
|
||||
}
|
||||
|
||||
public function __construct(\DI\Container $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user