Exemplo n.º 1
0
 public static function GetByID($ID)
 {
     $ID = intval($ID);
     if ($ID <= 0) {
         return;
     }
     $res = CVoteEvent::GetList($by, $order, array("ID" => $ID), $is_filtered, "Y");
     return $res;
 }
Exemplo n.º 2
0
	public static function GetByID($ID)
	{
		$err_mess = (CAllVoteEvent::err_mess())."<br>Function: GetByID<br>Line: ";
		global $DB;
		$ID = intval($ID);
		if ($ID<=0) return;
		$res = CVoteEvent::GetList($by, $order, array("ID" => $ID), $is_filtered, "Y");
		return $res;
	}
Exemplo n.º 3
0
function VoteIsUserVoteForVote($VOTE_ID, $USER_ID = 0)
{
    if (!empty($VOTE_ID)) {
        $res = is_array($_SESSION["VOTE_ARRAY"]) && in_array($VOTE_ID, $_SESSION["VOTE_ARRAY"]);
        if (!$res) {
            $_SESSION["VOTE"] = is_array($_SESSION["VOTE"]) ? $_SESSION["VOTE"] : array();
            $_SESSION["VOTE"]["VOTES"] = is_array($_SESSION["VOTE"]["VOTES"]) ? $_SESSION["VOTE"]["VOTES"] : array();
            if (!in_array($VOTE_ID, $_SESSION["VOTE"]["VOTES"])) {
                $_SESSION["VOTE"]["VOTES"][$VOTE_ID] = false;
                $USER_ID = intval($USER_ID);
                $USER_ID = $USER_ID > 0 ? $USER_ID : $GLOBALS["USER"]->GetID();
                $arFilter = array();
                if ($USER_ID > 0) {
                    $arFilter["USER_ID"] = $USER_ID;
                } else {
                    $voteUserID = $_SESSION["VOTE_USER_ID"] ? $_SESSION["VOTE_USER_ID"] : intval($GLOBALS["APPLICATION"]->get_cookie("VOTE_USER_ID"));
                    if ($voteUserID > 0) {
                        $arFilter["VOTE_USER"] = $_SESSION["VOTE_USER_ID"] ? $_SESSION["VOTE_USER_ID"] : $GLOBALS["APPLICATION"]->get_cookie("VOTE_USER_ID");
                    }
                }
                if (!empty($arFilter)) {
                    $arFilter["VOTE_ID"] = $VOTE_ID;
                    $db_res = CVoteEvent::GetList($by, $order, $arFilter, $is_filtered, "Y");
                    if ($db_res && ($res = $db_res->Fetch())) {
                        $_SESSION["VOTE"]["VOTES"][$VOTE_ID] = $res["ID"];
                    }
                }
            }
            $res = $_SESSION["VOTE"]["VOTES"][$VOTE_ID];
        }
        return $res;
    }
    return false;
}
        switch ($_REQUEST['action']) {
            case "delete":
                if (!CVoteEvent::Delete($ID)) {
                    $lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID);
                }
                break;
            case "validate":
            case "devalidate":
                $varVALID = $_REQUEST['action'] == "validate" ? "Y" : "N";
                CVoteEvent::SetValid($ID, $varVALID);
                break;
        }
    }
}
/************** Initial list - Get data ****************************/
$rsData = CVoteEvent::GetList($by, $order, $arFilter, $is_filtered);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
/************** Initial list - Navigation **************************/
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("VOTE_PAGES")));
$headers = array(array("id" => "ID", "content" => "ID", "sort" => "s_id", "default" => true), array("id" => "VOTE_USER_ID", "content" => GetMessage("VOTE_USER"), "sort" => "s_vote_user", "default" => true), array("id" => "STAT_SESSION_ID", "content" => GetMessage("VOTE_SESSION"), "sort" => "s_session", "default" => true), array("id" => "IP", "content" => "IP", "sort" => "s_ip", "default" => true), array("id" => "DATE_VOTE", "content" => GetMessage("VOTE_DATE"), "sort" => "s_date", "default" => true), array("id" => "VALID", "content" => GetMessage("VOTE_VALID"), "sort" => "s_valid", "default" => true));
$by = 'c_sort';
$order = 'asc';
$arAllQuestions = array();
$rsQuestions = CVoteQuestion::GetList($VOTE_ID, $by, $order, array(), $is_filtered);
while ($arQuestion = $rsQuestions->Fetch()) {
    $headers[] = array("id" => "Q" . $arQuestion["ID"], "content" => htmlspecialcharsbx($arQuestion["QUESTION"]), "sort" => '', "default" => true);
    $arAllAnswers = array();
    $rsAnswers = CVoteAnswer::GetList($arQuestion["ID"]);
    while ($arAnswer = $rsAnswers->Fetch()) {
        $arAllAnswers[$arAnswer['ID']] = $arAnswer;