<?

/*
 * This file is part of the Science-ation project
 * Science-ation Website: https://science-ation.ca
 *
 * This file was part of the 'Science Fair In A Box' project
 *
 *
 * Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
 * Copyright (C) 2005 James Grant <james@lightbox.org>
 * Copyright (C) 2024 AlgoLibre Inc. <science-ation@algolibre.io>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, version 2.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
?>
<?

$user_page_overall_status = 'incomplete';

function user_page_summary_begin()
{
	global $user_page_overall_status;
	echo '<table class="summarytable">';
	echo '<tr><th>' . i18n('Item') . '</th><th>' . i18n('Status') . '</th></tr>';
	$user_page_overall_status = 'complete';
}

function user_page_summary_item($name, $link, $status_function, $args = array())
{
	global $user_page_overall_status;
	echo '<tr><td>';
	echo "<a href=\"$link\">";
	echo i18n("$name");
	echo '</a>';
	echo '</td><td>';
	// check to see if its complete
	switch ($status_function) {
		case 'user_personal_info_status':
			$status = user_personal_info_status($args[0]);
			break;
		case 'judge_status_other':
			$status = judge_status_other($args[0]);
			break;
		case 'judge_status_expertise':
			$status = judge_status_expertise($args[0]);
			break;
		case 'judge_status_availability':
			$status = judge_status_availability($args[0]);
			break;
		case 'judge_status_special_awards':
			$status = judge_status_special_awards($args[0]);
			break;
		default:
			$status = call_user_func_array($status_function, $args);
			break;
	}
	echo outputStatus($status);
	echo '</td></tr>';
	if ($status != 'complete') {
		$user_page_overall_status = 'incomplete';
	}
}

function user_page_summary_end($print_overall)
{
	global $user_page_overall_status;
	if ($print_overall) {
		echo '<tr><td colspan="2"><hr></td></tr>';
		echo '<tr><td>' . i18n('Overall Status') . '</td><td>';
		echo outputStatus($user_page_overall_status);
		echo '</td></tr>';
	}
	echo '</table>';
	return $user_page_overall_status;
}

?>