示例#1
0
<?php

require_once "atc.class.php";
$ATC = new ATC();
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
if (!isset($_GET['showall'])) {
    $_GET['showall'] = 0;
}
$user = $ATC->get_personnel($id, 'ASC', null, (int) $_GET['showall']);
$ATC->gui_output_page_header('Personnel');
if (is_object($user)) {
    ?>
		<div id="personnelform">
			<h2 href="personal.php?id=<?php 
    echo $user->personnel_id;
    ?>
"> Personal details &mdash; <?php 
    echo $user->rank . ' ' . $user->display_name;
    ?>
 </h2>
			<div id="personal">
			</div>
	
			<h2 href="nok.php?id=<?php 
    echo $user->personnel_id;
    ?>
"> Next of Kin </h2>
			<div id="nok">
			</div>
	
			<h2 href="attendance.php?id=<?php 
<?php

require_once "atc.class.php";
$ATC = new ATC();
$id = isset($_GET['id']) ? $_GET['id'] : null;
$what = isset($_GET['what']) && trim(strtolower($_GET['what'])) == 'personal' ? 'personal' : 'nok';
$how = isset($_GET['how']) && trim(strtolower($_GET['how'])) == 'email' ? 'email' : 'sms';
$returnvalue = array();
if (is_array($id)) {
    foreach ($id as $personnel) {
        if ($ATC->user_has_permission(ATC_PERMISSION_PERSONNEL_VIEW, $personnel)) {
            switch (strtolower(trim($what))) {
                case 'personal':
                    $details = $ATC->get_personnel($personnel, 'ASC', null);
                    if ($details && isset($details->display_name)) {
                        switch (strtolower(trim($how))) {
                            case 'sms':
                                if ($details->mobile_phone) {
                                    $returnvalue[] = $details->mobile_phone;
                                }
                                break;
                            case 'email':
                                $returnvalue[] = '"' . $details->rank . ' ' . $details->display_name . '" <' . $details->email . '>';
                                break;
                            default:
                                throw new ATCExceptionBadData('Unknown "how" URL variable.');
                        }
                    }
                    break;
                case 'nok':
                    $details = $ATC->get_nok($personnel);
示例#3
0
<?php

require_once "atc.class.php";
$ATC = new ATC();
if (!isset($_GET['action'])) {
    $id = isset($_GET['id']) ? (int) $_GET['id'] : null;
    $user = $ATC->get_personnel($id);
    if (isset($_POST['personnel_id']) && isset($_GET['id'])) {
        foreach ($_POST as $var => $val) {
            $user->{$var} = $val;
        }
        if (!isset($_POST['enabled']) || !$_POST['enabled']) {
            $user->enabled = 0;
        }
        if (!isset($_POST['social_media_approved']) || !$_POST['social_media_approved']) {
            $user->social_media_approved = 0;
        }
        try {
            $ATC->set_personnel($user);
        } catch (ATCExceptionInsufficientPermissions $e) {
            header("HTTP/1.0 401 Unauthorised");
            echo 'Caught exception: ', $e->getMessage(), "\n";
            exit;
        } catch (ATCExceptionDBError $e) {
            header("HTTP/1.0 500 Internal Server Error");
            echo 'Caught exception: ', $e->getMessage(), "\n";
            exit;
        } catch (ATCExceptionDBConn $e) {
            header("HTTP/1.0 500 Internal Server Error");
            echo 'Caught exception: ', $e->getMessage(), "\n";
            exit;
示例#4
0
    $targettime = strtotime($_GET['termstart']);
}
// Try to find our beginning/end dates for a term that's been requested
foreach ($terms as $term) {
    if ($term->startdate <= $targettime && $term->enddate + (24 + 60 + 60) >= $targettime) {
        $termstart = date('Y-m-d', $term->startdate);
        $termend = date('Y-m-d', $term->enddate);
        break;
    }
}
// Default to all this year if we can't find a term start time matching what we asked for.
if (!isset($termstart)) {
    $termstart = date('Y') . '-01-01';
    $termend = date('Y') . '-12-31';
}
$users = $ATC->get_personnel(isset($_GET['id']) ? (int) $_GET['id'] : null, 'ASC', isset($_GET['id']) ? null : ATC_USER_GROUP_PERSONNEL, false);
if (!is_array($users)) {
    $foo[] = $users;
    $users = $foo;
}
$calendar = $ATC->get_attendance_register(date('Y') . '-01-01', date('Y') . '-12-31');
if (!isset($_GET['id'])) {
    $ATC->gui_output_page_header('Attendance');
    ?>
		<form name="datepicker" id="datepicker">
			<fieldset>
				<legend>Choose term</legend>
				<label for="term">Pick a term:</label>
				<select name="termstart" id="term">
					<?php 
    $y = 0;