Exemplo n.º 1
0
function calculate_couples($id)
{
    $polls = get_polls();
    foreach ($polls as $poll) {
        mysql_query("UPDATE poll SET Status = (SELECT ID FROM poll_status WHERE Name = 'Ingestuurd') WHERE Status = (SELECT ID FROM poll_status WHERE Name = 'Opgeslagen')");
    }
    //init($users);
    $id = (int) $id;
    $success = 0;
    $iteration = 0;
    $users = get_users_order_by_id();
    while ($success == 0) {
        //echo "Nieuwe berekening starten<br />";
        calculate_possible_polls($users);
        $success = 1;
        foreach ($users as $user) {
            if (get_number_of_candidate_reviews_given($user['ID']) < mysql_result(mysql_query("SELECT Value FROM parameter WHERE Short_name = 'Reviews_to_give'"), 0)) {
                $success = 0;
                //echo "Oorzaak: if te weinig reviews geven, user: ".$user['ID'].'<br />';
                break;
            }
            if (get_number_of_candidate_reviews_received($user['ID']) < mysql_result(mysql_query("SELECT Value FROM parameter WHERE Short_name = 'Reviews_to_receive'"), 0)) {
                $success = 0;
                //echo "Oorzaak: if te weinig reviews krijgen, user: ".$user['ID'].'<br />';
                break;
            }
            /*if(get_number_of_candidate_poll_managers($user['ID']) > mysql_result(mysql_query("SELECT Value FROM parameter WHERE Short_name = 'Reviews_by_not_teammanager'"),0)){
            			$success = 0;
            			//echo "Oorzaak: if Maximum aantal reviews door (niet eigen) manager, user: ".$user['ID'].'<br />';
            			break;
            		}*/
            if (get_number_of_candidate_poll_team_members($user['ID']) > mysql_result(mysql_query("SELECT Value FROM parameter WHERE Short_name = 'Reviews_own_department'"), 0)) {
                $success = 0;
                //echo "Oorzaak: if Maximum aantal reviews uit eigen departement, user: ".$user['ID'].'<br />';
                break;
            }
        }
    }
    mysql_query("UPDATE batch SET Status = (SELECT ID FROM batch_status WHERE Name = 'Calculate') WHERE ID = {$id}");
    /*mysql_query("INSERT INTO poll (Reviewer, Reviewee, Status, Time_created, Last_update, Batch) VALUES ((SELECT Reviewer FROM preferred_poll),(SELECT Reviewee FROM preferred_poll),(SELECT ID FROM poll_status WHERE Name = 'Niet Ingevuld'),'$date','$date', $batch)");
    	$date = create_date();*/
}
Exemplo n.º 2
0
            $county = $_GET['county'];
        } else {
            $county = -1;
        }
        if (isset($_GET['city'])) {
            $city = $_GET['city'];
        } else {
            $city = -1;
        }
        if (isset($_GET['sort_by'])) {
            $sort_by = $_GET['sort_by'];
        } else {
            $sort_by = 'default';
        }
    }
    get_polls($conn, $state, $county, $city, $sort_by);
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
    return;
}
$conn = null;
function get_polls($conn, $state_id, $county_id, $city_id, $sort_by)
{
    switch ($sort_by) {
        case "title":
            $order_by = "polls.title ASC";
            break;
        case "votes":
            $order_by = "polls.votes DESC";
            break;
        default:
Exemplo n.º 3
0
       class="am-intro am-cf am-intro-default"
       >
      <div class="am-intro-hd">
        <h2 class="am-intro-title">3</h2>
            <a class="am-intro-more am-intro-more-top " href="/3.php">查看事迹简介</a>
      </div>

    <div class="am-g am-intro-bd">
        <div
          class="am-u-lg-12"><img src="/3.jpg" alt="3" /></div>
        <div
            class="am-u-lg-12"><p><br>3号候选人:<br></p></div>
    </div>
    <div class="am-intro-more-bottom">
        <div><p>实时票数:<?php 
echo get_polls(3);
?>
<br><input type="checkbox" name="vote[]" onclick="checkit(this)" value="3" >
&nbsp; 选择他</p>
        </div>
      </div>
  </div>
        </div>
      </div>
<!-- <header class="am-topbar am-topbar-fixed-top">
  <div class="am-container">      
      <div class="am-topbar-right">
        <input type="submit" value="提交投票" class="am-btn am-btn-secondary am-topbar-btn am-btn-sm am-btn-default ">
      </div>
    </div>
    </div>
Exemplo n.º 4
0
      <ul id="qa-tab-content" class="uk-switcher">
        <li></li>
        <li class="uk-active"><div class="uk-grid"><?php 
    get_all();
    ?>
</div></li>
        <li><div class="uk-grid"><?php 
    new_question_form();
    ?>
</div></li>
        <li><div class="uk-grid"><?php 
    get_questions();
    ?>
</div></li>
        <li><div class="uk-grid"><?php 
    get_polls();
    ?>
</div></li>
        <li><?php 
    include "user.php";
    ?>
</li>
        <li></li>
      </ul>
    </div><!--div class="uk-width-1-4"></div-->
      <?php 
} else {
    modal("", "setTimeout(function(){window.location = '/login.php'},0);");
}
?>
</div>