defaultProfileImage = new NullMedia(); parent::__construct($l11n, $request, $response); } /** * Get the profile image * * If the profile doesn't have an image a random default image is used * * @param int $account Account * * @return string * * @since 1.0.0 */ public function getAccountImage(int $account) : string { /** @var \Modules\Profile\Models\Profile $profile */ $profile = ProfileMapper::get() ->with('image') ->where('account', $account) ->execute(); if (($profile instanceof NullProfile) || $profile->image->getPath() === '') { return UriFactory::build('{/lang}/{/app}/' . $this->defaultProfileImage->getPath()); } return UriFactory::build('{/lang}/{/app}/' . $profile->image->getPath()); } /** * Get task status color. * * @param int $status Status * * @return string * * @since 1.0.0 */ public function getStatus(int $status) : string { if ($status === TaskStatus::OPEN) { return 'darkblue'; } elseif ($status === TaskStatus::DONE) { return 'green'; } elseif ($status === TaskStatus::WORKING) { return 'purple'; } elseif ($status === TaskStatus::CANCELED) { return 'red'; } elseif ($status === TaskStatus::SUSPENDED) { return 'yellow'; } return 'black'; } }