+ public function setLoggedInUserNickname(string $nickname)
+ {
+ $this->nickname = $nickname;
+ }
+
+ public function isLoggedIn()
+ {
+ return local_user() && $this->user_id && ($this->user_id == local_user());
+ }
+
+ /**
+ * Check if current user has admin role.
+ *
+ * @return bool true if user is an admin
+ */
+ public function isSiteAdmin()
+ {
+ $admin_email = $this->config->get('config', 'admin_email');
+
+ $adminlist = explode(',', str_replace(' ', '', $admin_email));
+
+ return local_user() && $admin_email && $this->database->exists('user', ['uid' => $this->getLoggedInUserId(), 'email' => $adminlist]);
+ }
+
+ /**
+ * Fetch the user id
+ * @return int
+ */
+ public function getLoggedInUserId()
+ {
+ return $this->user_id;
+ }
+
+ /**
+ * Fetch the user nick name
+ * @return string
+ */
+ public function getLoggedInUserNickname()
+ {
+ 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
+ */
+ public function getQueue()
+ {
+ return $this->queue ?? [];
+ }
+
+ /**
+ * Fetch a specific workerqueue field
+ *
+ * @param string $index
+ * @return mixed
+ */
+ 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;
+ }