Example #1
0
	function GetFormHtml()
	{
		if(!CModule::IncludeModule('forum'))
			return '';

		$s = '
<tr class="section">
	<td colspan="2">'.GetMessage("forum_template_settings").'</td>
</tr>
<tr>
	<td class="bx-popup-label">'.GetMessage("forum_template_forums").'</td>
	<td><select name="forum_FID[]" size="4" multiple>
		<option value="" selected>'.GetMessage("forum_template_forums_all").'</option>';
		$arForums = CForumParameters::GetForumsList();
		foreach($arForums as $key=>$val)
			$s .= '<option value="'.$key.'">'.$val.'</option>';
	$s .= '
	</select></td>
</tr>
';		
		$arThemesMessages = array(
			"beige" => GetMessage("F_THEME_BEIGE"), 
			"blue" => GetMessage("F_THEME_BLUE"), 
			"fluxbb" => GetMessage("F_THEME_FLUXBB"), 
			"gray" => GetMessage("F_THEME_GRAY"), 
			"green" => GetMessage("F_THEME_GREEN"), 
			"orange" => GetMessage("F_THEME_ORANGE"), 
			"red" => GetMessage("F_THEME_RED"), 
			"white" => GetMessage("F_THEME_WHITE"));
		$arThemes = array();
		$dir = $_SERVER["DOCUMENT_ROOT"].BX_ROOT."/components/bitrix/forum/templates/.default/themes/";
		if (is_dir($dir) && $directory = opendir($dir))
		{
			while (($file = readdir($directory)) !== false)
			{
				if ($file != "." && $file != ".." && is_dir($dir.$file))
					$arThemes[$file] = (!empty($arThemesMessages[$file]) ? $arThemesMessages[$file] : strtoupper(substr($file, 0, 1)).strtolower(substr($file, 1)));
			}
			closedir($directory);
		}
		
		if(!empty($arThemes))
		{
			$s .= '
<tr>
<td class="bx-popup-label">'.GetMessage("forum_template_theme").'</td>
<td><select name="forum_THEME">';
		foreach($arThemes as $key=>$val)
			$s .= '<option value="'.$key.'">'.$val.'</option>';
		$s .= '
	</select></td>
</tr>
';
		}

		if (IsModuleInstalled("vote"))
		{
			$right = $GLOBALS["APPLICATION"]->GetGroupRight("vote");
			if ($right >= "W")
			{
				$s .= '
<tr class="section">
	<td colspan="2">'.GetMessage("forum_template_vote").'</td>
</tr>
<tr>
	<td class="bx-popup-label"><label for="forum_SHOW_VOTE">'.GetMessage("forum_template_vote_enable").'</label></td>
	<td>
<script>
window.ForumVoteClick = function(el)
{
	document.getElementById("forum_vote_group").style.display = (el.checked? "":"none");
	document.getElementById("forum_user_group").style.display = (el.checked? "":"none");
}

window.ForumVoteChannelClick = function(el)
{
	if(el.form.forum_VOTE_CHANNEL_ID)
		el.form.forum_VOTE_CHANNEL_ID.disabled = (el.value == "Y");
}
</script>
		<input type="checkbox" name="forum_SHOW_VOTE" id="forum_SHOW_VOTE" value="Y" onclick="ForumVoteClick(this);">
	</td>
</tr>
<tr id="forum_vote_group" style="display:none;">
	<td class="bx-popup-label">'.GetMessage("forum_template_vote_channel").'</td>
	<td>
		<input type="radio" name="forum_NEW_VOTE_CHANNEL" value="Y" id="forum_NEW_VOTE_CHANNEL_Y" checked onclick="ForumVoteChannelClick(this);"><label for="forum_NEW_VOTE_CHANNEL_Y">'.GetMessage("forum_template_vote_channel_new").'</label><br>
';
				$arVoteChannels = array();
				CModule::IncludeModule("vote");
				$db_res = CVoteChannel::GetList($by="s_title", $order="asc", array("ACTIVE" => "Y"), $is_filtered);
				if($db_res && $res=$db_res->Fetch())
				{
					$s .= '
		<input type="radio" name="forum_NEW_VOTE_CHANNEL" value="N" id="forum_NEW_VOTE_CHANNEL_N" onclick="ForumVoteChannelClick(this);"><label for="forum_NEW_VOTE_CHANNEL_N">'.GetMessage("forum_template_vote_channel_select").':</label><br>
		<select name="forum_VOTE_CHANNEL_ID" style="width:100%" disabled>';
					do 
						$s .= '<option value="'.$res["ID"].'">'.htmlspecialcharsbx($res["TITLE"])." [".$res["ID"]."]".'</option>';
					while ($res = $db_res->Fetch());
					$s .= '</select>';
				}
				else
				{
					$s .= '
		<input type="radio" name="forum_NEW_VOTE_CHANNEL" value="N" id="forum_NEW_VOTE_CHANNEL_N" disabled><label for="forum_NEW_VOTE_CHANNEL_N" disabled>'.GetMessage("forum_template_vote_channel_select").'</label><br>
';
				}
				$s .= '
	</td>
</tr>
';
				$s .= '
<tr id="forum_user_group" style="display:none;">
	<td class="bx-popup-label">'.GetMessage("forum_template_vote_groups").'</td>
	<td><select name="forum_VOTE_GROUP_ID[]" size="4" multiple>
';
				$db_res = CGroup::GetList($by = "c_sort", $order = "asc");
				while($res = $db_res->Fetch())
					$s .= '<option value="'.$res["ID"].'">'.htmlspecialcharsbx($res["NAME"])." [".$res["ID"]."]".'</option>';
				$s .= '
		</select>
	</td>
</tr>
';					
			}
		}
		return $s;
	}
Example #2
0
 function GetForumsMultiSelect($name = "", $parent = "")
 {
     return array("PARENT" => $parent, "NAME" => $name, "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => CForumParameters::GetForumsList(), "DEFAULT" => "");
 }