Commit 0b170d78 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Got rid of most of the HTML php mix.

parent 5cf1af2c
......@@ -158,50 +158,43 @@ else {
$obj->timesheet_worked = 0;
}
?>
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<form name="editFrm" action="./index.php?m=timesheet" method="post">
<?php
<?php
// function TimesheetEditForm()
echo '<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">';
echo '<form name="editFrm" action="./index.php?m=timesheet" method="post">';
// if set, the value of dosql is automatically executed by the dP core application
// do_timesheet_aed.php will be the target of this form
// it will execute all database relevant commands
?>
<input type="hidden" name="dosql" value="do_timesheet_aed" />
<?php
echo '<input type="hidden" name="dosql" value="do_timesheet_aed" />';
// the del variable contains a bool flag deciding whether to run a delete operation on the given object with timesheet_id
// the value of del will be zero by default (do not delete)
// or in case of mouse click on the delete icon it will set to '1' by javaScript (delete object with given timesheet_id)
?>
<input type="hidden" name="del" value="0" />
<input type="hidden" name="stat" value="0" />
<input type="hidden" name="period" value="0" />
echo '<input type="hidden" name="del" value="0" />';
echo '<input type="hidden" name="stat" value="0" />';
echo '<input type="hidden" name="period" value="0" />';
<?php
// the value of timesheet_id will be the id of the timesheet to edit
// or in case of addition of a new timesheet it will contain '0' as value
?>
<input type="hidden" name="timesheet_id" value="<?php echo $timesheet_id;?>" />
<input type="hidden" name="timesheet_date" value="<?php echo $obj->timesheet_date;?>" />
<input type="hidden" name="timesheet_creator" value="<?php echo $obj->timesheet_creator;?>" />
<input type="hidden" name="timesheet_worked" value="<?php echo $obj->timesheet_worked;?>" />
echo '<input type="hidden" name="timesheet_id" value="'.$timesheet_id.'" />';
echo '<input type="hidden" name="timesheet_date" value="'.$obj->timesheet_date.'" />';
echo '<input type="hidden" name="timesheet_creator" value="'.$obj->timesheet_creator.'" />';
echo '<input type="hidden" name="timesheet_worked" value="'.$obj->timesheet_worked.'" />';
<?php
// please notice that html tags that have no </closing tag> should be closed
// like you find it here (<tag />) for xhtml compliance
?>
<tr>
<td width="50%" valign="top">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="right" nowrap="nowarp"><?php echo $AppUI->_('Submitter'); ?>:&nbsp;</td>
<td width="100%">
<?php echo $submitter; ?>
</td>
<td align="right" nowrap="nowarp"><?php echo $AppUI->_('Period'); ?>:&nbsp;</td>
<td width="100%">
<?php
if ( ($canEdit) && ($status < 1) )
{
echo '<tr>';
echo '<td width="50%" valign="top">';
echo '<table cellspacing="0" cellpadding="2" border="0">';
echo '<tr>';
echo '<td align="right" nowrap="nowarp">' . $AppUI->_('Submitter') . ':&nbsp;</td>';
echo '<td width="100%">' . $submitter .'</td>';
echo '<td align="right" nowrap="nowarp">' . $AppUI->_('Period') . ':&nbsp;</td>';
echo '<td width="100%">';
if ( ($canEdit) && ($status < 1) ) {
?>
<select name="timesheet_period" size="1' class="text" onChange="periodChange();">
<option <?php if ($period->getMonth() == 1) echo "selected"; ?> value="1"><? echo dPformSafe('January'); ?></option>
......@@ -218,9 +211,23 @@ else {
<option <?php if ($period->getMonth() == 12) echo "selected"; ?> value="12"><? echo dPformSafe('December'); ?></option>
</select>
<?php
}
else
{
// FIXME: FOR SOME STUPID REASON THE FOLLOWING IS NOT EXACTLY THE SAME AS THE ABOVE. ???
// echo '<select name="timesheet_period" size="1" class="text" onChange="periodChange();">';
// echo '<option '; if ($period->getMonth() == 1) echo "selected"; echo 'value="1">' . dPformSafe('January') . '</option>';
// echo '<option '; if ($period->getMonth() == 2) echo "selected"; echo 'value="2">' . dPformSafe('February') .'</option>';
// echo '<option '; if ($period->getMonth() == 3) echo "selected"; echo 'value="3">' . dPformSafe('March') . '</option>';
// echo '<option '; if ($period->getMonth() == 4) echo "selected"; echo 'value="4">' . dPformSafe('April') . '</option>';
// echo '<option '; if ($period->getMonth() == 5) echo "selected"; echo 'value="5">' . dPformSafe('May') . '</option>';
// echo '<option '; if ($period->getMonth() == 6) echo "selected"; echo 'value="6">' . dPformSafe('June') . '</option>';
// echo '<option '; if ($period->getMonth() == 7) echo "selected"; echo 'value="7">' . dPformSafe('July') . '</option>';
// echo '<option '; if ($period->getMonth() == 8) echo "selected"; echo 'value="8">' . dPformSafe('August') . '</option>';
// echo '<option '; if ($period->getMonth() == 9) echo "selected"; echo 'value="9">' . dPformSafe('September') . '</option>';
// echo '<option '; if ($period->getMonth() == 10) echo "selected"; echo 'value="10">' . dPformSafe('October') . '</option>';
// echo '<option '; if ($period->getMonth() == 11) echo "selected"; echo 'value="11">' . dPformSafe('November') . '</option>';
// echo '<option '; if ($period->getMonth() == 12) echo "selected"; echo 'value="12">' . dPformSafe('December') . '</option>';
// echo '</select>';
// FIXME: END OF STRANGENESS
} else {
if ($period->getMonth() == 1) echo dPformSafe('January');
else if ($period->getMonth() == 2) echo dPformSafe('February');
else if ($period->getMonth() == 3) echo dPformSafe('March');
......@@ -234,76 +241,61 @@ else {
else if ($period->getMonth() == 11) echo dPformSafe('November');
else if ($period->getMonth() == 12) echo dPformSafe('December');
}
?>
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><?php echo $AppUI->_('Creation date'); ?>:&nbsp;</td>
<td width="100%">
<?php
echo $creation_date->getYear() . "-" . $creation_date->getMonth() . "-" .
$creation_date->getDay();
?>
</td>
<td align="right" nowrap="nowarp"><?php echo $AppUI->_('Status'); ?>:&nbsp;</td>
<td width="100%" align="right"">
<?php
if ( ($canEdit) &&
(($status == 0) ||
( $config_options['approval_by']['value'] == $AppUI->user_id )) ) {
?>
<select name="timesheet_status" size="1" class="text" onChange="changeIt()">
<option <?php if ($status == 0) echo "selected"; ?> value="0"><? echo dPformSafe('Open for Editing');?></option>
<option <?php if ($status == 1) echo "selected"; ?> value="1"><? echo dPformSafe('Submitted');?></option>
<?php
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td align="right" nowrap="nowrap">' . $AppUI->_('Creation date') . ':&nbsp;</td>';
echo '<td width="100%">';
echo $creation_date->getYear() . "-" . $creation_date->getMonth() . "-" . $creation_date->getDay();
echo '</td>';
echo '<td align="right" nowrap="nowarp">' . $AppUI->_('Status') . ':&nbsp;</td>';
echo '<td width="100%" align="right"">';
if ( ($canEdit) && (($status == 0) ||
($config_options['approval_by']['value'] == $AppUI->user_id )) ) {
echo '<select name="timesheet_status" size="1" class="text" onChange="changeIt()">';
echo '<option '; if ($status == 0) echo "selected"; echo 'value="0">' . dPformSafe('Open for Editing') . '</option>';
echo '<option '; if ($status == 1) echo "selected"; echo 'value="1">' . dPformSafe('Submitted') . '</option>';
// Only the user with Timesheet Approval rights may set a timesheet to approved status.
if ( $config_options['approval_by']['value'] == $AppUI->user_id )
{
?>
<option <?php if ($status == 2) echo "selected"; ?> value="2"><? echo dPformSafe('Approved');?></option>
<?php
if ( $config_options['approval_by']['value'] == $AppUI->user_id ) {
echo '<option '; if ($status == 2) echo "selected"; echo 'value="2">' . dPformSafe('Approved') . '</option>';
}
?>
</select>
<?php
}
else {
echo '</select>';
} else {
if ($status == 1)
echo dPformSafe('Submitted');
else if ($status == 2)
echo dPformSafe('Approved');
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
// If $status is not "Open for Editing" then don't allow to change the status.
// There is one exception to this rule the 'administrator' can always change the status.
if ( ($canEdit) &&
(($status == 0) ||
($config_options['approval_by']['value'] == $AppUI->user_id)) )
{
if ( ($canEdit) && (($status == 0) ||
($config_options['approval_by']['value'] == $AppUI->user_id)) ) {
?>
<input class="button" type="button" name="cancel" value="<?php echo $AppUI->_('cancel');?>" onClick="javascript:if(confirm('Are you sure you want to cancel.')){location.href = './index.php?m=timesheet';}" />
</td>
<td align="right">
<input class="button" type="submit" name="btnFuseAction" value="<?php echo $AppUI->_('submit');?>"/>
<input class="button" type="button" name="cancel" value="<?php echo $AppUI->_('cancel'); ?>" onClick="javascript:if(confirm('Are you sure you want to cancel.')){location.href = './index.php?m=timesheet';}" />
<?php
}
else
echo '</td>';
echo '<td align="right">';
echo '<input class="button" type="submit" name="btnFuseAction" value="' . $AppUI->_('submit') . '"/>';
} else
echo '&nbsp;</td><td align="right">&nbsp;';
?>
</td>
</tr>
</form>
</table>
echo '</td>';
echo '</tr>';
echo '</form>';
echo '</table>';
<?php
// Get Project Status information.
$project_types = dPgetSysVal("ProjectStatus");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment