Skip to content

Commit

Permalink
Body Mass Info Table
Browse files Browse the repository at this point in the history
  • Loading branch information
attogram committed Mar 11, 2019
1 parent 96d1fe0 commit 4047a64
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 39 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Body Mass Info Chart
# Body Mass Info Table

Multi-weight Body Mass Index (BMI) chart based on your height, age and sex, with calculated Body Fat/Lean Percentage, Base Metabolic Rate (BMR) and Total Daily Energy Expenditure (TDEE) for various activity levels.
Multi-weight Body Mass Index (BMI) table based on your height, age and sex, with calculated Body Fat/Lean Percentage, Base Metabolic Rate (BMR) and Total Daily Energy Expenditure (TDEE) for various activity levels.

[![screenshot](https://raw.githubusercontent.com/attogram/attogram-docs/master/body-mass-info-chart/body-mass-info-chart-v1-1.small.png)](https://raw.githubusercontent.com/attogram/attogram-docs/master/body-mass-info-chart/body-mass-info-chart-v1-1.png)

# Demo

https://getitdaily.com/body-mass-info-chart/
https://getitdaily.com/body-mass-info-table/

# Open Source

The Body Mass Info Chart is an Open Source project,
The Body Mass Info Table is an Open Source project,
brought to you by the Attogram Project.

* Github: https://github.com/attogram/body-mass-info-chart
* Packagist: https://packagist.org/packages/attogram/body-mass-info-chart
* Github: https://github.com/attogram/body-mass-info-table
* Packagist: https://packagist.org/packages/attogram/body-mass-info-table
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "attogram/body-mass-info-chart",
"description": "Multi-weight Body Mass Index (BMI) chart based on your height, age and sex, with calculated Body Fat/Lean Percentage, Base Metabolic Rate (BMR) and Total Daily Energy Expenditure (TDEE) for various activity levels.",
"name": "attogram/body-mass-info-table",
"description": "Multi-weight Body Mass Index (BMI) table based on your height, age and sex, with calculated Body Fat/Lean Percentage, Base Metabolic Rate (BMR) and Total Daily Energy Expenditure (TDEE) for various activity levels.",
"type": "project",
"license": "MIT",
"homepage": "https://github.com/attogram/body-mass-info-chart",
"homepage": "https://github.com/attogram/body-mass-info-table",
"autoload": {
"psr-4": {
"Attogram\\Body\\": "src/"
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
/** @noinspection PhpIncludeInspection */
require_once($autoload);

(new BodyMassInfoChart())->route();
(new BodyMassInfoTable())->route();
22 changes: 11 additions & 11 deletions src/BodyMassInfoChart.php → src/BodyMassInfoTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Attogram\Router\Router;

/**
* Body Mass Info Chart
* Body Mass Info Table
*/
class BodyMassInfoChart
class BodyMassInfoTable
{
/** @var string Version*/
const VERSION = '1.5.3';
Expand Down Expand Up @@ -96,7 +96,7 @@ private function home()
$this->increment = Utils::getFloatVarFromGet('i', $this->increment);

$this->includeTemplate('form');
$this->chart();
$this->showTable();
}

/**
Expand Down Expand Up @@ -176,23 +176,23 @@ private function setInfoArray()
/**
* @uses $this->infoArray
*/
private function chart()
private function showTable()
{
$this->setMassArray();
$this->setInfoArray();

print '<table>'
. '<tr>'
. '<td colspan="14">' . $this->getChartTopic() . '</td>'
. '</tr>' . $this->getChartHeader();
. '<td colspan="14">' . $this->getTableTopic() . '</td>'
. '</tr>' . $this->getTableHeader();

$count = 0;
foreach ($this->infoArray as $mass => $info) {
$mass = (float) $mass;
$count++;
if ($count > 30) {
$count = 0;
print $this->getChartHeader();
print $this->getTableHeader();
}
print '<tr style="background-color:' . Utils::getBmiClassColor($info['bmi']) . '">'
. '<td>' . Utils::getBmiClassText($info['bmi']) . '</td>'
Expand All @@ -211,16 +211,16 @@ private function chart()
. '<td class="righty">' . $info['tdeeExtreme'] . '</td>'
. '</tr>';
}
print $this->getChartHeader() . '</table>';
print $this->getTableHeader() . '</table>';
}

/**
* @return string
*/
private function getChartTopic()
private function getTableTopic()
{
$error = '<span class="error">Unknown</span>';
return 'Body Mass Info Chart'
return 'Body Mass Info Table'
. '<br /><br />Height: '
. ($this->human->getHeight()
? $this->human->getHeight() . ' meters'
Expand All @@ -241,7 +241,7 @@ private function getChartTopic()
/**
* @return string
*/
private function getChartHeader()
private function getTableHeader()
{
return '<tr>'
. '<td>Description</td>'
Expand Down
16 changes: 8 additions & 8 deletions templates/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

?>
<div style="margin:20px;">
<h1>Welcome to the Body Mass Info Chart</h1>
<h1>Welcome to the Body Mass Info Table</h1>
<p>
This chart shows your
This table shows your
<a href="#bmi">BMI (Body Mass Index)</a> for a range of weights
based on your height, age, and sex.
Your <a href="#bmi-prime">BMI' (BMI Prime)</a> is also shown.
Expand All @@ -25,17 +25,17 @@
<a href="#tdee">TDEE (Total Daily Energy Expenditure)</a> for various activity levels.
</p>
<p>
The Body Mass Info Chart is an Open Source project. Learn more at:
<a href="https://github.com/attogram/body-mass-info-chart" target="github">
https://github.com/attogram/body-mass-info-chart</a>
The Body Mass Info Table is an Open Source project. Learn more at:
<a href="https://github.com/attogram/body-mass-info-table" target="github">
https://github.com/attogram/body-mass-info-table</a>
</p>

<h2 id="howto">How to use the chart</h2>
<h2 id="howto">How to use the table</h2>
<p>
Enter your height (in meters), your age, and your sex. Then click 'Update Chart'.
Enter your height (in meters), your age, and your sex. Then click 'Update Table'.
</p>
<p>
In the Chart options section you can customize the weight ranges used in the chart,
In the Table options section you can customize the weight ranges used in the table,
and the increment between weights.
</p>
<a href=""><small>^top</small></a>
Expand Down
6 changes: 3 additions & 3 deletions templates/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
?>
<br /><br /><br />
<div class="hdr bw">
<a href="<?= $this->router->getUriBase(); ?>/">Body Mass Info Chart
v<?= BodyMassInfoChart::VERSION; ?></a>
<a href="<?= $this->router->getUriBase(); ?>/">Body Mass Info Table
v<?= BodyMassInfoTable::VERSION; ?></a>
&nbsp;
<a href="<?= $this->router->getUriBase(); ?>/about/">About</a>
&nbsp;
<a href="https://github.com/attogram/body-mass-info-chart" target="github">Github</a>
<a href="https://github.com/attogram/body-mass-info-table" target="github">Github</a>
</div>

</div><? /* end div container-fluid */ ?>
Expand Down
8 changes: 4 additions & 4 deletions templates/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace Attogram\Body;

/** @var BodyMassInfoChart $this */
/** @var BodyMassInfoTable $this */
?>
<div class="collapse show" id="options">
<form>
<input type="submit" value=" Update Chart " />
<input type="submit" value=" Update Table " />
&nbsp;
<span class="nobr"><label for="h">Height:</label>
<input id="h" name="h" title="Height" type="text" size="4" maxlength="5" value="<?=
Expand All @@ -34,8 +34,8 @@
<em>Options:</em>
&nbsp;
<span class="nobr"><label>Range:</label>
<input id="s" name="s" title="Chart start" size="2" maxlength="3" value="<?= $this->startMass; ?>" />-<input
id="e" name="e" title="Chart end" size="2" maxlength="3" value="<?= $this->endMass; ?>" />kg</span>
<input id="s" name="s" title="Table start" size="2" maxlength="3" value="<?= $this->startMass; ?>" />-<input
id="e" name="e" title="Table end" size="2" maxlength="3" value="<?= $this->endMass; ?>" />kg</span>
&nbsp;
<span class="nobr"><label for="i">Increment:</label>
<input id="i" name="i" title="Increment" size="2" maxlength="6" value="<?= $this->increment; ?>" />kg</span>
Expand Down
4 changes: 2 additions & 2 deletions templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Body Mass Info Chart</title>
<title>Body Mass Info Table</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
body {
Expand Down Expand Up @@ -63,6 +63,6 @@
</style></head><body>
<div class="container-fluid">
<div class="hdr bw">
<a href="<?= $this->router->getUriBase(); ?>/">Body Mass Info Chart</a>
<a href="<?= $this->router->getUriBase(); ?>/">Body Mass Info Table</a>
&nbsp; <a href="<?= $this->router->getUriBase(); ?>/about/">About</a>
</div>

0 comments on commit 4047a64

Please sign in to comment.