+ private $session;
+
+ /**
+ * Set the user ID
+ *
+ * @param int $user_id
+ * @return void
+ */
+ public function setLoggedInUserId(int $user_id)
+ {
+ $this->user_id = $user_id;
+ }
+
+ /**
+ * Set the nickname
+ *
+ * @param int $user_id
+ * @return void
+ */
+ public function setLoggedInUserNickname(string $nickname)
+ {
+ $this->nickname = $nickname;
+ }
+
+ public function isLoggedIn(): bool
+ {
+ return $this->session->getLocalUserId() && $this->user_id && ($this->user_id == $this->session->getLocalUserId());
+ }
+
+ /**
+ * Check if current user has admin role.
+ *
+ * @return bool true if user is an admin
+ * @throws Exception
+ */
+ public function isSiteAdmin(): bool
+ {
+ return
+ $this->session->getLocalUserId()
+ && $this->database->exists('user', [
+ 'uid' => $this->getLoggedInUserId(),
+ 'email' => User::getAdminEmailList()
+ ]);
+ }
+
+ /**
+ * Fetch the user id
+ * @return int User id
+ */
+ public function getLoggedInUserId(): int
+ {
+ return $this->user_id;
+ }
+
+ /**
+ * Fetch the user nick name
+ * @return string User's nickname
+ */
+ public function getLoggedInUserNickname(): string
+ {
+ return $this->nickname;
+ }
+
+ /**
+ * Set the profile owner ID
+ *
+ * @param int $owner_id
+ * @return void
+ */
+ public function setProfileOwner(int $owner_id)
+ {
+ $this->profile_owner = $owner_id;
+ }
+
+ /**
+ * Get the profile owner ID
+ *
+ * @return int
+ */
+ public function getProfileOwner(): int
+ {
+ return $this->profile_owner;
+ }
+
+ /**
+ * Set the contact ID
+ *
+ * @param int $contact_id
+ * @return void
+ */
+ public function setContactId(int $contact_id)
+ {
+ $this->contact_id = $contact_id;
+ }
+
+ /**
+ * Get the contact ID
+ *
+ * @return int
+ */
+ public function getContactId(): int
+ {
+ return $this->contact_id;
+ }
+
+ /**
+ * Set the timezone
+ *
+ * @param string $timezone A valid time zone identifier, see https://www.php.net/manual/en/timezones.php
+ * @return void
+ */
+ public function setTimeZone(string $timezone)
+ {
+ $this->timezone = (new \DateTimeZone($timezone))->getName();
+ DateTimeFormat::setLocalTimeZone($this->timezone);
+ }
+
+ /**
+ * Get the timezone
+ *
+ * @return int
+ */
+ public function getTimeZone(): string
+ {
+ return $this->timezone;
+ }
+
+ /**
+ * Set workerqueue information
+ *
+ * @param array $queue
+ * @return void
+ */
+ public function setQueue(array $queue)
+ {
+ $this->queue = $queue;
+ }
+
+ /**
+ * Fetch workerqueue information
+ *
+ * @return array Worker queue
+ */
+ public function getQueue(): array
+ {
+ return $this->queue ?? [];
+ }
+
+ /**
+ * Fetch a specific workerqueue field
+ *
+ * @param string $index Work queue record to fetch
+ * @return mixed Work queue item or NULL if not found
+ */
+ public function getQueueValue(string $index)
+ {
+ return $this->queue[$index] ?? null;
+ }
+
+ public function setThemeInfoValue(string $index, $value)
+ {
+ $this->theme_info[$index] = $value;
+ }
+
+ public function getThemeInfo()
+ {
+ return $this->theme_info;
+ }
+
+ public function getThemeInfoValue(string $index, $default = null)
+ {
+ return $this->theme_info[$index] ?? $default;
+ }