Esempio n. 1
0
}
/**
 * Add PlotKit to the beginning of the $HEAD array.
 */
array_unshift($HEAD, "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/MochiKit/MochiKit.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/excanvas.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/Base.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/Layout.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/Canvas.js\"></script>", "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/PlotKit/SweetCanvas.js\"></script>");
$HEAD[] = "<link href=\"" . ENTRADA_URL . "/javascript/calendar/css/xc2_default.css?release=" . html_encode(APPLICATION_VERSION) . "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />";
$HEAD[] = "<script type=\"text/javascript\" src=\"" . COMMUNITY_URL . "/javascript/polls.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>";
echo "<h1>Your Voting History</h1>\n";
if ($RECORD_ID) {
    $terminology = $db->GetOne("SELECT `poll_terminology` FROM `community_polls` WHERE `cpolls_id` = " . $RECORD_ID);
    $query = "\tSELECT * FROM `community_polls_responses` \n\t\t\t\t\t\t\tWHERE `cpolls_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\t\t\tORDER BY `response_index`";
    $response_record = $db->GetAll($query);
    if ($response_record) {
        $query = "\tSELECT * FROM `community_polls_questions`\n\t\t\t\t\tWHERE `cpolls_id` = " . $RECORD_ID . "\n\t\t\t\t\tAND `question_active` = '1'";
        $questions = $db->GetAll($query);
        $vote_record = communities_polls_votes_cast_by_member($RECORD_ID, $ENTRADA_USER->getActiveId());
        if (isset($vote_record["votes"]) && (int) $vote_record["votes"] > 0) {
            $allow_main_load = true;
        }
        if ($allow_main_load) {
            $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $COMMUNITY_MODULE . "?section=vote-poll&amp;id=" . $RECORD_ID, "title" => "Your Voting History");
            $query = "SELECT * FROM `community_polls` WHERE `community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `cpage_id` = " . $db->qstr($PAGE_ID) . " AND `cpolls_id` = " . $db->qstr($RECORD_ID);
            $poll_record = $db->GetRow($query);
            // Page Display
            switch ($STEP) {
                case 2:
                    if ($NOTICE) {
                        echo display_notice();
                    }
                    if ($SUCCESS) {
                        echo display_success();
Esempio n. 2
0
			<tr>
				<td>Title</td>
				<td style="border-left: none">Voters</td>
				<td style="border-left: none">Votes</td>
				<td style="border-left: none">Available Until</td>
			</tr>
		</thead>
		<tbody>
			<?php 
    foreach ($results as $result) {
        $accessible = TRUE;
        $allowVote = FALSE;
        $voteInfo = communities_polls_latest($result["cpolls_id"]);
        $specificMembers = communities_polls_specific_access($result['cpolls_id']);
        if ($LOGGED_IN) {
            $vote_record = communities_polls_votes_cast_by_member($result["cpolls_id"], $ENTRADA_USER->getActiveId());
        } else {
            $vote_record = array("votes" => 0);
        }
        $allow_main_load = false;
        if ($result["release_date"] && $result["release_date"] > time() || $result["release_until"] && $result["release_until"] < time()) {
            $accessible = FALSE;
        }
        // Check to see if this is a poll that this user can vote in.
        if ($COMMUNITY_ADMIN || ($COMMUNITY_MEMBER && (int) $result['allow_member_vote'] == 1 || !(int) $community_details["community_protected"] && (int) $result['allow_public_vote'] == 1 || !(int) $community_details["community_registration"] && (int) $result['allow_troll_vote'] == 1)) {
            // Check to see if only specific members can vote before checking if they've voted
            if (count($specificMembers) == 0 || is_array($specificMembers) && in_array($ENTRADA_USER->getActiveId(), $specificMembers)) {
                // Check for multiple votes
                if ($result["allow_multiple"] == 0) {
                    $query = "SELECT `proxy_id` FROM `community_polls_responses`, `community_polls_results`\n\t\t\t\t\t\t\tWHERE `cpolls_id` = " . $result['cpolls_id'] . "\n\t\t\t\t\t\t\tAND `community_polls_responses`.`cpresponses_id` = `community_polls_results`.`cpresponses_id`\n\t\t\t\t\t\t\tAND `proxy_id` = " . $db->qstr($ENTRADA_USER->getActiveId()) . "";
                    if ($multiResults = $db->GetAll($query)) {