Exemple #1
0
 public static function GetDropDownList()
 {
     global $DB;
     $err_mess = CVoteChannel::err_mess() . "<br>Function: GetDropDownList<br>Line: ";
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tID as REFERENCE_ID,\n\t\t\t\tconcat('[',ID,'] ',TITLE) as REFERENCE\n\t\t\tFROM b_vote_channel\n\t\t\tORDER BY C_SORT\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     return $res;
 }
Exemple #2
0
 public static function GetByID($ID)
 {
     $ID = intval($ID);
     if ($ID <= 0) {
         return false;
     }
     $res = CVoteChannel::GetList($by, $order, array("ID" => $ID), $is_filtered);
     return $res;
 }
                    $lAdmin->AddGroupError(GetMessage("VOTE_SAVE_ERROR"), $ID);
                } else {
                    $CACHE_MANAGER->CleanDir("b_vote_channel");
                }
                break;
        }
    }
}
$rsData = CVoteChannel::GetList($by, $order, $arFilter, $is_filtered);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("VOTE_PAGES")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "s_id", "default" => true), array("id" => "TIMESTAMP_X", "content" => GetMessage("VOTE_TIMESTAMP"), "sort" => "s_timestamp", "default" => true), array("id" => "SITE", "content" => GetMessage("VOTE_SITE"), "default" => true), array("id" => "ACTIVE", "content" => GetMessage("VOTE_ACTIVE"), "sort" => "s_active", "default" => true), array("id" => "HIDDEN", "content" => GetMessage("VOTE_HIDDEN"), "sort" => "s_hidden", "default" => true), array("id" => "C_SORT", "content" => GetMessage("VOTE_C_SORT"), "sort" => "s_c_sort", "default" => true), array("id" => "SYMBOLIC_NAME", "content" => GetMessage("VOTE_SID"), "sort" => "s_symbolic_name", "default" => true), array("id" => "TITLE", "content" => GetMessage("VOTE_TITLE"), "sort" => "s_title", "default" => true), array("id" => "VOTES", "content" => GetMessage("VOTE_VOTES"), "sort" => "s_votes", "default" => true)));
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
    $arrSITE = CVoteChannel::GetSiteArray($f_ID);
    $str = "";
    if (is_array($arrSITE)) {
        foreach ($arrSITE as $sid) {
            $str .= '<a title="' . GetMessage("VOTE_SITE_EDIT") . '" href="/bitrix/admin/site_edit.php?LID=' . $sid . '&lang=' . LANGUAGE_ID . '">' . $sid . '</a>, ';
        }
    }
    if ($VOTE_RIGHT == "W") {
        $row->AddViewField("SITE", trim($str, " ,"));
        $row->AddCheckField("ACTIVE");
        $row->AddViewField("HIDDEN", $f_HIDDEN == "Y" ? GetMessage("VOTE_YES") : GetMessage("VOTE_NO"));
        $row->AddInputField("C_SORT");
        $row->AddInputField("SYMBOLIC_NAME");
        $row->AddInputField("TITLE");
        $row->AddViewField("TITLE", '<a href="vote_channel_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $f_ID . '" title="' . GetMessage("VOTE_EDIT_TITLE") . '">' . $f_TITLE . '</a>');
    } else {
Exemple #4
0
 CModule::IncludeModule("vote");
 $db_res = CVoteChannel::GetList($by = "", $order = "", array("ACTIVE" => "Y"), $is_filtered);
 if ($db_res && ($res = $db_res->Fetch())) {
     do {
         $arVoteChannels[$res["ID"] . ""] = "[ " . $res["ID"] . " ]" . $res["TITLE"];
     } while ($res = $db_res->Fetch());
 }
 $arComponentParameters["PARAMETERS"]["VOTE_CHANNEL_ID"] = array("PARENT" => "VOTE_SETTINGS", "NAME" => GetMessage("F_VOTE_CHANNEL_ID"), "TYPE" => "LIST", "VALUES" => $arVoteChannels, "DEFAULT" => "", "REFRESH" => "Y");
 reset($arVoteChannels);
 if (intVal($arCurrentValues["VOTE_CHANNEL_ID"]) > 0) {
     $voteId = intVal($arCurrentValues["VOTE_CHANNEL_ID"]);
 } else {
     $voteId = key($arVoteChannels);
 }
 if (!empty($voteId)) {
     $arPermissions = CVoteChannel::GetArrayGroupPermission($voteId);
     $arUGroupsEx = array();
     $db_res = CGroup::GetList($by = "c_sort", $order = "asc");
     while ($res = $db_res->Fetch()) {
         if (isset($arPermissions[$res["ID"]]) && intVal($arPermissions[$res["ID"]]) >= 2 || intVal($res["ID"]) == 1) {
             $arUGroupsEx[$res["ID"]] = $res["NAME"] . "[" . $res["ID"] . "]";
         }
     }
     if (!empty($arUGroupsEx)) {
         $arComponentParameters["PARAMETERS"]["VOTE_GROUP_ID"] = array("PARENT" => "VOTE_SETTINGS", "NAME" => GetMessage("F_VOTE_GROUP_ID"), "TYPE" => "LIST", "VALUES" => $arUGroupsEx, "DEFAULT" => "", "MULTIPLE" => "Y");
         $arComponentParameters["PARAMETERS"]["VOTE_TEMPLATE"] = array("PARENT" => "VOTE_SETTINGS", "NAME" => GetMessage("F_VOTE_TEMPLATE"), "TYPE" => "LIST", "VALUES" => array(".default" => GetMessage("F_VOTE_TEMPLATE_DEFAULT"), "light" => GetMessage("F_VOTE_TEMPLATE_LIGHT")), "DEFAULT" => "light", "MULTIPLE" => "N", "ADDITIONAL_VALUES" => "Y");
         $arVoteUnique = array();
         if (IsModuleInstalled('statistic')) {
             $arVoteUnique["1"] = GetMessage("F_VOTE_UNIQUE_SESSION");
         }
         $arVoteUnique["2"] = GetMessage("F_VOTE_UNIQUE_COOKIE_ONLY");
IncludeModuleLangFile(__FILE__);
define("HELP_FILE", "vote_list.php");
$sTableID = "tbl_vote_question";
$oSort = new CAdminSorting($sTableID, "ID", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$aMenu = array();
$VOTE_ID = intval($_REQUEST["VOTE_ID"]);
$z = CVote::GetByID($VOTE_ID);
if (!($arVote = $z->Fetch())) {
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    echo "<a href='vote_list.php?lang=" . LANGUAGE_ID . "' class='navchain'>" . GetMessage("VOTE_VOTE_LIST") . "</a>";
    echo ShowError(GetMessage("VOTE_NOT_FOUND"));
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
    die;
}
$t = CVoteChannel::GetByID($arVote["CHANNEL_ID"]);
$arChannel = $t->Fetch();
$adminChain->AddItem(array("TEXT" => htmlspecialcharsbx($arChannel["TITLE"]), "LINK" => "vote_channel_edit.php?ID={$arChannel['ID']}&lang=" . LANGUAGE_ID));
$adminChain->AddItem(array("TEXT" => strlen($arVote["TITLE"]) > 0 ? htmlspecialcharsbx($arVote["TITLE"]) : TruncateText($arVote["DESCRIPTION_TYPE"] == "html" ? strip_tags($arVote["DESCRIPTION"]) : htmlspecialcharsbx($arVote["DESCRIPTION"]), 200), "LINK" => "vote_edit.php?ID={$arVote['ID']}&lang=" . LANGUAGE_ID));
$arFilterFields = array("find_id", "find_id_exact_match", "find_active", "find_diagram", "find_required", "find_question", "find_question_exact_match");
$lAdmin->InitFilter($arFilterFields);
/********************************************************************
				Actions
********************************************************************/
InitBVar($find_id_exact_match);
InitBVar($find_question_exact_match);
$arFilter = array("ID" => $find_id, "ID_EXACT_MATCH" => $find_id_exact_match, "ACTIVE" => $find_active, "DIAGRAM" => $find_diagram, "REQUIRED" => $find_required, "QUESTION" => $find_question, "QUESTION_EXACT_MATCH" => $find_question_exact_match);
if (!($VOTE_RIGHT >= "W" && check_bitrix_sessid())) {
    //
} else {
    if ($lAdmin->EditAction()) {
Exemple #6
0
if ($obCache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path) && !$_SESSION["VOTE"]["VOTES"][$arParams["VOTE_ID"]])
{
	$arVars = $obCache->GetVars();
	$arResult["VOTE"] = $arVars["arResult"]["VOTE"];
	$arResult["CHANNEL"] = $arVars["arResult"]["CHANNEL"];
	$arResult["QUESTIONS"] = $arVars["arResult"]["QUESTIONS"];
}
elseif (CModule::IncludeModule("vote"))
{
	$tmp = array("bGetMemoStat" => array("bGetMemoStat" => "N", "bRestoreVotedData" => "Y"));
	$tmp = array("bGetMemoStat" => array("bGetMemoStat" => "N", "bRestoreVotedData" => "Y"));
	$arParams["VOTE_ID"] = GetVoteDataByID($arParams["VOTE_ID"],
		$arChannel, $arVote, $arQuestions, $arAnswers,
		$tmp["DropDown"], $tmp["MultiSelect"],
		$tmp["arGroupAnswers"], $tmp["bGetMemoStat"]);
	$permission = ($arParams["PERMISSION"] === false ? CVoteChannel::GetGroupPermission($arChannel["ID"]) : $arParams["PERMISSION"]);

	if ($permission < 2)
	{
		$arError[] = array(
			"id" => "access denied", 
			"text" => GetMessage("VOTE_ACCESS_DENIED"));
	}
	else
	{
		//Vote Image
		$arVote["IMAGE"] = CFile::GetFileArray($arVote["IMAGE_ID"]);
		$arResult["VOTE"] = $arVote;

		$arResult["CHANNEL"] = $arChannel;
Exemple #7
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;
	}
Exemple #8
0
    }
    if ($USER_ALREADY_VOTE == "Y") {
        $strError .= GetMessage("VOTE_ALREADY_VOTE") . "<br>";
    }
    if ($VOTING_LAMP == "red") {
        $strError .= GetMessage("VOTE_RED_LAMP") . "<br>";
    }
    $IsUserVoted = "N";
    if ($VOTING_OK != "Y" && $USER_ALREADY_VOTE != "Y") {
        $IsUserVoted = IsUserVoted($VOTE_ID) ? "Y" : "N";
    }
    $VOTE_ID = GetVoteDataByID($VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "N");
    if (intval($VOTE_ID) > 0) {
        echo ShowError($strError);
        echo ShowNote($strNote);
        $VOTE_PERMISSION = CVoteChannel::GetGroupPermission($arChannel["ID"]);
        if ($IsUserVoted != "Y" && $VOTING_OK != "Y" && $USER_ALREADY_VOTE != "Y") {
            if (intval($VOTE_PERMISSION) >= 2) {
                ?>
				<table cellspacing="0" cellpadding="5" width="100%">
				<form name="vote_form" action="<?php 
                echo $APPLICATION->GetCurPageParam("", array("VOTE_ID", "VOTING_OK"));
                ?>
" method="POST">
				<input type="hidden" name="PUBLIC_VOTE_ID" value="<?php 
                echo $VOTE_ID;
                ?>
">
					<?php 
                while (list($key, $arQuestion) = each($arQuestions)) {
                    $QUESTION_ID = $arQuestion["ID"];
Exemple #9
0
$vote = new vote();
$vote->InstallUserFields();
$arAnswerColors = array("blue" => "#81a8ab");
$answerColor = array_key_exists(WIZARD_THEME_ID, $arAnswerColors) ? $arAnswerColors[WIZARD_THEME_ID] : "#969696";
if (!is_object($DB)) {
    global $DB;
}
global $CACHE_MANAGER;
$CACHE_MANAGER->CleanDir("b_vote_channel");
$CACHE_MANAGER->Clean("b_vote_channel_2_site");
$symbolycName = 'COMPANY_' . WIZARD_SITE_ID;
if (!WIZARD_NEW_2011 && WIZARD_SITE_ID == 's1') {
    $symbolycName = 'COMPANY';
}
$arChannelFields = array("TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => "'1'", "FIRST_SITE_ID" => "'" . WIZARD_SITE_ID . "'", "ACTIVE" => "'Y'", "TITLE" => "'" . $DB->ForSql(GetMessage('VOTE_CHANNEL_COMPANY')) . "'", "SYMBOLIC_NAME" => "'" . $symbolycName . "'");
$rsVoteChan = CVoteChannel::GetList($by, $order, array("SYMBOLIC_NAME" => $symbolycName, 'SYMBOLIC_NAME_EXACT_MATCH' => 'Y'), $is_filtered);
if (!$rsVoteChan->Fetch()) {
    $ID = (int) $DB->Insert("b_vote_channel", $arChannelFields);
    if ($ID < 1) {
        return;
    }
    $CACHE_MANAGER->CleanDir("b_vote_perm_" . $ID);
    //site
    $DB->Query("DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID='" . $ID . "'", false);
    $DB->Query("INSERT INTO b_vote_channel_2_site (CHANNEL_ID, SITE_ID) VALUES ({$ID}, '" . WIZARD_SITE_ID . "')", false);
    //groups
    $DB->Query("DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID='{$ID}'", false);
    $rsGroups = CGroup::GetList($by, $order, array());
    while ($arGroup = $rsGroups->Fetch()) {
        $arFieldsPerm = array("CHANNEL_ID" => "'" . intval($ID) . "'", "GROUP_ID" => "'" . intval($arGroup["ID"]) . "'", "PERMISSION" => "'2'");
        $DB->Insert("b_vote_channel_2_group", $arFieldsPerm);
Exemple #10
0
        //Images
        $arResult["QUESTIONS"][$qID]["IMAGE"] = CFile::GetFileArray($arResult["QUESTIONS"][$qID]["IMAGE_ID"]);
        //Diagram type
        if (!empty($arParams["QUESTION_DIAGRAM_" . $qID]) && $arParams["QUESTION_DIAGRAM_" . $qID] != "-") {
            $arResult["QUESTIONS"][$qID]["DIAGRAM_TYPE"] = trim($arParams["QUESTION_DIAGRAM_" . $qID]);
        }
        //Answers
        $arResult["QUESTIONS"][$qID]["ANSWERS"] = $arQuestion["ANSWERS"];
    }
    //Vote Image
    $arResult["VOTE"]["IMAGE"] = CFile::GetFileArray($arResult["VOTE"]["IMAGE_ID"]);
    $obCache->StartDataCache();
    CVoteCacheManager::SetTag($cache_path, array("C" => $arResult["VOTE"]["CHANNEL_ID"], "V" => $arResult["VOTE"]["ID"], "Q" => array_keys($arResult["QUESTIONS"])));
    $obCache->EndDataCache(array("arResult" => $arResult));
}
$arParams["PERMISSION"] = $arParams["PERMISSION"] === false && CModule::IncludeModule("vote") ? CVoteChannel::GetGroupPermission($arResult["CHANNEL"]["ID"]) : $arParams["PERMISSION"];
if ($arParams["PERMISSION"] < 1) {
    ShowError(GetMessage("VOTE_ACCESS_DENIED"));
    return false;
}
if ($_REQUEST["VOTE_ID"] == $arParams["VOTE_ID"]) {
    $arError = array();
    $arNote = array();
    if ($GLOBALS["VOTING_OK"] == "Y" || $_REQUEST["VOTE_SUCCESSFULL"] == "Y") {
        $arNote[] = array("id" => "ok", "text" => GetMessage("VOTE_OK"));
    }
    if ($GLOBALS["USER_ALREADY_VOTE"] == "Y") {
        $arError[] = array("id" => "already vote", "text" => GetMessage("VOTE_ALREADY_VOTE"));
    }
    if ($GLOBALS["VOTING_LAMP"] == "red") {
        $arError[] = array("id" => "red lamp", "text" => GetMessage("VOTE_RED_LAMP"));
Exemple #11
0
		$arResult["QUESTIONS"][$qID]["ANSWERS"] = $arQuestion["ANSWERS"];
	}

	//Vote Image
	$arResult["VOTE"]["IMAGE"] = CFile::GetFileArray($arResult["VOTE"]["IMAGE_ID"]);

	$obCache->StartDataCache();
	CVoteCacheManager::SetTag($cache_path, array(
		"C" => $arResult["VOTE"]["CHANNEL_ID"],
		"V" => $arResult["VOTE"]["ID"],
		"Q" => array_keys($arResult["QUESTIONS"])));
	$obCache->EndDataCache(array("arResult" => $arResult));
}

$arParams["PERMISSION"] = (($arParams["PERMISSION"] === false && CModule::IncludeModule("vote")) ?
	CVoteChannel::GetGroupPermission($arResult["CHANNEL"]["ID"]) : $arParams["PERMISSION"]);
if ($arParams["PERMISSION"] < 1):
	ShowError(GetMessage("VOTE_ACCESS_DENIED"));
	return false;
endif;

if ($_REQUEST["VOTE_ID"] == $arParams["VOTE_ID"])
{
	$arError = array(); $arNote = array();
	if ($GLOBALS["VOTING_OK"] == "Y" || $_REQUEST["VOTE_SUCCESSFULL"] == "Y")
		$arNote[] = array("id" => "ok", "text" => GetMessage("VOTE_OK"));
	if ($GLOBALS["USER_ALREADY_VOTE"] == "Y")
		$arError[] = array("id" => "already vote", "text" => GetMessage("VOTE_ALREADY_VOTE"));
	if ($GLOBALS["VOTING_LAMP"] == "red")
		$arError[] = array("id" => "red lamp", "text" => GetMessage("VOTE_RED_LAMP"));
Exemple #12
0
function ShowVoteResults($VOTE_ID, $template1="")
{
	global $APPLICATION;
	$VOTE_ID = GetVoteDataByID($VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "Y");
	if (intval($VOTE_ID)>0)
	{
		/***** for old pre-component templates **********/
		global $VOTE_PERMISSION;
		$VOTE_PERMISSION = CVote::UserGroupPermission($arChannel["ID"]);
		/***** /old *************************************/

		$perm = CVoteChannel::GetGroupPermission($arChannel["ID"]);
		if (intval($perm)>=1)
		{
			$template = (strlen($arVote["RESULT_TEMPLATE"])<=0) ? "default.php" : $arVote["RESULT_TEMPLATE"];
			require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/vote/include.php");
			IncludeModuleLangFile(__FILE__);
			$path = COption::GetOptionString("vote", "VOTE_TEMPLATE_PATH_VOTE");
			if (strlen($template1)>0) $template = $template1;
			if ($APPLICATION->GetShowIncludeAreas())
			{
				$arIcons = Array();
				if (CModule::IncludeModule("fileman"))
				{
					$arIcons[] =
							Array(
								"URL" => "/bitrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($path.$template),
								"SRC" => "/bitrix/images/vote/panel/edit_template.gif",
								"ALT" => GetMessage("VOTE_PUBLIC_ICON_TEMPLATE")
							);
					$arrUrl = parse_url($_SERVER["REQUEST_URI"]);
					$arIcons[] =
							Array(
								"URL" => "/bitrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($arrUrl["path"]),
								"SRC" => "/bitrix/images/vote/panel/edit_file.gif",
								"ALT" => GetMessage("VOTE_PUBLIC_ICON_HANDLER")
							);
				}
				$arIcons[] =
						Array(
							"URL" => "/bitrix/admin/vote_edit.php?lang=".LANGUAGE_ID."&ID=".$VOTE_ID,
							"SRC" => "/bitrix/images/vote/panel/edit_vote.gif",
							"ALT" => GetMessage("VOTE_PUBLIC_ICON_SETTINGS")
						);
				echo $APPLICATION->IncludeStringBefore($arIcons);
			}
			$template = Rel2Abs('/', $template);
			include($_SERVER["DOCUMENT_ROOT"].$path.$template);
			if ($APPLICATION->GetShowIncludeAreas())
			{
				echo $APPLICATION->IncludeStringAfter();
			}
		}
	}
}
Exemple #13
0
        }
    }
    $arVote = $db_res ? $db_res->Fetch() : array();
    if (empty($arVote) || $arVote["CHANNEL_ACTIVE"] != "Y" || $arVote["ACTIVE"] != "Y") {
        return false;
    }
    $arResult = array("VOTE" => $arVote, "VOTE_ID" => $arVote["ID"], "VOTE_RESULT_TEMPLATE" => $APPLICATION->GetCurPageParam("", array("VOTE_SUCCESSFULL", "VOTE_ID", "view_form")), "ADDITIONAL_CACHE_ID" => "current_vote");
    $obCache->StartDataCache();
    CVoteCacheManager::SetTag($cache_path, array("C" => $arVote["CHANNEL_ID"], "V" => $arVote["ID"]));
    $obCache->EndDataCache(array("arResult" => $arResult));
} else {
    $arVars = $obCache->GetVars();
    $arResult = $arVars["arResult"];
    $this->SetTemplateCachedData($arVars["templateCachedData"]);
}
$arParams["PERMISSION"] = $arParams["PERMISSION"] === false ? CVoteChannel::GetGroupPermission($arResult["VOTE"]["CHANNEL_ID"]) : $arParams["PERMISSION"];
if ($arParams["PERMISSION"] <= 0) {
    return false;
} elseif ($GLOBALS["VOTING_OK"] == "Y" && $GLOBALS["VOTING_ID"] == $arParams["VOTE_ID"] && !empty($arParams["VOTE_RESULT_TEMPLATE"])) {
    $var = array("VOTE_ID", "VOTING_OK", "VOTE_SUCCESSFULL", "view_result", "view_form");
    $url = CComponentEngine::MakePathFromTemplate($arParams["VOTE_RESULT_TEMPLATE"], array("VOTE_ID" => $arVote["ID"]));
    if (strpos($url, "?") === false) {
        $url .= "?";
    } elseif (($token = substr($url, strpos($url, "?") + 1)) && !empty($token) && preg_match_all("/(?<=^|\\&)\\w+(?=\$|\\=)/is", $token, $matches)) {
        $var = array_merge($var, $matches);
    }
    $strNavQueryString = DeleteParam($var);
    LocalRedirect($url . "&VOTE_SUCCESSFULL=Y&VOTE_ID=" . intval($_REQUEST["VOTE_ID"]) . ($strNavQueryString != "" ? "&" : "") . $strNavQueryString);
}
$voteUserID = $_SESSION["VOTE_USER_ID"] ? $_SESSION["VOTE_USER_ID"] : intval($GLOBALS["APPLICATION"]->get_cookie("VOTE_USER_ID"));
$arParams["VOTED"] = CVote::UserAlreadyVote($arResult["VOTE_ID"], $voteUserID, $arResult["VOTE"]["UNIQUE_TYPE"], $arResult["VOTE"]["KEEP_IP_SEC"], $GLOBALS["USER"]->GetID());
				/Default params
********************************************************************/
$bShowForm = false;
if ($arParams["MESSAGE_TYPE"] == "REPLY" && $arParams["TID"] > 0) {
    $bShowForm = CForumMessage::CanUserAddMessage($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID());
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT" && $arParams["MID"] > 0) {
    $bShowForm = CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), intVal($USER->GetID()));
} elseif ($arParams["MESSAGE_TYPE"] == "NEW" && $arParams["FID"] > 0) {
    $bShowForm = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID());
}
if (!$bShowForm) {
    return 0;
}
if ($arParams["SHOW_VOTE"] == "Y") {
    CModule::IncludeModule("vote");
    $permission = isset($arParams['PERMISSION']) && intval($arParams['PERMISSION'] > 0 || $arParams['PERMISSION'] === 0) ? intval($arParams['PERMISSION']) : CVoteChannel::GetGroupPermission($arParams["VOTE_CHANNEL_ID"]);
    if ($permission < 2) {
        $arParams["SHOW_VOTE"] = "N";
    }
    $res = array_intersect($USER->GetUserGroupArray(), $arParams["VOTE_GROUP_ID"]);
    $arParams["SHOW_VOTE"] = empty($res) ? "N" : $arParams["SHOW_VOTE"];
}
/********************************************************************
				Data
********************************************************************/
if ($arParams["MESSAGE_TYPE"] == "EDIT") {
    $arMessage = CForumMessage::GetByIDEx($arParams["MID"], array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "N"));
    if (empty($arMessage)) {
        ShowError(GetMessage("F_ERROR_MESSAGE_NOT_FOUND"));
        return 0;
    }
Exemple #15
0
if ($arParams["MESSAGE_TYPE"] == "REPLY" && $arParams["TID"] > 0)
	$bShowForm = CForumMessage::CanUserAddMessage($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID());
elseif ($arParams["MESSAGE_TYPE"] == "EDIT" && $arParams["MID"] > 0)
	$bShowForm = CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), intVal($USER->GetID()));
elseif ($arParams["MESSAGE_TYPE"] == "NEW" && $arParams["FID"] > 0)
	$bShowForm = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID());

if (!$bShowForm):
	return 0;
endif;
if ($arParams["SHOW_VOTE"] == "Y" && CModule::IncludeModule("vote"))
{
	$permission = ((isset($arParams['PERMISSION']) &&
		(intval($arParams['PERMISSION'] > 0 || $arParams['PERMISSION'] === 0)))
		? intval($arParams['PERMISSION'])
		: CVoteChannel::GetGroupPermission($arParams["VOTE_CHANNEL_ID"]));

	if ($permission < 2) {
		$arParams["SHOW_VOTE"] = "N";
	} else if (!empty($arParams["VOTE_GROUP_ID"])) {
		$res = array_intersect($USER->GetUserGroupArray(), $arParams["VOTE_GROUP_ID"]);
		$arParams["SHOW_VOTE"] = (empty($res) ? "N" : $arParams["SHOW_VOTE"]);
	} else if ($permission < 4) {
		$arParams["SHOW_VOTE"] = "N";
	}
}
/********************************************************************
				Data
********************************************************************/
if ($arParams["MESSAGE_TYPE"] == "EDIT")
{
Exemple #16
0
        while ($arGroup = $rsGroups->Fetch()) {
            $arFieldsPerm = array("CHANNEL_ID" => "'" . intval($ID) . "'", "GROUP_ID" => "'" . intval($arGroup["ID"]) . "'", "PERMISSION" => "'2'");
            $DB->Insert("b_vote_channel_2_group", $arFieldsPerm);
        }
        $arFieldsVote = array("CHANNEL_ID" => "'" . $ID . "'", "C_SORT" => "'100'", "ACTIVE" => "'Y'", "TIMESTAMP_X" => $DB->GetNowFunction(), "DATE_START" => $DB->CharToDateFunction(GetTime(mktime(0, 0, 0, 1, 1, 2000), "FULL")), "DATE_END" => $DB->CharToDateFunction(GetTime(mktime(23, 59, 59, 12, 31, 2030), "FULL")), "TITLE" => "'" . $DB->ForSql(GetMessage('VOTING_INSTALL_VOTE_BOOKS_VOTE_TITLE')) . "'", "DESCRIPTION" => "NULL", "DESCRIPTION_TYPE" => "'html'", "EVENT1" => "'vote'", "EVENT2" => "'books_vote'", "EVENT3" => "NULL", "UNIQUE_TYPE" => "'2'", "KEEP_IP_SEC" => "'0'", "DELAY" => "'0'", "DELAY_TYPE" => "NULL", "NOTIFY" => "'N'");
        $VOTE_ID = $DB->Insert("b_vote", $arFieldsVote);
        $arFieldsQuest = array("TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => "'100'", "ACTIVE" => "'Y'", 'QUESTION_TYPE' => "'text'", 'DIAGRAM' => "'Y'", 'DIAGRAM_TYPE' => "'histogram'", 'VOTE_ID' => "'{$VOTE_ID}'", 'QUESTION' => "'" . $DB->ForSql(GetMessage('VOTING_INSTALL_VOTE_QUESTION3')) . "'", 'COUNTER' => "'0'");
        $Q_ID = $DB->Insert("b_vote_question", $arFieldsQuest);
        for ($i = 1; $i <= 8; $i++) {
            $answ = array('C_SORT' => "'" . $i * 100 . "'", 'MESSAGE' => "'" . $DB->ForSql(GetMessage('VOTING_INSTALL_VOTE_ANSWER3_' . $i)) . "'", 'FIELD_TYPE' => "'0'", 'QUESTION_ID' => "'{$Q_ID}'", "TIMESTAMP_X" => $DB->GetNowFunction(), "ACTIVE" => "'Y'", 'FIELD_WIDTH' => "'0'", 'FIELD_HEIGHT' => "'0'");
            $DB->Insert("b_vote_answer", $answ);
        }
    }
}
$arFieldsVC = array("TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => "'200'", "FIRST_SITE_ID" => "'s1'", "ACTIVE" => "'Y'", "VOTE_SINGLE" => "'N'", "TITLE" => "'" . $DB->ForSql(GetMessage('VOTING_INSTALL_CHANNEL_FORUM')) . "'", "SYMBOLIC_NAME" => "'FORUM'");
$rsVoteChan = CVoteChannel::GetList($by, $order, array('SYMBOLIC_NAME' => 'FORUM', 'SYMBOLIC_NAME_EXACT_MATCH' => 'Y'), $is_filtered);
if (!$rsVoteChan->Fetch()) {
    $ID = $DB->Insert("b_vote_channel", $arFieldsVC);
    if ($ID > 0) {
        $CACHE_MANAGER->CleanDir("b_vote_perm_" . $ID);
        //site
        $DB->Query("DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID='" . $ID . "'", false);
        $DB->Query("INSERT INTO b_vote_channel_2_site (CHANNEL_ID, SITE_ID) VALUES ({$ID}, 's1')", false);
        //groups
        $DB->Query("DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID='{$ID}'", false);
        $rsGroups = CGroup::GetList($by, $order, array());
        while ($arGroup = $rsGroups->Fetch()) {
            $arFieldsPerm = array("CHANNEL_ID" => "'" . intval($ID) . "'", "GROUP_ID" => "'" . intval($arGroup["ID"]) . "'", "PERMISSION" => "'2'");
            $DB->Insert("b_vote_channel_2_group", $arFieldsPerm);
        }
        $arFieldsVote = array("CHANNEL_ID" => "'" . $ID . "'", "C_SORT" => "'100'", "ACTIVE" => "'Y'", "TIMESTAMP_X" => $DB->GetNowFunction(), "DATE_START" => $DB->CharToDateFunction(GetTime(mktime(0, 0, 0, 1, 1, 2009), "FULL")), "DATE_END" => $DB->CharToDateFunction(GetTime(mktime(23, 59, 59, 12, 31, 2030), "FULL")), "TITLE" => "'" . $DB->ForSql(GetMessage('VOTING_INSTALL_VOTE_FORUM_TITLE')) . "'", "DESCRIPTION" => "NULL", "DESCRIPTION_TYPE" => "'html'", "EVENT1" => "'vote'", "EVENT2" => "'forum'", "EVENT3" => "NULL", "UNIQUE_TYPE" => "'1'", "KEEP_IP_SEC" => "'0'", "DELAY" => "'0'", "DELAY_TYPE" => "NULL", "TEMPLATE" => "'default.php'", "RESULT_TEMPLATE" => "'default.php'", "NOTIFY" => "'N'");
Exemple #17
0
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    echo "<a href='vote_list.php?lang=" . LANGUAGE_ID . "' class='navchain'>" . GetMessage("VOTE_VOTE_LIST") . "</a>";
    echo ShowError(GetMessage("VOTE_NOT_FOUND"));
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
    die;
}
if ($old_module_version == "Y") {
    if ($REQUEST_METHOD == "GET" && strlen($save) > 0 && $VOTE_RIGHT == "W" && check_bitrix_sessid()) {
        $DB->PrepareFields("b_vote");
        $arFields = array("TIMESTAMP_X" => $DB->GetNowFunction(), "TEMPLATE" => "'" . $str_TEMPLATE . "'");
        $DB->Update("b_vote", $arFields, "WHERE ID='" . $VOTE_ID . "'", $err_mess . __LINE__);
    }
}
$z = CVote::GetByID($VOTE_ID);
$zr = $z->Fetch();
$t = CVoteChannel::GetByID($zr["CHANNEL_ID"]);
$tr = $t->Fetch();
if ($TEMPLATE == "") {
    $TEMPLATE = $zr["TEMPLATE"];
}
/********************************************************************
				Form
********************************************************************/
$APPLICATION->SetTitle(str_replace("#ID#", "{$VOTE_ID}", GetMessage("VOTE_PAGE_TITLE")));
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$aMenu = array(array("TEXT" => GetMessage("VOTE_VOTE_LIST"), "ICON" => "btn_list", "LINK" => "/bitrix/admin/vote_list.php?lang=" . LANGUAGE_ID));
$aMenu[] = array("SEPARATOR" => "Y");
$aMenu[] = array("TEXT" => GetMessage("VOTE_QUESTIONS") . " [" . $zr["QUESTIONS"] . "]", "ICON" => "btn_list", "LINK" => "/bitrix/admin/vote_question_list.php?lang=" . LANGUAGE_ID . "&VOTE_ID=" . $VOTE_ID);
$aMenu[] = array("TEXT" => GetMessage("VOTE_RESULTS"), "LINK" => "/bitrix/admin/vote_results.php?lang=" . LANGUAGE_ID . "&VOTE_ID=" . $VOTE_ID);
$context = new CAdminContextMenu($aMenu);
$context->Show();
Exemple #18
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("vote")) {
    return;
}
/*$arrChannels = Array("-" => GetMessage("VOTE_ALL_CHANNELS"));*/
$arrChannels = array();
$rs = CVoteChannel::GetList($v1, $v2, array(), $v3);
while ($arChannel = $rs->GetNext()) {
    $arrChannels[$arChannel["SID"]] = "[" . $arChannel["SID"] . "] " . html_entity_decode($arChannel["TITLE"]);
}
$arComponentParameters = array("PARAMETERS" => array("CHANNEL_SID" => array("NAME" => GetMessage("VOTE_CHANNEL_SID"), "TYPE" => "LIST", "PARENT" => "BASE", "VALUES" => $arrChannels, "DEFAULT" => "", "MULTIPLE" => "Y"), "VOTE_FORM_TEMPLATE" => array("NAME" => GetMessage("VOTE_EMPTY_FORM_PAGE"), "TYPE" => "STRING", "PARENT" => "URL_TEMPLATES", "COLS" => 45, "DEFAULT" => "vote_new.php?VOTE_ID=#VOTE_ID#"), "VOTE_RESULT_TEMPLATE" => array("NAME" => GetMessage("VOTE_RESULT_PAGE"), "TYPE" => "STRING", "COLS" => 45, "PARENT" => "URL_TEMPLATES", "DEFAULT" => "vote_result.php?VOTE_ID=#VOTE_ID#")));
Exemple #19
0
 function GetByID($ID)
 {
     $err_mess = CAllVoteChannel::err_mess() . "<br>Function: GetByID<br>Line: ";
     global $DB;
     $ID = intval($ID);
     if ($ID <= 0) {
         return;
     }
     $res = CVoteChannel::GetList($by, $order, array("ID" => $ID), $is_filtered);
     return $res;
 }
Exemple #20
0
 function GetDropDownList()
 {
     global $DB;
     $err_mess = CVoteChannel::err_mess() . "<br>Function: GetDropDownList<br>Line: ";
     $strSql = "\r\n\t\t\tSELECT\r\n\t\t\t\tID as REFERENCE_ID,\r\n\t\t\t\t'['+convert(varchar(8000),ID)+'] '+TITLE as REFERENCE\r\n\t\t\tFROM b_vote_channel\r\n\t\t\tORDER BY C_SORT\t\t\t\t\r\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     return $res;
 }
Exemple #21
0
<tr>
	<td nowrap><?php 
echo GetMessage("VOTE_F_CHANNEL");
?>
</td>
	<td nowrap><input type="text" name="find_channel" value="<?php 
echo htmlspecialcharsbx($find_channel);
?>
" size="47"><?php 
echo InputType("checkbox", "find_channel_exact_match", "Y", $find_channel_exact_match, false, "", "title='" . GetMessage("VOTE_EXACT_MATCH") . "'");
?>
&nbsp;<?php 
echo ShowFilterLogicHelp();
?>
<br><?php 
echo SelectBox("find_channel_id", CVoteChannel::GetDropDownList(), GetMessage("VOTE_ALL"), htmlspecialcharsbx($find_channel_id));
?>
</td>
</tr>
<tr>
	<td nowrap><?php 
echo GetMessage("VOTE_F_ACTIVE");
?>
</td>
	<td nowrap><?php 
$arr = array("reference" => array(GetMessage("VOTE_YES"), GetMessage("VOTE_NO")), "reference_id" => array("Y", "N"));
echo SelectBoxFromArray("find_active", $arr, htmlspecialcharsbx($find_active), GetMessage("VOTE_ALL"));
?>
</td>
</tr>
<tr>
Exemple #22
0
 public static function WrongDateInterval($CURRENT_VOTE_ID, $DATE_START, $DATE_END, $CHANNEL_ID)
 {
     global $DB;
     $err_mess = CAllVote::err_mess() . "<br>Function: WrongDateInterval<br>Line: ";
     $CURRENT_VOTE_ID = intval($CURRENT_VOTE_ID);
     $CURRENT_VOTE_ID = $CURRENT_VOTE_ID > 0 ? $CURRENT_VOTE_ID : false;
     $CHANNEL_ID = intval($CHANNEL_ID);
     $CHANNEL_ID = $CHANNEL_ID > 0 ? $CHANNEL_ID : false;
     $DATE_START = $DATE_START == false ? false : (trim($DATE_START) == '' ? false : trim($DATE_START));
     $DATE_END = $DATE_END == false ? false : (trim($DATE_END) == '' ? false : trim($DATE_END));
     if ($CURRENT_VOTE_ID == false && $CHANNEL_ID == false) {
         return 0;
     } elseif ($CHANNEL_ID > 0) {
         $db_res = CVoteChannel::GetByID($CHANNEL_ID);
         if ($db_res && ($res = $db_res->Fetch())) {
             if ($res["VOTE_SINGLE"] != "Y") {
                 return 0;
             }
         }
     }
     $st = $DATE_START == false ? "VV.DATE_START" : $DB->CharToDateFunction($DATE_START, "FULL");
     $en = $DATE_END == false ? "VV.DATE_END" : $DB->CharToDateFunction($DATE_END, "FULL");
     if ($CURRENT_VOTE_ID <= 0) {
         if ($DATE_START == false) {
             $st = $DB->CurrentTimeFunction();
         }
         if ($DATE_END == false) {
             $en = $DB->CharToDateFunction(ConvertTimeStamp(1924984799, "FULL"), "FULL");
         }
         // '31.12.2030 23:59:59'
     }
     $strSql = "\n\t\t\tSELECT V.ID\n\t\t\tFROM b_vote V \n\t\t\t" . ($CURRENT_VOTE_ID > 0 ? "LEFT JOIN b_vote VV ON (VV.ID = " . $CURRENT_VOTE_ID . ") " : "") . "\n\t\t\tINNER JOIN b_vote_channel VC ON (V.CHANNEL_ID = VC.ID AND VC.VOTE_SINGLE = 'Y')\n\t\t\tWHERE\n\t\t\t\tV.CHANNEL_ID=" . ($CHANNEL_ID == false ? "VV.CHANNEL_ID" : $CHANNEL_ID) . " AND \n\t\t\t\tV.ACTIVE='Y' AND \n\t\t\t\t" . ($CURRENT_VOTE_ID > 0 ? "V.ID<>'" . $CURRENT_VOTE_ID . "' AND " : "") . "\n\t\t\t\t(\n\t\t\t\t\t(" . $st . " between V.DATE_START and V.DATE_END) OR\n\t\t\t\t\t(" . $en . " between V.DATE_START and V.DATE_END) OR\n\t\t\t\t\t(V.DATE_START between " . $st . " and " . $en . ") OR\n\t\t\t\t\t(V.DATE_END between " . $st . " and " . $en . ")\n\t\t\t\t)";
     $db_res = $DB->Query($strSql, false, $err_mess . __LINE__);
     if ($db_res && ($res = $db_res->Fetch())) {
         return intval($res["ID"]);
     }
     return 0;
 }
            $message = new CAdminMessage(GetMessage("VOTE_GOT_ERROR"), $e);
        }
    }
}
$db_res = $ID > 0 ? CVoteChannel::GetByID($ID) : false;
if (!($db_res && ($res = $db_res->Fetch()))) {
    $APPLICATION->SetTitle(GetMessage("VOTE_NEW_RECORD"));
    if ($ID > 0 && $message == null) {
        $message = new CAdminMessage(GetMessage("VOTE_CHANNEL_IS_NOT_EXISTS", array("#ID#" => $ID)));
    }
    $ID = 0;
    $res = array("TITLE" => "", "SYMBOLIC_NAME" => "", "ACTIVE" => "Y", "HIDDEN" => "N", "C_SORT" => 100, "VOTE_SINGLE" => "Y", "USE_CAPTCHA" => "N", "SITE" => array_keys($arrSites), "GROUP_ID" => array());
} else {
    $APPLICATION->SetTitle(GetMessage("VOTE_EDIT_RECORD", array("#ID#" => $ID)));
    $res["SITE"] = CVoteChannel::GetSiteArray($ID);
    $res["GROUP_ID"] = CVoteChannel::GetArrayGroupPermission($ID);
}
if (isset($bVarsFromForm) && $bVarsFromForm == true) {
    $res = array_intersect_key($_REQUEST, $res);
}
foreach ($res as $k => $v) {
    $res[$k] = htmlspecialcharsEx($res[$k]);
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
/********************************************************************
				Form
********************************************************************/
$aMenu = array(array("TEXT" => GetMessage("VOTE_LIST"), "TITLE" => GetMessage("VOTE_RECORDS_LIST"), "LINK" => "/bitrix/admin/vote_channel_list.php?lang=" . LANGUAGE_ID, "ICON" => "btn_list"));
if ($ID > 0) {
    $aMenu[] = array("TEXT" => GetMessage("VOTE_VOTES") . ($res["VOTES"] ? " [" . $res["VOTES"] . "]" : ""), "TITLE" => GetMessage("VOTE_VOTES_TITLE"), "LINK" => "/bitrix/admin/vote_list.php?lang=" . LANGUAGE_ID . "&find_channel_id={$ID}&set_filter=Y");
    if ($VOTE_RIGHT == "W") {
Exemple #24
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("vote")) {
    return false;
}
$permission = intval($arParams["PERMISSION"] ? $arParams["PERMISSION"] : CVoteChannel::GetGroupPermission($arParams["CHANNEL_ID"]));
if ($permission < 4) {
    return false;
}
/********************************************************************
				Input params
********************************************************************/
$arParams["CHANNEL_ID"] = intval($arParams["CHANNEL_ID"]);
$arParams["MULTIPLE"] = $arParams["MULTIPLE"] == "Y" ? "Y" : "N";
if (preg_match("/[^a-z0-9_]+/i", $arParams["INPUT_NAME"])) {
    showError(GetMessage("V_BAD_NAME_FORMAT"));
    return false;
}
$arParams["~INPUT_NAME"] = trim($arParams["INPUT_NAME"]);
$arParams["INPUT_NAME"] = $arParams["~INPUT_NAME"] . ($arParams["MULTIPLE"] == "Y" ? "[]" : "");
$arParams["INPUT_VALUE"] = empty($arParams["INPUT_VALUE"]) ? array() : (is_array($arParams["INPUT_VALUE"]) ? $arParams["INPUT_VALUE"] : array($arParams["INPUT_VALUE"]));
$arParams["VOTE_UNIQUE"] = is_array($arParams["VOTE_UNIQUE"]) ? $arParams["VOTE_UNIQUE"] : array($arParams["VOTE_UNIQUE"]);
if (!isset($arParams["VOTE_UNIQUE_IP_DELAY"]) || !preg_match("/\\d+ \\w/is", $arParams["VOTE_UNIQUE_IP_DELAY"], $matches)) {
    $arParams["VOTE_UNIQUE_IP_DELAY"] = "10 D";
}
$arParams["CONTROL_ID"] = preg_match("/^[a-zA-Z0-9_]+\$/", $arParams["CONTROL_ID"]) ? $arParams["CONTROL_ID"] : randString();
$arParams["bVarsFromForm"] = $arParams["bVarsFromForm"] ? true : false;
/********************************************************************
Exemple #25
0
$VOTE_RIGHT = $APPLICATION->GetGroupRight("vote");
if ($VOTE_RIGHT == "D") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/include.php";
ClearVars();
IncludeModuleLangFile(__FILE__);
CModule::IncludeModule("vote");
$err_mess = "File: " . __FILE__ . "<br>Line: ";
$old_module_version = CVote::IsOldVersion();
$aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("VOTE_PROP"), "ICON" => "main_vote_edit", "TITLE" => GetMessage("VOTE_PARAMS")), array("DIV" => "edit2", "TAB" => GetMessage("VOTE_DESCR"), "ICON" => "main_vote_edit", "TITLE" => GetMessage("VOTE_DESCRIPTION")), array("DIV" => "edit3", "TAB" => GetMessage("VOTE_HOSTS"), "ICON" => "main_vote_edit", "TITLE" => GetMessage("VOTE_UNIQUE_PARAMS")));
$tabControl = new CAdminTabControl("tabControl", $aTabs);
$arChannels = array();
$is_filtered = false;
$bVarsFromForm = false;
$db_res = CVoteChannel::GetList($by = "s_c_sort", $order = "asc", array(), $is_filtered);
if ($db_res && ($res = $db_res->GetNext())) {
    do {
        $arChannels[$res["ID"]] = $res;
    } while ($res = $db_res->GetNext());
}
if (empty($arChannels)) {
    $APPLICATION->SetTitle(GetMessage("VOTE_NEW_RECORD"));
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    echo "<a href='vote_list.php?lang=" . LANGUAGE_ID . "' class='navchain'>" . GetMessage("VOTE_VOTE_LIST") . "</a>";
    echo ShowError(GetMessage("VOTE_CHANNEL_NOT_FOUND"));
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
    die;
}
$DAYS = intVal($_REQUEST["DAYS"]) > 0 ? intVal($_REQUEST["DAYS"]) : 30;
/********************************************************************
Exemple #26
0
	/**
	 * Shows data form in admin part when you edit or add usertype.
	 * @param bool $arUserField
	 * @param string $arHtmlControl
	 * @param bool $bVarsFromForm
	 * @return string
	 */
	function GetSettingsHTML($arUserField = false, $arHtmlControl, $bVarsFromForm)
	{
		if (!CModule::IncludeModule("vote"))
			return '';
		$value = "";
		if($bVarsFromForm)
			$value = $GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_ID"];
		elseif(is_array($arUserField)){
			$value = $arUserField["SETTINGS"]["CHANNEL_ID"];
			$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] = $arUserField["SETTINGS"]["NOTIFY"];
		}
		$value = (!empty($value) ? intval($value) : "add");
		$db_res = CVoteChannel::GetList($by = "", $order = "", array("ACTIVE" => "Y"), $is_filtered);
		$arVoteChannels = array("reference" => array(GetMessage("V_NEW_CHANNEL")), "reference_id" => array("add"));
		if ($db_res && $res = $db_res->Fetch())
		{
			do
			{
				$arVoteChannels["reference"][] = $res["TITLE"];
				$arVoteChannels["reference_id"][] = $res["ID"];
			} while ($res = $db_res->Fetch());
		}

		ob_start();
?>
	<tr>
		<td><?php 
echo GetMessage("V_CHANNEL_ID_COLON");
?>
</td>
		<td><?php 
echo str_replace("<select", "<select onchange='if(this.value!=\"add\"){BX.hide(BX(\"channel_create\"));BX.show(this.nextSibling);}" . "else{BX(\"channel_create\").style.display=\"\";BX.hide(this.nextSibling);}' ", SelectBoxFromArray($arHtmlControl["NAME"] . "[CHANNEL_ID]", $arVoteChannels, $value));
?>
<a style="margin-left: 1em;" href="" rel="/bitrix/admin/vote_channel_edit.php?ID=#id#" <?
			?>onmousedown="this.href=this.rel.replace('#id#',this.previousSibling.value);"><?php 
echo GetMessage("V_CHANNEL_ID_EDIT");
?>
</a></td>
	</tr>
	<tbody id="channel_create" style="<?if ($value != "add") {?>display:none;<?}?>">
	<tr class="adm-detail-required-field">
		<td class="adm-detail-content-cell-l" width="40%"><?php 
echo GetMessage("V_CHANNEL_ID_TITLE");
?>
</td>
		<td class="adm-detail-content-cell-r" width="60%"><input type="text" name="<?php 
echo $arHtmlControl["NAME"];
?>
[CHANNEL_TITLE]" <?
			?>value="<?php 
echo htmlspecialcharsbx($GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_TITLE"]);
?>
" /></td>
	</tr>
	<tr class="adm-detail-required-field">
		<td class="adm-detail-content-cell-l"><?php 
echo GetMessage("V_CHANNEL_ID_SYMBOLIC_NAME");
?>
</td>
		<td class="adm-detail-content-cell-r"><input type="text" name="<?php 
echo $arHtmlControl["NAME"];
?>
[CHANNEL_SYMBOLIC_NAME]" <?
			?>value="<?php 
echo htmlspecialcharsbx($GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_SYMBOLIC_NAME"]);
?>
" /></td>
	</tr>
	<tr>
		<td class="adm-detail-content-cell-l">&nbsp;</td>
		<td class="adm-detail-content-cell-r"><input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[CHANNEL_USE_CAPTCHA]" <?
			?>id="CHANNEL_USE_CAPTCHA" <?if ($GLOBALS[$arHtmlControl["NAME"]]["CHANNEL_USE_CAPTCHA"] == "Y"){?> checked <?}
			?>value="Y" /> <label for="CHANNEL_USE_CAPTCHA"><?php 
echo GetMessage("V_CHANNEL_ID_USE_CAPTCHA");
?>
</label></td>
	</tr><?
	$db_res = CGroup::GetList($by = "sort", $order = "asc", Array("ADMIN" => "N"));
	while ($group = $db_res->GetNext())
	{
		if($bVarsFromForm)
			$value = $GLOBALS[$arHtmlControl["NAME"]]["GROUP_ID"][$group["ID"]];
		else
			$value = ($group["ID"] == 2 ? 1 : ($group["ID"] == 1 ? 4 : 2));
?>
	<tr>
		<td class="adm-detail-content-cell-l"><?php 
echo $group["NAME"] . ":";
?>
</td>
		<td class="adm-detail-content-cell-r"><?php 
echo SelectBoxFromArray("GROUP_ID[" . $group["ID"] . "]", $GLOBALS["aVotePermissions"], $value);
?>
</td>
	</tr><?
	}

?>
	</tbody>
<?
		if($bVarsFromForm)
		{
			$GLOBALS[$arHtmlControl["NAME"]]['UNIQUE'] = is_array($GLOBALS[$arHtmlControl["NAME"]]['UNIQUE']) ?
				$GLOBALS[$arHtmlControl["NAME"]]['UNIQUE'] : array();
			$uniqType = 0;
			foreach ($GLOBALS[$arHtmlControl["NAME"]]['UNIQUE'] as $res)
				$uniqType |= $res;
		}
		else
		{
			$uniqType = ($arUserField["SETTINGS"]["UNIQUE"] ? $arUserField["SETTINGS"]["UNIQUE"] : 13);
			if (is_array($arUserField["SETTINGS"]["UNIQUE"])) {
				foreach ( $arUserField["SETTINGS"]["UNIQUE"] as $res) {
					$uniqType |= $res; }
				$uniqType += 5;
			}
			$uniqType -=5;
		}
?>
<script language="javascript">
function __utch(show)
{
	if (BX("UNIQUE_TYPE_IP").checked)
		BX.show(BX("DELAY_TYPE"), "");
	else
		BX.hide(BX("DELAY_TYPE"));

	var
		show = BX("UNIQUE_TYPE_USER_ID").checked,
		res = BX("UNIQUE_TYPE_USER_ID_NEW");
	res.disabled = !show;
	if (!!show)
		BX.show(res.parentNode.parentNode, "");
	else
		BX.hide(res.parentNode.parentNode);
}
</script>
	<tr>
		<td class="adm-detail-content-cell-l adm-detail-valign-top" width="40%"><?php 
echo GetMessage("VOTE_NOTIFY");
?>
</td>
		<td class="adm-detail-content-cell-r" width="60%"><?
			$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] = (
				$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] != "I" && $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] != "Y" ?
					"N" : $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"]);
			if (IsModuleInstalled("im")){?>
				<?php 
echo InputType("radio", $arHtmlControl["NAME"] . "[NOTIFY]", "I", $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"], false, GetMessage("VOTE_NOTIFY_IM"));
?>
<br /><?
			} else {
				$GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] = ($GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"] == "I" ?
					"N" : $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"]);
			}?>
			<?php 
echo InputType("radio", $arHtmlControl["NAME"] . "[NOTIFY]", "Y", $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"], false, GetMessage("VOTE_NOTIFY_EMAIL"));
?>
<br />
			<?php 
echo InputType("radio", $arHtmlControl["NAME"] . "[NOTIFY]", "N", $GLOBALS[$arHtmlControl["NAME"]]["NOTIFY"], false, GetMessage("VOTE_NOTIFY_N"));
?>
<?
			?></td>
	</tr>
	<tr>
		<td class="adm-detail-content-cell-l adm-detail-valign-top"><?php 
echo GetMessage("V_UNIQUE");
?>
</td>
		<td class="adm-detail-content-cell-r">
			<? if (IsModuleInstalled('statistic')) { ?>
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_SESSION" value="1" <?php 
echo $uniqType & 1 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_SESSION"><?php 
echo GetMessage("V_UNIQUE_SESSION");
?>
</label><br />
			<? } ?>
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_COOKIE" value="2" <?php 
echo $uniqType & 2 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_COOKIE"><?php 
echo GetMessage("V_UNIQUE_COOKIE_ONLY");
?>
</label><br />
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_IP" onclick="__utch()" value="4" <?
				?><?php 
echo $uniqType & 4 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_IP"><?php 
echo GetMessage("V_UNIQUE_IP_ONLY");
?>
</label><br />
			<input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_USER_ID" onclick="__utch();" value="8" <?
				?><?php 
echo $uniqType & 8 ? " checked" : "";
?>
 />
			<label for="UNIQUE_TYPE_USER_ID"><?php 
echo GetMessage("V_UNIQUE_USER_ID_ONLY");
?>
</label><br />
		</td>
	</tr>
	<tr>
		<td class="adm-detail-content-cell-l" width="40%">&nbsp;</td>
		<td class="adm-detail-content-cell-r" width="60%"><input type="checkbox" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE][]" id="UNIQUE_TYPE_USER_ID_NEW" value="16" <?
			?><?php 
echo $uniqType & 16 ? " checked " : "";
?>
<?
			?><?php 
echo $uniqType & 8 ? "" : " disabled";
?>
 /> <label for="UNIQUE_TYPE_USER_ID_NEW"><?php 
echo GetMessage("V_UNIQUE_USER_ID_NEW");
?>
</label>
		</td>
	</tr>
	<?
		if($bVarsFromForm)
			$value = $GLOBALS[$arHtmlControl["NAME"]]["UNIQUE_IP_DELAY"];
		else
			$value = (is_array($arUserField) ?
				$arUserField["SETTINGS"]["UNIQUE_IP_DELAY"] :
					array("DELAY" => "10", "DELAY_TYPE" => "D"));
		?>
	<tr id="DELAY_TYPE">
		<td class="adm-detail-content-cell-l" width="40%"><?php 
echo GetMessage("V_UNIQUE_IP_DELAY");
?>
</td>
		<td class="adm-detail-content-cell-r" width="60%">
			<input type="text" name="<?php 
echo $arHtmlControl["NAME"];
?>
[UNIQUE_IP_DELAY][DELAY]" value="<?php 
echo htmlspecialcharsbx($value["DELAY"]);
?>
" />
			<?php 
echo SelectBoxFromArray($arHtmlControl["NAME"] . "[UNIQUE_IP_DELAY][DELAY_TYPE]", array("reference_id" => array("S", "M", "H", "D"), "reference" => array(GetMessage("V_SECONDS"), GetMessage("V_MINUTES"), GetMessage("V_HOURS"), GetMessage("V_DAYS"))), $value["DELAY_TYPE"]);
?>
<script type="text/javascript">
BX.ready(function(){
	if (!!document.forms.post_form.MULTIPLE)
		BX.hide(document.forms.post_form.MULTIPLE.parentNode.parentNode);
	__utch();
});
</script>

		</td>
	</tr>
	<?
	return ob_get_clean();
	}
Exemple #27
0
    	while($__arChannel = $__rsChannel -> Fetch())
    	{
    		$channels[] = Array(
    			"text" => $__arChannel["TITLE"],
    			"url" => "vote_list.php?lang=".LANGUAGE_ID."&find_channel_id=".$__arChannel["ID"]."&set_filter=Y",
    			"more_url" => Array(),
    			"title" => GetMessage("VOTE_GROUP_LST").$__arChannel["TITLE"]
    		);
    	}
    */
    CModule::IncludeModule('vote');
    $menuResults = array();
    if (method_exists($this, "IsSectionActive") && $this->IsSectionActive("menu_vote_channels") || defined('BX_ADMIN_FORM_MENU_OPEN') && BX_ADMIN_FORM_MENU_OPEN == 1) {
        $by = "s_c_sort";
        $order = "asc";
        $rChannels = CVoteChannel::GetList($by, $order, $arFilter, $is_filtered);
        while ($arChannel = $rChannels->Fetch()) {
            if (intval($arChannel["VOTES"]) > 0) {
                $menuChannel = array("text" => htmlspecialcharsEx($arChannel["TITLE"]), "url" => "vote_user_votes_table.php?lang=" . LANGUAGE_ID . "&CHANNEL_ID=" . $arChannel['ID'], "module_id" => "vote", "page_icon" => "vote_page_icon", "items_id" => "vote_channel_" . $arChannel["ID"], "items" => array());
                $obVote = CVote::GetList($by, $order, array("CHANNEL_ID" => $arChannel["ID"]), $is_filtered);
                while ($arVote = $obVote->GetNext()) {
                    $menuVote = array("items_id" => "vote_channel_" . $arChannel["ID"], "text" => $arVote["TITLE"], "title" => GetMessage("VOTE_MENU_POLL_DESCRIPTION") . '\'' . htmlspecialcharsEx($arVote["TITLE"]) . '\'', "module_id" => "vote", "url" => "vote_user_votes_table.php?lang=" . LANGUAGE_ID . "&VOTE_ID=" . $arVote['ID']);
                    $menuChannel["items"][] = $menuVote;
                }
                $menuResults[] = $menuChannel;
            }
        }
    }
    $aMenu = array("parent_menu" => "global_menu_services", "section" => "vote", "sort" => 100, "module_id" => "vote", "text" => GetMessage("VOTE_MENU_MAIN"), "title" => GetMessage("VOTE_MENU_MAIN_TITLE"), "icon" => "vote_menu_icon", "page_icon" => "vote_page_icon", "items_id" => "menu_vote", "items" => array(array("text" => GetMessage("VOTE_MENU_CHANNEL"), "url" => "vote_channel_list.php?lang=" . LANGUAGE_ID, "title" => GetMessage("VOTE_MENU_CHANNEL_ALT"), "more_url" => array("vote_channel_edit.php")), array("text" => GetMessage("VOTE_MENU_VOTE"), "url" => "vote_list.php?lang=" . LANGUAGE_ID, "more_url" => array("vote_edit.php", "vote_question_list.php", "vote_question_edit.php", "vote_results.php", "vote_preview.php"), "title" => GetMessage("VOTE_MENU_VOTE_ALT")), array("text" => GetMessage("VOTE_MENU_USER"), "url" => "vote_user_list.php?lang=" . LANGUAGE_ID, "more_url" => array(), "title" => GetMessage("VOTE_MENU_USER_ALT")), array("text" => GetMessage("VOTE_MENU_RESULT"), "items_id" => "menu_vote_channels", "module_id" => "vote", "url" => "vote_user_votes.php?lang=" . LANGUAGE_ID, "dynamic" => true, "more_url" => array("vote_user_results.php", "vote_user_results_table.php"), "title" => GetMessage("VOTE_MENU_RESULT_ALT"), "items" => $menuResults)));
    return $aMenu;
}