<?php
/*****************************************************************************
 * User.php
 * Contains key class User, as well as the Guest and Member class derived
 * from it.
 *
 * Kabuki CMS (C) 2013-2015, Aaron van Geffen
 *****************************************************************************/

/**
 * User model; contains attributes and methods shared by both members and guests.
 */
abstract class User
{
	protected $id_user;
	protected $first_name;
	protected $surname;
	protected $emailaddress;
	protected $creation_time;
	protected $last_action_time;
	protected $ip_address;
	protected $is_admin;

	protected $is_logged;
	protected $is_guest;

	/**
	 * Returns user id.
	 */
	public function getUserId()
	{
		return $this->id_user;
	}

	/**
	 * Returns first name.
	 */
	public function getFirstName()
	{
		return $this->first_name;
	}

	/**
	 * Returns surname.
	 */
	public function getSurname()
	{
		return $this->surname;
	}

	/**
	 * Returns full name.
	 */
	public function getFullName()
	{
		return trim($this->first_name . ' ' . $this->surname);
	}

	/**
	 * Returns email address.
	 */
	public function getEmailAddress()
	{
		return $this->emailaddress;
	}

	/**
	 * Have a guess!
	 */
	public function getIPAddress()
	{
		return $this->ip_address;
	}

	/**
	 * Returns whether user is logged in.
	 */
	public function isLoggedIn()
	{
		return $this->is_logged;
	}

	/**
	 * Returns whether user is a guest.
	 */
	public function isGuest()
	{
		return $this->is_guest;
	}

	/**
	 * Returns whether user is an administrator.
	 */
	public function isAdmin()
	{
		return $this->is_admin;
	}
}