Esempio n. 1
0
INNER JOIN people ppl ON pos.position_addedBy = ppl.people_id WHERE pos.position_people_id=?') or die('Couldn\'t check the profile');
$getInfo->bind_param('s', $id);
$getInfo->execute();
$getInfo->store_result();
$getInfo->bind_result($pid, $pname, $pcode, $padded, $ppl_id);
$pos_rows = '<table class="table"><thead>
			<tr>
			<th> Name </th>
			<th> Added By</th>
			<th> Vote </th>
			</tr>
	      </thead>
	      ';
while ($getInfo->fetch()) {
    // votes
    $pscore = get_percent_on_position($pid, $mysqli, $ppl_id);
    $res = check_vote($pid, $mysqli);
    if (!$res['voted']) {
        $vote_td = '<td>' . '<a href="#" onclick="vote_up_dn(\'' . $pid . '\');" ><span class="fa fa-arrow-up"></span></a> <b>' . $pscore * 100 . '%</b>' . '</td>';
    } else {
        if ($res['voted'] == 1) {
            $vote_td = '<td>' . '<a href="#" onclick="vote_up_dn(\'' . $pid . '\');" ><span class="fa fa-arrow-down"></span></a> <b>' . $pscore * 100 . '%</b>' . '</td>';
        } else {
            $vote_td = '<td><b>' . $pscore * 100 . '%</b></td>';
        }
    }
    // check whether eligible
    $active = is_role_active($pid, $mysqli, $ppl_id);
    if ($active) {
        $tr = '<tr>';
    } else {
Esempio n. 2
0
function is_role_active($app_pos_id, $mysqli, $ppl_id)
{
    include 'db-config.php';
    // get the person for whom this position as meant to be
    $getPos = $mysqli->prepare('SELECT position_code FROM position WHERE position_id=?') or die('Couldn\'t check the vote.');
    $getPos->bind_param('s', $app_pos_id);
    // getting whether this person as voted for the position or not
    $getPos->execute();
    $getPos->store_result();
    $getPos->bind_result($pos_code);
    $app_score = get_percent_on_position($app_pos_id, $mysqli, $ppl_id);
    while ($getPos->fetch()) {
        if ($app_score >= $min_score[$pos_code]) {
            return 1;
        } else {
            return 0;
        }
    }
}