<?php
switch($setting['optioncode'])
{
	case 'vbmail_forums:all':
	{
		$handled = true;
		$array = construct_forum_chooser_options(-1,$vbphrase['all']);
		$size = sizeof($array);

		$vbphrase['forum_is_closed_for_posting'] = $vbphrase['closed'];
		print_select_row($description, $name.'[]', $array, unserialize($setting['value']), false, ($size > 10 ? 10 : $size), true);
	}
	break;

	case 'vbmail_forums:none':
	{
		$handled = true;
		$array = construct_forum_chooser_options(0,$vbphrase['none']);
		$size = sizeof($array);

		$vbphrase['forum_is_closed_for_posting'] = $vbphrase['closed'];
		print_select_row($description, $name.'[]', $array, unserialize($setting['value']), false, ($size > 10 ? 10 : $size), true);
	}

	case 'vbmail_usergroup':
	{
		$handled = true;
		$usergrouplist = array();
		foreach ($vbulletin->usergroupcache AS $usergroup)
		{
			$usergrouplist["$usergroup[usergroupid]"] = $usergroup['title'];
		}

		$setting['value'] = unserialize($setting['value']);
		$setting['value'] = is_array($setting['value']) ? $setting['value'] : array();

		$setting['html'] = '';
		$setting['html'] .= "<div id=\"ctrl_setting[$setting[varname]]\" class=\"smallfont\">\r\n";
		$setting['html'] .= "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"0\" />\r\n";
		foreach ($usergrouplist AS $usergroupid => $usergroup)
		{
			$setting['html'] .= "<table style=\"width:50%; float:" . (intval($vbulletin->versionnumber) == 3 ? $stylevar['left'] : vB_Template_Runtime::fetchStyleVar('left')) . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">
			<td><input type=\"checkbox\" name=\"setting[$setting[varname]][]\" id=\"setting[$setting[varname]]_$usergroupid\" value=\"$usergroupid\"" . (in_array($usergroupid, $setting['value']) ? ' checked="checked"' : '') . " /></td>
			<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[$setting[varname]]_$usergroupid\" class=\"smallfont\">" . $usergroup . "</label></td>\r\n</tr></table>\r\n";
		}

		$setting['html'] .= "</div>\r\n";
		print_label_row($description, $setting['html'], '', 'top', $name, 40);
		break;
	}

	case 'vbmail_usergroupextra':
	{
		$handled = true;
		$usergrouplist = fetch_piped_options($setting['optiondata']);
		foreach ($vbulletin->usergroupcache AS $usergroup)
		{
			$usergrouplist["$usergroup[usergroupid]"] = $usergroup['title'];
		}

		$setting['value'] = unserialize($setting['value']);
		$setting['value'] = is_array($setting['value']) ? $setting['value'] : array();

		$setting['html'] = '';
		$setting['html'] .= "<div id=\"ctrl_setting[$setting[varname]]\" class=\"smallfont\">\r\n";
		foreach ($usergrouplist AS $usergroupid => $usergroup)
		{
			$setting['html'] .= "<table style=\"width:50%; float:" . (intval($vbulletin->versionnumber) == 3 ? $stylevar['left'] : vB_Template_Runtime::fetchStyleVar('left')) . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">
			<td><input type=\"checkbox\" name=\"setting[$setting[varname]][]\" id=\"setting[$setting[varname]]_$usergroupid\" value=\"$usergroupid\"" . (in_array($usergroupid, $setting['value']) ? ' checked="checked"' : '') . " /></td>
			<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[$setting[varname]]_$usergroupid\" class=\"smallfont\">" . $usergroup . "</label></td>\r\n</tr></table>\r\n";
		}

		$setting['html'] .= "</div>\r\n";
		print_label_row($description, $setting['html'], '', 'top', $name, 40);
		break;
	}
}
?>