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