home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 April
/
CMCD0404.ISO
/
Software
/
Freeware
/
Programare
/
groupoffice-com-2.01
/
modules
/
projects
/
book.inc
< prev
next >
Wrap
Text File
|
2004-03-08
|
9KB
|
234 lines
<?php
/*
Copyright Intermesh 2003
Author: Merijn Schering <mschering@intermesh.nl>
Version: 1.0 Release date: 08 July 2003
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
*/
$time = get_time();
$day = date("j", $time);
$year = date("Y", $time);
$month = date("m", $time);
$date = date($_SESSION['GO_SESSION']['date_format'], $time);
if (isset($_REQUEST['delete_hours']))
{
$projects->delete_hours($_REQUEST['delete_hours']);
}
?>
<input type="hidden" name="post_action" />
<table border="0" cellpadding="0" cellspacing="0" height="300" width="100%">
<tr>
<td class="TableInside" valign="top">
<?php
if (isset($feedback)) echo $feedback;
if ($timer = $projects->get_timer($GO_SECURITY->user_id))
{
echo '<table border="0" class="alert"><tr><td><img src="'.$GO_THEME->images['alert'].'" border="0" /></td>'.
'<td><a class="normal" href="'.$_SERVER['PHP_SELF'].'?project_id='.$timer['project_id'].'&task=stop_timer">'.$pm_clocked_in.'</a></td></tr></table>';
}
?>
<table border="0" cellpadding="0" cellspacing="5" width="100%">
<?php
$pm_user_id = isset($_REQUEST['pm_user_id']) ? $_REQUEST['pm_user_id'] : $GO_SECURITY->user_id;
if ($GO_MODULES->write_permissions)
{
require_once($GO_CONFIG->class_path.'users.class.inc');
$users = new users();
$ab_module = $GO_MODULES->get_module('addressbook');
if ($pm_user_id > 0 && $user = $users->get_user($pm_user_id))
{
$middle_name = $user['middle_name'] == '' ? '' : $user['middle_name'].' ';
$user_name = $user['first_name'].' '.$middle_name.$user['last_name'];
}else
{
$user_name = isset($_REQUEST['user_name']) ? $_REQUEST['user_name'] : '';
}
echo '<tr><td><table border="0" cellpadding="0" cellspacing="0"><tr><td><a class="normal" href="javascript:popup(\''.$ab_module['url'].'select.php?users_only=true&multiselect=false&GO_HANDLER='.$GO_MODULES->url.'select_employer.php&pass_value=id\',\'550\',\'400\')"><img src="'.$GO_THEME->images['addressbook_small'].'" width="16" height="16" border="0" /></a> </td><td><a class="normal" href="javascript:popup(\''.$ab_module['url'].'select.php?users_only=true&multiselect=false&GO_HANDLER='.$GO_MODULES->url.'select_employer.php&pass_value=id\',\'550\',\'400\')">'.$pm_employee.'</a>: </td></tr></table></td>';
echo '<td><input type="hidden" value="'.$pm_user_id.'" name="pm_user_id" /><input type="hidden" value="'.$user_name.'" name="user_name" /><input type="text" name="user_name_text" class="textbox" style="width: 300px;" value="'.$user_name.'" disabled></td></tr>';
}else
{
echo '<input type="hidden" name="pm_user_id" value="'.$GO_SECURITY->user_id.'" />';
}
?>
<tr>
<td><?php echo $pm_starttime; ?>:</td>
<td>
<?php
$timer_start_date = isset($timer_start_time) ? date($_SESSION['GO_SESSION']['date_format'], $timer_start_time) : $date;
$start_date = isset($_POST['start_date']) ? $_POST['start_date'] : $timer_start_date;
$datepicker->print_date_picker('start_date', $_SESSION['GO_SESSION']['date_format'], $start_date);
echo ' ';
$hours = array("00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23", "24");
//$mins = array("00","15","30","45");
for ($i=0;$i<=60;$i++)
{
$text = strlen($i) < 2 ? '0'.$i : $i;
$mins[] = $text;
}
$hour = isset($timer_start_time) ? date('G', $timer_start_time) : 8;
$start_hour = isset($_POST['start_hour']) ? $_POST['start_hour'] : $hour;
$dropbox = new dropbox();
$dropbox->add_arrays($hours, $hours);
$dropbox->print_dropbox("start_hour", $start_hour);
echo ' : ';
$min = isset($timer_start_time) ? date('i', $timer_start_time) : 0;
$start_min = isset($_POST['start_min']) ? $_POST['start_min'] : $min;
$dropbox = new dropbox();
$dropbox->add_arrays($mins, $mins);
$dropbox->print_dropbox("start_min", $start_min);
?>
</td>
<td colspan="2">
</td>
</tr>
<tr><td colspan="3"> </td></tr>
<tr>
<td colspan="2">
<?php
$_COOKIE['registration_method_cookie'] = isset($_COOKIE['registration_method_cookie']) ? $_COOKIE['registration_method_cookie'] : 'endtime';
$registration_method = isset($_POST['registration_method']) ? $_POST['registration_method'] : $_COOKIE['registration_method_cookie'];
if ($registration_method == 'units')
{
$unit_check = 'checked';
$endtime_check = '';
}else
{
$unit_check = '';
$endtime_check = 'checked';
}
?>
<input type="radio" name="registration_method" value="endtime" onclick="javascript:toggle_registration_method(this.value)" <?php echo $endtime_check; ?> /><?php echo $pm_endtime; ?>
</td>
<td colspan="2">
<input type="radio" name="registration_method" value="units" onclick="javascript:toggle_registration_method(this.value)" <?php echo $unit_check; ?> /><?php echo $pm_units; ?>
</td>
</tr>
<tr>
<td><?php echo $pm_endtime; ?>:</td>
<td>
<?php
$timer_end_date = isset($timer_end_time) ? date($_SESSION['GO_SESSION']['date_format'], $timer_end_time) : $date;
$end_date = isset($_POST['end_date']) ? $_POST['end_date'] : $timer_end_date;
$datepicker->print_date_picker('end_date', $_SESSION['GO_SESSION']['date_format'], $end_date);
echo ' ';
$hour = isset($timer_end_time) ? date('G', $timer_end_time) : 17;
$end_hour = isset($_POST['end_hour']) ? $_POST['end_hour'] : $hour;
$dropbox = new dropbox();
$dropbox->add_arrays($hours, $hours);
$dropbox->print_dropbox("end_hour", $end_hour);
echo ' : ';
$min = isset($timer_end_time) ? date('i', $timer_end_time) : 0;
$end_min = isset($_POST['end_min']) ? $_POST['end_min'] : $min;
$dropbox = new dropbox();
$dropbox->add_arrays($mins, $mins);
$dropbox->print_dropbox("end_min", $end_min);
?>
</td>
<td>
<?php echo $pm_value; ?>:
</td>
<td>
<?php
$_COOKIE['unit_value_cookie'] = isset($_COOKIE['unit_value_cookie']) ? $_COOKIE['unit_value_cookie'] : '';
$unit_value = isset($_POST['unit_value']) ? $_POST['unit_value'] : $_COOKIE['unit_value_cookie'];
$dropbox = new dropbox();
for ($i=1;$i<=60;$i++)
{
$dropbox->add_value($i,$i);
}
$dropbox->print_dropbox('unit_value', $unit_value);
echo ' '.$pm_mins;
?>
</td>
</tr>
<tr>
<td><?php echo $pm_breaktime; ?>:</td>
<td>
<?php
$break_hours = isset($_POST['break_hours']) ? $_POST['break_hours'] : 0;
$dropbox = new dropbox();
$dropbox->add_arrays($hours, $hours);
$dropbox->print_dropbox("break_hours", $break_hours);
echo ' : ';
$break_mins = isset($_POST['break_mins']) ? $_POST['break_mins'] : 0;
$dropbox = new dropbox();
$dropbox->add_arrays($mins, $mins);
$dropbox->print_dropbox("break_mins", $break_mins);
?>
</td>
<td>
<?php echo $pm_units; ?>:
</td>
<td>
<?php
$units = isset($_POST['units']) ? $_POST['units'] : '';
?>
<input type="text" name="units" value="<?php echo $units; ?>" class="textbox" size="4" />
</td>
</tr>
<tr><td colspan="3"> </td></tr>
<tr>
<td valign="top"><?php echo $strComments; ?>:</td>
<td colspan="3">
<textarea class="textbox" name="comments" cols="40" rows="4"><?php if (isset($_POST['comments'])) echo $_POST['comments']; ?></textarea>
</td>
</tr>
<?php
echo '<tr><td colspan="4">';
$button = new button($cmdOk,"javascript:_save('save_hours', 'true')");
echo ' ';
$button = new button($cmdApply,"javascript:_save('save_hours', 'false')");
echo ' ';
$button = new button($cmdClose, "javascript:document.location='".$return_to."';");
echo '</td></tr>';
?>
</table>
</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
function toggle_registration_method(registration_method)
{
if (registration_method == "endtime")
{
document.projects_form.unit_value.disabled = true;
document.projects_form.units.disabled = true;
document.projects_form.end_hour.disabled = false;
document.projects_form.end_date.disabled = false;
document.projects_form.end_min.disabled = false;
document.projects_form.break_hours.disabled = false;
document.projects_form.break_mins.disabled = false;
}else
{
document.projects_form.unit_value.disabled = false;
document.projects_form.units.disabled = false;
document.projects_form.end_date.disabled = true;
document.projects_form.end_hour.disabled = true;
document.projects_form.end_min.disabled = true;
document.projects_form.break_hours.disabled = true;
document.projects_form.break_mins.disabled = true;
}
}
toggle_registration_method("<?php echo $registration_method; ?>");
</script>