<?php
function yes_write_notice($subject,$message,$sender,$recipients_array){
	$insert_sql_array = array(
		'capt'=>$subject,
		'usr'=>$sender,
		'dat'=>time(),
		'note'=>$message
	);
	xtc_db_perform('Notice_notes',$insert_sql_array);
	$noteID = xtc_db_insert_id();

	$insert_sql_array = array(
		'notes_id'=>$noteID,
		'usr'=>$sender,
		'read_status'=>0,
		'work_status'=>0
	);
	xtc_db_perform('Notice_status',$insert_sql_array);

	foreach($recipients_array as $k=>$rID){
		if($rID != $sender){
			$insert_sql_array = array(
				'notes_id'=>$noteID,
				'usr'=>$rID,
				'read_status'=>0,
				'work_status'=>0
			);
			xtc_db_perform('Notice_status',$insert_sql_array);
		}
	}
}
?>
