function load_pocket_card($zone)
{
    $pocket_card = array();
    // Load the background image
    $pocket_card = load_card_config($zone);
    $pocket_card['image'] = @imagecreatefrompng($pocket_card['image_filename']);
    if (!$pocket_card['image']) {
        bad_image("Error loading " . $pocket_card['image_filename']);
    }
    return $pocket_card;
}
Beispiel #2
0
    imagestring($img, 2, 5, 50, $msg, $tc);
    header('Content-Type: image/gif');
    imagegif($img);
    exit;
}
/***********************************************************************************/
/***********************************************************************************/
/***********************************************************************************/
$input_array = $_GET['q'];
// 'q' is a CSV list of the number of raps from each seat (Seat #0 - #9)
$raps_per_seat = explode(',', $input_array);
$helicopter_img_filename = "../images/fav_position.png";
// Load the background image
$helicopter = @imagecreatefrompng($helicopter_img_filename);
if (!$helicopter) {
    bad_image("Error loading " . $helicopter_img_filename);
}
// Define the starting coordinates for each of the text fields in the image
// These coordinates will be adjusted depending on the number of digits that
// need to fit into the text field
// Seats are numbered as follows (this number corresponds to 'seat_num' in the $raps_by_seat array):
/*------------------------------------------------------
			 MEDIUM						LIGHT
	0		1		2		3

		4				5				8	9

		6				7

--------------------------------------------------------*/
$seat_coords = array(array('x' => 21, 'y' => 84), array('x' => 50, 'y' => 84), array('x' => 80, 'y' => 84), array('x' => 110, 'y' => 84), array('x' => 35, 'y' => 131), array('x' => 93, 'y' => 131), array('x' => 35, 'y' => 159), array('x' => 93, 'y' => 159), array('x' => 187, 'y' => 97), array('x' => 228, 'y' => 97));
Beispiel #3
0
	
		4				5				8	9
		
		6				7

--------------------------------------------------------*/
$seat_coords = array(array('x' => 21, 'y' => 84), array('x' => 50, 'y' => 84), array('x' => 80, 'y' => 84), array('x' => 110, 'y' => 84), array('x' => 35, 'y' => 131), array('x' => 93, 'y' => 131), array('x' => 35, 'y' => 159), array('x' => 93, 'y' => 159), array('x' => 187, 'y' => 97), array('x' => 228, 'y' => 97));
$seats = array('light' => array('bench' => array('1' => array('left' => array('raps' => 0, 'seat_num' => 8), 'right' => array('raps' => 0, 'seat_num' => 9))), 'hellhole' => array('1' => array('left' => array('raps' => 0, 'seat_num' => 8), 'right' => array('raps' => 0, 'seat_num' => 9)))), 'medium' => array('bench' => array('1' => array('left' => array('raps' => 0, 'seat_num' => 0), 'right' => array('raps' => 0, 'seat_num' => 3)), '2' => array('left' => array('raps' => 0, 'seat_num' => 1), 'right' => array('raps' => 0, 'seat_num' => 2)), '3' => array('left' => array('raps' => 0, 'seat_num' => 4), 'right' => array('raps' => 0, 'seat_num' => 5))), 'hellhole' => array('1' => array('left' => array('raps' => 0, 'seat_num' => 0), 'right' => array('raps' => 0, 'seat_num' => 3)), '2' => array('left' => array('raps' => 0, 'seat_num' => 4), 'right' => array('raps' => 0, 'seat_num' => 5)), '3' => array('left' => array('raps' => 0, 'seat_num' => 6), 'right' => array('raps' => 0, 'seat_num' => 7)))));
$heli_types = array('1' => 'heavy', '2' => 'medium', '3' => 'light');
// Match helicopter type number with their type description
$raps_by_seat = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// This array is used to consolidate redundant entries in the $raps_by_seat array so that each seat has only one entry
$query = "\n\tSELECT rappels.door, rappels.stick, aircraft_types.type, aircraft_types.configuration, COUNT( rappels.id ) as rap_count\n\tFROM rappels\n\tINNER JOIN operations ON rappels.operation_id = operations.id\n\tINNER JOIN aircraft_types ON operations.aircraft_type_config = aircraft_types.id\n\t\n\tWHERE hrap_id = " . $_SESSION['current_view']['hrap']->get('id') . "\n\tGROUP BY TYPE , configuration, stick, door";
$result = mydb::cxn()->query($query);
if (mydb::cxn()->error != NULL) {
    bad_image("Error retrieving HRAP stats");
}
while ($row = $result->fetch_assoc()) {
    $raps_by_seat[$seats[$heli_types[$row['type']]][$row['configuration']][$row['stick']][$row['door']]['seat_num']] += $row['rap_count'];
}
// Define the font color
$fc = imagecolorallocate($helicopter, 50, 50, 50);
foreach ($raps_by_seat as $seat_num => $rap_count) {
    $x = $seat_coords[$seat_num]['x'];
    $y = $seat_coords[$seat_num]['y'];
    $x = $x - 4 * (strlen($raps_by_seat[$seat_num]) - 1);
    // Move the starting point LEFT 4 pixels for each digit in excess of 1
    imagestring($helicopter, 4, $x, $y, $raps_by_seat[$seat_num], $fc);
}
// Write finished image to browser
header('Content-Type: image/gif');