ChoresService = new ChoresService(); $this->UserfieldsService = new UserfieldsService(); } protected $ChoresService; protected $UserfieldsService; public function Overview(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { $usersService = new UsersService(); $nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['chores_due_soon_days']; return $this->View->render($response, 'choresoverview', [ 'chores' => $this->Database->chores()->orderBy('name'), 'currentChores' => $this->ChoresService->GetCurrent(), 'nextXDays' => $nextXDays, 'userfields' => $this->UserfieldsService->GetFields('chores'), 'userfieldValues' => $this->UserfieldsService->GetAllValues('chores'), 'users' => $usersService->GetUsersAsDto() ]); } public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { return $this->View->render($response, 'choretracking', [ 'chores' => $this->Database->chores()->orderBy('name'), 'users' => $this->Database->users()->orderBy('username') ]); } public function ChoresList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { return $this->View->render($response, 'chores', [ 'chores' => $this->Database->chores()->orderBy('name'), 'userfields' => $this->UserfieldsService->GetFields('chores'), 'userfieldValues' => $this->UserfieldsService->GetAllValues('chores') ]); } public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { return $this->View->render($response, 'choresjournal', [ 'choresLog' => $this->Database->chores_log()->orderBy('tracked_time', 'DESC'), 'chores' => $this->Database->chores()->orderBy('name'), 'users' => $this->Database->users()->orderBy('username') ]); } public function ChoreEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { $usersService = new UsersService(); $users = $usersService->GetUsersAsDto(); if ($args['choreId'] == 'new') { return $this->View->render($response, 'choreform', [ 'periodTypes' => GetClassConstants('\Grocy\Services\ChoresService', 'CHORE_PERIOD_TYPE_'), 'mode' => 'create', 'userfields' => $this->UserfieldsService->GetFields('chores'), 'assignmentTypes' => GetClassConstants('\Grocy\Services\ChoresService', 'CHORE_ASSIGNMENT_TYPE_'), 'users' => $users, 'products' => $this->Database->products()->orderBy('name') ]); } else { return $this->View->render($response, 'choreform', [ 'chore' => $this->Database->chores($args['choreId']), 'periodTypes' => GetClassConstants('\Grocy\Services\ChoresService', 'CHORE_PERIOD_TYPE_'), 'mode' => 'edit', 'userfields' => $this->UserfieldsService->GetFields('chores'), 'assignmentTypes' => GetClassConstants('\Grocy\Services\ChoresService', 'CHORE_ASSIGNMENT_TYPE_'), 'users' => $users, 'products' => $this->Database->products()->orderBy('name') ]); } } public function ChoresSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { return $this->View->render($response, 'choressettings'); } }