Beispiel #1
0
		select: function( event, ui ) {
			$( "#activity_type" ).val( ui.item.type );
			$( "#activity_type_id" ).val( ui.item.activity_type_id );
			return false;
		}
	}).data( "autocomplete" )._renderItem = function( ul, item ) {
		return $( "<li>" )
		.append( "<a>" + item.type + (item.nzcf_status==<?php 
    echo ATC_ACTIVITY_RECOGNISED;
    ?>
?" (Recognised)":" (Authorised)")+"</a>" )
		.appendTo( ul );
	} 
	
	var officers = jQuery.parseJSON( '<?php 
    echo str_replace("'", "\\'", json_encode($ATC->get_personnel(null, 'ASC', ATC_USER_GROUP_OFFICERS . ',' . ATC_USER_LEVEL_EMRG_CONTACT)));
    ?>
' );
	// Autocompletes need a label field to search against
	$.each(officers, function(){
		$(this)[0].label = $(this)[0].rank + " " + $(this)[0].lastname + ", " + $(this)[0].firstname;
	});
	$('#personnel_name').autocomplete({ 
		minLength: 0,
		source: officers,
		focus: function( event, ui ) {
			$( "#personnel_name" ).val( ui.item.lastname+", "+ui.item.firstname );
			return false;
		},
		select: function( event, ui ) {
			$( "#personnel_name" ).val( ui.item.lastname+", "+ui.item.firstname );
<?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) {