コード例 #1
0
function add_to_team($user_id, $tl_id)
{
    //Make sure the user is not a team leader
    if (check_supervisor($user_id)) {
        $_SESSION['notifications'][] = "That user is a team leader!";
    } else {
        //If he's already part of a team, drop him from that team.
        if (!is_orphan($user_id)) {
            remove_from_team($user_id);
        }
        $sql = "INSERT INTO teams (tl_id,user_id) VALUES (" . $tl_id . ',' . $user_id . ")";
        $_SESSION['dbconn']->query($sql) or die("Error adding to team: " . $_SESSION['dbconn']->error);
        $_SESSION['notifications'][] = "Added user to team";
    }
}
コード例 #2
0
include_php_dir("includes");

mysql_init();

document_header();
echo include_javascript_dir("js",$debug);
echo include_stylesheet_dir("stylesheets",$debug);

check_validated();
//Any pre-page logic should go here!

if (isset($_POST['teamchange-submit']))
	add_to_team($_POST['user_id'],$_POST['tl_id']);

if (isset($_POST['teamremove-submit']))
	remove_from_team($_POST['user_id']);

open_page("Manage Teams");	
draw_page();
close_page();
ob_end_flush(); // Flush the buffer out to client
document_footer(); mysql_end();


function draw_page() 
{	
?>
	<div class="container">

		<?php open_panel("teamlist", "Teams", false) ?>
		<div class="row">
コード例 #3
0
function make_super($user_id)
{
    if (check_supervisor($user_id)) {
        $_SESSION['notifications'][] = "Error, that user is already a supervisor!";
    } else {
        if (check_app_admin($user_id)) {
            $_SESSION['notifications'][] = "Error, that user is an admin.  Please remove that user from admins first.";
        } else {
            //First, remove the user from a team, if he's in one.
            remove_from_team($user_id);
            $sql = "INSERT INTO app_supervisor VALUES (" . $user_id . ")";
            $result = $_SESSION['dbconn']->query($sql) or die("Error making supervisor: " . $_SESSION['dbconn']->error);
            $_SESSION['notifications'][] = "Added user to supervisors";
        }
    }
}