mroe changes - halfway through...

This commit is contained in:
2017-05-11 23:07:56 -04:00
parent ac531f3de1
commit 0084a916b8
6 changed files with 107 additions and 71 deletions

View File

@@ -16,20 +16,6 @@ else: ?>
<!-- ********** BEGIN CONTENT ********** -->
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h2><?php echo $yaptc_pageicon; echo $yaptc_pagename; ?></h2>
</div>
<p class="lead"><?php if (isset($_SESSION['user_id'])): echo lang('USER') . ": " . $session_user["0"]["firstname"] . ' ' . $session_user["0"]["lastname"]; else: echo lang('PLEASE_LOG_IN'); endif; ?></p>
<p>Back to <a href="../sticky-footer">the default sticky footer</a> minus the navbar.</p>
</div>
<?php
// Get punch status for buttons and times
$session_punch = listPunches($yaptc_db, $session_user["0"]["userid"], 1);
@@ -53,8 +39,8 @@ endif;
// Process posted data from quickpunch section
if (isset($_POST['quickpunch'])):
if (!empty($_POST['notes'])): $notes = $_POST['notes']; else: $notes = NULL; endif;
if ($session_status == lang('IN')): punchOut($yaptc_db, $punchid, $notes, $timenow, NULL);
elseif ($session_status == lang('OUT')): punchIn($yaptc_db, $_SESSION['user_id'], $notes, $timenow, NULL);
if ($session_status == lang('IN')): punchOut($yaptc_db, $punchid, $notes, $timenow, NULL); $session_status = lang('OUT'); $session_message = lang('PUNCH_STATUS') . ": " . $session_status . " " . lang('SINCE') . " " . date('g:i a \o\n M jS, Y', strtotime($statustime)); $notes = NULL;
elseif ($session_status == lang('OUT')): punchIn($yaptc_db, $_SESSION['user_id'], $notes, $timenow, NULL); $session_status = lang('IN'); $session_message = lang('PUNCH_STATUS') . ": " . $session_status . " " . lang('SINCE') . " " . date('g:i a \o\n M jS, Y', strtotime($statustime));
endif;
header('Location: ' . $_SERVER['PHP_SELF']);
endif;
@@ -63,37 +49,75 @@ if (isset($_POST['quickpunch'])):
if (isset($_POST['advancedpunch'])):
if (!empty($_POST['notes'])): $notes = $_POST['notes']; else: $notes = NULL; endif;
if (!empty($_POST['punchtime'])): $punchtime = $_POST['punchtime']; else: $punchtime = $timenow; endif;
if ($session_status == lang('IN')): punchOut($yaptc_db, $punchid, $notes, $timenow, NULL);
elseif ($session_status == lang('OUT')): punchIn($yaptc_db, $_SESSION['user_id'], $notes, $punchtime, NULL);
if ($session_status == lang('IN')): punchOut($yaptc_db, $punchid, $notes, $timenow, NULL); $session_status = lang('OUT'); $session_message = lang('PUNCH_STATUS') . ": " . $session_status . " " . lang('SINCE') . " " . date('g:i a \o\n M jS, Y', strtotime($statustime)); $notes = NULL;
elseif ($session_status == lang('OUT')): punchIn($yaptc_db, $_SESSION['user_id'], $notes, $punchtime, NULL); $session_status = lang('IN'); $session_message = lang('PUNCH_STATUS') . ": " . $session_status . " " . lang('SINCE') . " " . date('g:i a \o\n M jS, Y', strtotime($statustime));
endif;
header('Location: ' . $_SERVER['PHP_SELF']);
endif;
?>
// HTML
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h2><?php echo $yaptc_pageicon; echo $yaptc_pagename; ?></h2>
</div>
<p class="lead"><?php if (isset($_SESSION['user_id'])): echo lang('USER') . ": " . $session_user["0"]["firstname"] . ' ' . $session_user["0"]["lastname"]; else: echo lang('PLEASE_LOG_IN'); endif; ?></p>
<p class="lead"><?php echo $session_message; ?></p>
</div>
<?php
// HTML section for quick punch only
if ($yaptc_allowuseradvancedpunch == "no"): ?>
<h2 class="content-subhead"><?php echo lang('QUICK_PUNCH'); ?></h2>
<p><?php echo $session_message; ?></p>
<p><?php echo lang('QUICK_PUNCH_PARAGRAPH'); ?></p>
<form class="pure-form" action="index.php" method="post">
<fieldset>
<input type="text" name="notes" placeholder="<?php echo lang('NOTES_PLACEHOLDER'); ?>" maxlength="255" value="<?php if (isset($notes)): echo $notes; endif; ?>" />
<button type="submit" class="pure-button <?php if ($session_status == lang('IN')): echo "button-error"; elseif ($session_status == lang('OUT')): echo "button-success"; endif;?>" name="quickpunch"><?php if ($session_status == lang('IN')): echo '<i class="fa fa-stop-circle"></i>'; elseif ($session_status == lang('OUT')): echo '<i class="fa fa-play-circle"></i>'; endif;?></button>
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h2><i class="glyphicon glyphicon-time"></i> <?php echo lang('QUICK_PUNCH'); ?></h2>
</div>
<p class="lead"><?php echo lang('QUICK_PUNCH_PARAGRAPH'); ?></p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset id="quickpunch">
<div class="form-group row">
<div class="col-sm-8">
<input class="form-control" type="text" name="notes" placeholder="<?php echo lang('NOTES_PLACEHOLDER'); ?>" maxlength="255" value="<?php if (isset($notes)): echo $notes; endif; ?>" />
</div>
<div class="col-sm-4">
<button type="submit" class="form-control btn btn-block <?php if ($session_status == lang('IN')): echo "btn-danger"; elseif ($session_status == lang('OUT')): echo "btn-success"; endif;?>" name="quickpunch"><?php if ($session_status == lang('IN')): echo '<i class="glyphicon glyphicon-stop"></i> ' . lang('PUNCH') . ' ' . lang('OUT'); elseif ($session_status == lang('OUT')): echo '<i class="glyphicon glyphicon-play"></i> ' . lang('PUNCH') . ' ' . lang('IN'); endif;?></button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<?php
// HTML section for advanced punch only
elseif ($yaptc_allowuseradvancedpunch == "yes"): ?>
<h2 class="content-subhead"><?php echo lang('ADVANCED_PUNCH'); ?></h2>
<p><?php echo $session_message; ?></p>
<p><?php echo lang('ADVANCED_PUNCH_PARAGRAPH'); ?></p>
<form class="pure-form" action="index.php" method="post">
<fieldset>
<input type="text" name="punchtime" placeholder="<?php echo $timenow; ?>" />
<input type="text" name="notes" placeholder="<?php echo lang('NOTES_PLACEHOLDER'); ?>" maxlength="255" value="<?php if (isset($notes)): echo $notes; endif; ?>" />
<button type="submit" class="pure-button <?php if ($session_status == lang('IN')): echo "button-error"; elseif ($session_status == lang('OUT')): echo "button-success"; endif;?>" name="advancedpunch"><?php if ($session_status == lang('IN')): echo '<i class="fa fa-stop-circle"></i>'; elseif ($session_status == lang('OUT')): echo '<i class="fa fa-play-circle"></i>'; endif;?></button>
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h2><i class="glyphicon glyphicon-time"></i> <?php echo lang('ADVANCED_PUNCH'); ?></h2>
</div>
<p class="lead"><?php echo lang('ADVANCED_PUNCH_PARAGRAPH'); ?></p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset id="advancedpunch">
<div class="form-group row">
<div class="col-sm-3">
<input class="form-control" type="text" name="punchtime" placeholder="<?php echo $timenow; ?>" />
</div>
<div class="col-sm-6">
<input class="form-control" type="text" name="notes" placeholder="<?php echo lang('NOTES_PLACEHOLDER'); ?>" maxlength="255" value="<?php if (isset($notes)): echo $notes; endif; ?>" />
</div>
<div class="col-sm-3">
<button type="submit" class="form-control btn btn-block <?php if ($session_status == lang('IN')): echo "btn-danger"; elseif ($session_status == lang('OUT')): echo "btn-success"; endif;?>" name="advancedpunch"><?php if ($session_status == lang('IN')): echo '<i class="glyphicon glyphicon-stop"></i> ' . lang('PUNCH') . ' ' . lang('OUT'); elseif ($session_status == lang('OUT')): echo '<i class="glyphicon glyphicon-play"></i> ' . lang('PUNCH') . ' ' . lang('IN'); endif;?></button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<?php endif; ?>
<!-- ********** END CONTENT ********** -->