Exemple #1
0
    }
    echo "&amp;mode=approval'>{$strApproveHolidays}</a>";
}
echo "</p>\n";
// Entitlement
if ($user == $sit[2] or $approver == TRUE) {
    // Only shown when viewing your own holidays or when you're an approver
    $holiday_resetdate = user_holiday_resetdate($user);
    echo "<table align='center' width='450'>\n";
    echo "<tr><th class='subhead'>{$strHolidays}</th></tr>\n";
    echo "<tr class='shade1'><td><strong>{$strHolidayEntitlement}</strong> ";
    printf("({$strUntilX})", date($CONFIG['dateformat_shortdate'], $holiday_resetdate));
    echo ":</td></tr>\n";
    echo "<tr class='shade2'><td>";
    if ($holiday_resetdate != '' and $holiday_resetdate > 0 and $holiday_resetdate >= $now) {
        $entitlement = user_holiday_entitlement($user);
        $totalholidaystaken = user_count_holidays($user, HOL_HOLIDAY, 0, array(HOL_APPROVAL_GRANTED));
        $holidaystaken = user_count_holidays($user, HOL_HOLIDAY, $holiday_resetdate, array(HOL_APPROVAL_GRANTED));
        $awaitingapproval = user_count_holidays($user, HOL_HOLIDAY, 0, array(HOL_APPROVAL_NONE));
        echo "{$entitlement} {$strDays}, ";
        echo "{$holidaystaken} {$strtaken}, ";
        printf($strRemaining, $entitlement - $holidaystaken);
        if ($awaitingapproval > 0) {
            echo ", {$awaitingapproval} {$strAwaitingApproval} ";
        }
        if ($totalholidaystaken > $holidaystaken) {
            $moreholstaken = $totalholidaystaken - $holidaystaken;
            echo "<br />+ {$moreholstaken} {$strtakennextperiod}";
        }
    }
    echo "</td></tr>\n";
 echo "</td></tr>\n";
 echo "<tr><th>{$strSource}</th><td>{$user->source}</td></th>";
 echo "<tr><th>{$strJobTitle}</th>";
 echo "<td>";
 if ($_SESSION['user_source'] != 'sit' and !empty($CONFIG['ldap_jobtitle'])) {
     echo $user->jobtitle;
 } else {
     echo "<input maxlength='50' name='jobtitle' size='30' type='text' ";
     echo "value=\"{$user->jobtitle}\" />";
 }
 echo "</td></tr>\n";
 echo "<tr><th>{$strQualifications} " . help_link('QualificationsTip') . "</th>";
 echo "<td><input maxlength='100' size='100' name='qualifications' value='{$user->qualifications}' /></td></tr>\n";
 echo "<tr><th>{$strEmailSignature} " . help_link('EmailSignatureTip') . "</th>";
 echo "<td><textarea name='signature' rows='4' cols='40'>" . strip_tags($user->signature) . "</textarea></td></tr>\n";
 $entitlement = user_holiday_entitlement($edituserid);
 if ($edituserpermission && $edituserid != $sit[2]) {
     echo "<tr><th>{$strHolidayEntitlement}</th><td>";
     echo "<input type='text' name='holiday_entitlement' value='{$entitlement}' size='2' /> {$strDays}";
     echo "</td></tr>\n";
     echo "<tr><th>{$strStartDate} " . help_link('UserStartdate') . "</th>";
     echo "<td><input type='text' name='startdate' id='startdate' size='10' ";
     echo "value='{$user->user_startdate}'";
     echo "/> ";
     echo date_picker('edituser.startdate');
     echo "</td></tr>\n";
 } elseif ($entitlement > 0) {
     $holiday_resetdate = user_holiday_resetdate($edituserid);
     $holidaystaken = user_count_holidays($edituserid, HOL_HOLIDAY, $holiday_resetdate);
     echo "<tr><th>{$strHolidayEntitlement}</th><td>";
     echo "{$entitlement} {$strDays}, ";
 case 'save':
     $max_carryover = cleanvar($_REQUEST['max_carryover']);
     $archivedate = strtotime($_REQUEST['archivedate']);
     if ($archivedate < 1000) {
         $archivedate = $now;
     }
     $default_entitlement = cleanvar($_REQUEST['default_entitlement']);
     $sql = "SELECT * FROM `{$dbUsers}` WHERE status >= 1";
     $result = mysql_query($sql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_WARNING);
     }
     while ($users = mysql_fetch_object($result)) {
         $fieldname = "user{$users->id}";
         if ($_REQUEST[$fieldname] == 'yes') {
             $orig_entitlement = user_holiday_entitlement($users->id);
             $used_holidays = user_count_holidays($users->id, 1, $archivedate);
             $remaining_holidays = $orig_entitlement - $used_holidays;
             if ($remaining_holidays < $max_carryover) {
                 $carryover = $remaining_holidays;
             } else {
                 $carryover = $max_carryover;
             }
             $new_entitlement = $default_entitlement + $carryover;
             // Archive previous holiday
             $hsql = "UPDATE `{$dbHolidays}` SET approved = approved+10 ";
             $hsql .= "WHERE approved < 10 AND userid={$users->id} ";
             $hsql .= "AND date < FROM_UNIXTIME({$archivedate})";
             mysql_query($hsql);
             if (mysql_error()) {
                 trigger_error(mysql_error(), E_USER_ERROR);
Exemple #4
0
//
// Included by ../calendar.php
// Prevent script from being run directly (ie. it must always be included
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
    exit;
}
// Display year calendar
if ($type < HOL_PUBLIC) {
    echo "<h2>{$strCalendar}: ";
    if ($user == 'all' && $approver == TRUE) {
        echo $strAll;
    } else {
        echo user_realname($user, TRUE);
    }
    if ($type == HOL_HOLIDAY) {
        echo "<p align='center'>" . sprintf($strUsedNofNDaysEntitlement, user_count_holidays($user, $type), user_holiday_entitlement($user)) . "<br />";
    }
    echo appointment_type_dropdown($type, 'year');
    $sql = "SELECT * FROM {$dbHolidays} WHERE userid='{$user}' AND approved=0 AND type='{$type}'";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
    }
    if (mysql_num_rows($result)) {
        echo "<table align='center'>";
        echo "<tr class='shade2'><td><strong>{$strAwaitingApproval}</strong>:</td></tr>";
        echo "<tr class='shade1'><td>";
        while ($dates = mysql_fetch_array($result)) {
            echo date('l ', $dates['startdate']);
            if ($dates['length'] == 'am') {
                echo "{$strMorning} ";