<?php

	class SelectedUsersModel {
		protected function initSelectedUsers() {
			if (!isset( $_SESSION["selected_users"] )) $_SESSION["selected_users"]=array();
		}

		public function clearSelectedUsers() {
			$_SESSION["selected_users"]=array();
		}

		public function addSelectedUser( $user_id ) {
			$this->initSelectedUsers();
			if (isset( $_SESSION["selected_users"][$user_id] )) return;
			$_SESSION["selected_users"][$user_id]=$user_id;
		}

		public function deleteSelectedUser( $user_id ) {
			$this->initSelectedUsers();
			if (!isset( $_SESSION["selected_users"][$user_id] )) return;
			unset( $_SESSION["selected_users"][$user_id] );
		}

		public function isUserSelected( $user_id ) {
			$this->initSelectedUsers();
			return (isset( $_SESSION["selected_users"][$user_id] ));
		}

		public function getAllSelectedUsers( ) {
			$this->initSelectedUsers();
			return array_keys( $_SESSION["selected_users"] );
		}

		public function setAllSelectedUsers( $user_ids ) {
			$_SESSION["selected_users"]=array();
			foreach ($user_ids as $user_id) $_SESSION["selected_users"][$user_id]=$user_id;
		}

		public function saveSelectedUsers( $user_id , $template_name ) {

		}

		public function loadSelectedUsers( $user_id , $template_name ) {

		}

	}

?>
