コード例 #1
0
ファイル: modules.php プロジェクト: bitsapien/stuchx
function role_expiry($mysqli)
{
    include 'db-config.php';
    // get the person for whom this position as meant to be
    $getPosName = $mysqli->prepare('SELECT position_lastUpdate,position_deletionScore,position_id FROM position WHERE 1') or die('Couldn\'t check the vote.');
    $getPosName->execute();
    $getPosName->store_result();
    $getPosName->bind_result($pos_last_updates, $pos_deletion_score, $pos_id);
    $base = 0;
    while ($getPosName->fetch()) {
        $then = strtotime($pos_last_updates);
        $now = time();
        $diff = $now - $then;
        $year_diff = date('Y', $diff);
        $mon_diff = date('n', $diff);
        $day_diff = date('j', $diff);
        // checking if 7 days have expired since last update
        if ($year_diff > 1970 || $mon_diff > 1) {
            $day_diff = 8;
        }
        if ($day_diff > $expiry_days && is_role_active($pos_id, $mysqli) || $pos_deletion_score > $position_deletion_ceil) {
            // check if he is active or his deletion status is high
            $sql = "DELETE FROM position WHERE position_id='" . $pos_id . "'";
            // delete from positions
            if ($mysqli->query($sql) === false) {
                trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $mysqli->error, E_USER_ERROR);
            } else {
                $affected_rows = $mysqli->affected_rows;
            }
            $sql = "DELETE FROM approval WHERE app_position_id='" . $pos_id . "'";
            // delete from approvals
            if ($mysqli->query($sql) === false) {
                trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $mysqli->error, E_USER_ERROR);
            } else {
                $affected_rows = $mysqli->affected_rows;
            }
        }
    }
}
コード例 #2
0
ファイル: position_all.php プロジェクト: bitsapien/stuchx
	      ';
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 {
        $tr = '<tr class="alert alert-warning">';
    }
    if ($pscore == "0") {
        $tr = '<tr class="alert alert-danger">';
    }
    // extract positions
    $pos_rows .= $tr . '<td>' . $pname . '</td>' . '<td>' . $padded . '</td>' . $vote_td . '</tr>';
}
$pos_rows .= "</table>";
foreach ($roles as $key => $val) {
    if ($key != "") {
        $list .= "<option>" . $key . "</option>";
コード例 #3
0
ファイル: profile.php プロジェクト: bitsapien/stuchx
while ($getUSR->fetch()) {
    $name_o = $usr_name;
    $ol_o = $usr_ol;
    $dp_o = $usr_dp;
    $sf_o = $usr_sf;
    $id_o = $usr_id;
    $desc_o = $usr_desc;
    $roll_o = $usr_roll;
}
// Listing Positions
$id = $mysqli->real_escape_string($_GET['id']);
$sql = "SELECT position_id, position_name,position_code FROM position WHERE position_people_id='" . $id . "'";
$getPOS = query_exec($sql, $mysqli);
$getPOS->bind_result($pos_id, $pos_name, $pos_code);
while ($getPOS->fetch()) {
    if (is_role_active($pos_id, $mysqli)) {
        $pos_o .= "/" . $pos_name . " ";
    }
}
if ($pos_o == '') {
    $pos_o = 'Contributor';
}
// Listing contacts
$sql = "SELECT contact_link FROM contact WHERE contact_people_id='" . $id . "'";
$getUSR = query_exec($sql, $mysqli);
$getUSR->bind_result($con_link);
while ($getUSR->fetch()) {
    $con_o .= '<p>' . format_contact($con_link, $name_o) . '</p>';
}
// Listing blogs
$getBlogList = $mysqli->prepare('SELECT blog_id,blog_title FROM blog WHERE blog_final=1 AND blog_by="' . $id . '" ;') or die($mysqli->error);
コード例 #4
0
ファイル: about.php プロジェクト: bitsapien/stuchx
    if ($dir_sf == 'S') {
        if (is_role_active($dir_pos_id, $mysqli)) {
            $dir_card['student'][$DIR_counter] = '<div class="col-sm-6"><div class="col-sm-2" >
						<a href="profile.php?id=' . $dir_id . '"><img src="' . $dir_dp . '" class="img-responsive" /></a>
					</div>
					<div class="col-sm-10">
						<h3>' . $dir_name . '</h3>
						<small> ' . $dir_pos_name . ' (Student) </small>
						<p>' . $dir_ol . '</p><br>
					</div></div>';
        } else {
            $dir_card['student'][$DIR_counter] = '';
        }
    } else {
        if ($edc_sf == 'F') {
            if (is_role_active($dir_id, $mysqli)) {
                $dir_card['faculty'][$DIR_counter] = '<div class="col-sm-6"><div class="col-sm-2" >
						<a href="profile.php?id=' . $dir_id . '"><img src="' . $edc_dp . '" class="img-responsive" /></a>
					</div>
					<div class="col-sm-10">
						<h3>' . $edc_name . '</h3>
						<small> ' . $dir_pos_name . ' (Faculty) </small>
						<p>' . $edc_ol . '</p><br>
					</div></div>';
            } else {
                $dir_card['faculty'][$DIR_counter] = '';
            }
        }
    }
    $DIR_counter++;
}
コード例 #5
0
ファイル: position_all.php プロジェクト: bitsapien/stuchx
	      </thead>
	      ';
while ($getInfo->fetch()) {
    // votes
    $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>' . '</td>';
    } else {
        if ($res['voted'] == 1) {
            $vote_td = '<td>' . '<a href="#" onclick="vote_up_dn(\'' . $pid . '\');" ><span class="fa fa-arrow-down"></span></a>' . '</td>';
        } else {
            $vote_td = '<td>' . '<span class="fa fa-times"></span>' . '</td>';
        }
    }
    // check whether eligible
    $active = is_role_active($pid, $mysqli);
    if ($active) {
        $tr = '<tr>';
    } else {
        $tr = '<tr class="alert alert-warning">';
    }
    if ($pscore == "0") {
        $tr = '<tr class="alert alert-danger">';
    }
    // extract positions
    $pos_rows .= $tr . '<td>' . $pname . '</td>' . '<td>' . $padded . '</td>' . $vote_td . '</tr>';
}
$pos_rows .= "</table>";
foreach ($roles as $key => $val) {
    if ($key != "") {
        $list .= "<option>" . $key . "</option>";