Exemplo n.º 1
0
<?php

require_once "atc_finance.class.php";
$ATC = new ATC_Finance();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['startdate']) && strtotime($_POST['startdate'])) {
        try {
            $ATC->set_activity($_POST['activity_id'], $_POST['startdate'], $_POST['enddate'], $_POST['title'], $ATC->set_location($_POST['location_id'], $_POST['location'], null), $_POST['personnel_id'], $_POST['2ic_personnel_id'], $ATC->set_activity_type($_POST['activity_type_id'], $_POST['activity_type'], null), $_POST['dress_code'], $_POST['attendees'], $_POST['cost']);
        } catch (ATCExceptionInsufficientPermissions $e) {
            header("HTTP/1.0 401 Unauthorised");
            echo 'Caught exception: ', $e->getMessage(), "\n";
        } catch (ATCExceptionDBError $e) {
            header("HTTP/1.0 500 Internal Server Error");
            echo 'Caught exception: ', $e->getMessage(), "\n";
        } catch (ATCExceptionDBConn $e) {
            header("HTTP/1.0 500 Internal Server Error");
            echo 'Caught exception: ', $e->getMessage(), "\n";
        } catch (ATCException $e) {
            header("HTTP/1.0 400 Bad Request");
            echo 'Caught exception: ', $e->getMessage(), "\n";
        } catch (Exception $e) {
            header("HTTP/1.0 500 Internal Server Error");
            echo 'Caught exception: ', $e->getMessage(), "\n";
        }
    } elseif (isset($_POST["attendance_register"])) {
        try {
            $register = array();
            foreach ($_POST as $key => $value) {
                if (substr($key, 0, strlen('attendance_')) == 'attendance_') {
                    $foo = explode("_", $key);
                    // Exclude the attendance_register entry, only go if we've got a real person record
Exemplo n.º 2
0
<?php

require_once "atc_documentation.class.php";
require_once "atc_finance.class.php";
$ATC = new ATC_Documentation();
$ATC_Finance = new ATC_Finance();
$ATC->gui_output_page_header('Home');
try {
    $activities = $ATC->get_activities(date('Y-m-d'), 30);
    if (count($activities)) {
        ?>
		
			<h2> Upcoming events</h2>
			<table class="tablesorter">
				<thead>
					<tr>
						<th rowspan="2"> Activity </th>
						<th rowspan="2"> Officer In Charge </th>
						<th rowspan="2"> 2<sup>nd</sup> Contact </th>
						<th colspan="2"> Date </th>
					</tr>
					<tr>
						<th> Assemble </th>
						<th> Dispersal </th>
					</tr>
				</thead>
				<tbody>
					<?php 
        foreach ($activities as $obj) {
            echo '<tr>';
            echo '	<td' . (array_search($ATC->get_currentuser_id(), explode(',', $obj->attendees)) !== false ? ' class="highlighted"' : '') . '><!--<span class="ui-icon ui-icon-' . ($obj->nzcf_status == ATC_ACTIVITY_RECOGNISED ? 'radio-off" title="Recognised Activity"' : 'bullet" title="Authorised Activity"') . '" style="float:left">A</span> --><a href="activities.php?id=' . $obj->activity_id . '" class="activity edit">' . $obj->title . '</a></td>';
Exemplo n.º 3
0
				  	},
				  	close: function() { 
						$( this ).dialog( "destroy" ); 
				  	},
				  	open: function() {
				
					
					}
				});
				return false;
			});
		</script>
<?php 
} elseif (isset($_GET['action']) && $_GET['action'] == 'finance' && isset($_GET['id'])) {
    require_once "atc_finance.class.php";
    $ATC_Finance = new ATC_Finance();
    if ($ATC_Finance->user_has_permission(ATC_PERMISSION_FINANCE_VIEW, $_GET['id'])) {
        $payments = $ATC_Finance->get_account_history($_GET['id'], '1970-01-01', date('c'));
    }
    ?>
		<table class="tablesorter">
			<thead>
				<tr>
					<th> Date </th>
					<th> Amount </th>
					<th> Payment type </th>
					<th> Reference </th>
					<th> Recorded by </th>
					<!-- <?php 
    echo $ATC->user_has_permission(ATC_PERMISSION_FINANCE_EDIT) ? '<td><a href="personal.php?id=' . $_GET['id'] . '&amp;action=finance" class="button new">New</a></td>' : '';
    ?>
Exemplo n.º 4
0
			<label for="personnel">Personnel:</label>
			<input type="hidden" name="document" value="nzcf16" />
			<select name="personnel_id[]" multiple="multiple" required="required">
				<?php 
    foreach ($personnel as $obj) {
        echo '<option value="' . $obj->personnel_id . '"' . ($obj->enabled ? '' : ' class="ui-state-disabled"') . '>' . $obj->rank . ' ' . $obj->display_name . '</option>';
    }
    ?>
			</select>
			<button type="submit" class="update">Update</button>			
		</fieldset>
	</form>
<?php 
} else {
    require_once "atc_finance.class.php";
    $ATC_Finance = new ATC_Finance();
    // Create a PDF document for us to use
    require './fpdf17/fpdf.php';
    $footerstring = '';
    class PDF extends FPDF
    {
        // Page header
        function Header()
        {
            global $activity;
            $this->SetTextColor(0);
            $this->Image('49squadron.png', 175, 5, 25);
            // Line break
            $this->Ln(22);
        }
        function Footer()
Exemplo n.º 5
0
<?php

require_once "atc_finance.class.php";
$ATC = new ATC_Finance();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
        if (!$ATC->user_has_permission(ATC_PERMISSION_FINANCE_EDIT)) {
            throw new ATCExceptionInsufficientPermissions("Insufficient rights to view this page");
        }
        $ATC->add_payment($_POST['personnel_id'], $_POST['amount'], $_POST['reference'], $_POST['payment_type'], $_POST['term_id']);
    } catch (ATCExceptionInsufficientPermissions $e) {
        header("HTTP/1.0 401 Unauthorised");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    } catch (ATCExceptionDBError $e) {
        header("HTTP/1.0 500 Internal Server Error");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    } catch (ATCExceptionDBConn $e) {
        header("HTTP/1.0 500 Internal Server Error");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    } catch (ATCException $e) {
        header("HTTP/1.0 400 Bad Request");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    } catch (Exception $e) {
        header("HTTP/1.0 500 Internal Server Error");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }
    exit;
}
$ATC->gui_output_page_header('Finance');
if (!$ATC->user_has_permission(ATC_PERMISSION_FINANCE_VIEW)) {
    throw new ATCExceptionInsufficientPermissions("Insufficient rights to view this page");
Exemplo n.º 6
0
<?php

require_once "atc_finance.class.php";
$ATC = new ATC_Finance();
$CRLF = "\r\n";
try {
    if ($ATC->check_user_session($_GET['key'], ATC_SESSION_TYPE_CALENDAR)) {
        $ATC->become_user_from_session($_GET['key']);
        $activities = $ATC->get_activities();
        $mydetails = $ATC->get_personnel($ATC->get_currentuser_id());
        $users = array();
        $users[$ATC->get_currentuser_id()] = $mydetails;
    }
} catch (ATCExceptionInvalidUserSession $e) {
    if (substr($_SERVER['SCRIPT_NAME'], -9, 9) != "login.php") {
        header('Location: login.php', true, 302);
    }
}
header('Content-type: text/calendar');
header('Content-Disposition:inline; filename=49squadron_activities.ics');
//header('Content-type: text/text');
//header("Content-Disposition:inline;filename=49squadron_activities.ics");
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
echo "BEGIN:VCALENDAR" . $CRLF;
echo "VERSION:2.0" . $CRLF;
echo "METHOD:PUBLISH" . $CRLF;
echo "PRODID:-//github.com/PhilTanner/ATC_system//Activities Calendar- 49sqn.philtanner.com//EN" . $CRLF;
foreach ($activities as $obj) {