diff options
| author | Nathan Kinkade <nath@nkinka.de> | 2008-02-03 23:23:24 +0000 |
|---|---|---|
| committer | Nathan Kinkade <nath@nkinka.de> | 2008-02-03 23:23:24 +0000 |
| commit | d895b852a6e160496ffc760d46d3719a3d62ff86 (patch) | |
| tree | 52230bb04148197e8312e09b5c5273417e7a3be9 /templates | |
Initial checkin of nutridb.org and basic subversion directory structure
Diffstat (limited to 'templates')
27 files changed, 2118 insertions, 0 deletions
diff --git a/templates/about.tpl b/templates/about.tpl new file mode 100644 index 0000000..9b9cd30 --- /dev/null +++ b/templates/about.tpl @@ -0,0 +1,95 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData' style='text-align: justify;'> + + <h2 style='text-align: center;'>ABOUT</h2> + + <div class='standardMargins'> + I began work on this database sometime around mid 2002. It started out of a strong + interest in nutrition and a desire to explore <a href='http://php.net'> PHP</a>, + which at the time was new to me. The initial idea came from an old friend of mine + who had started a similar project but using + <a href='http://www.perl.org/about.html'>Perl</a>. + </div> + + <div class='standardMargins'> + The present incarnation of this site bears little resemblance to the original. + In 2003 I left for Belize to serve with the Peace Corps as an Information Technology + volunteer, and after the Peace Corps I stayed in Central America for about another + two years. So, the project pretty much went dormant for the better part of four + years. However, when I returned to the States in February of 2007, I immediately + picked the project back up. I practically rewrote the entire thing from the ground + up, with the only real resemblance to the old one being the core logic. + </div> + + <div class='standardMargins'> + When I wrote the original version of the utility I wasn't then aware of many other + free web-based systems that were doing something similar. Now I see that there are + a number of <a href='{$config->_rootUri}/resources.php#nutritionsites'>other sites</a> that have a very + complete set of tools. However, in my opinion, virtually all of them have a major + flaw: they try to be everything to everyone, and thereby end up being overly + complicated and convoluted. An old axiom comes to mind: "You can please some of the + people all the time, and all of the people some of the time, but you can't please + all the people all the time." + </div> + + <div class='standardMargins'> + Consider a program like Microsoft Word, a very powerful word processor. I'd be + willing to bet that about 90% of the users of Word use than 10% of it's features, so + in effect I suspect that the majority of the program is just bulk and useless cruft + for the majority of consumers. + </div> + + <div class='standardMargins'> + Personally, I subscribe to the notion that less is more. I am a long-time free + software user, and especially the operating systems known as + <a href='http://en.wikipedia.org/wiki/Linux'>GNU/Linux</a> and + <a href='http://freebsd.org'>FreeBSD</a>. + These systems are based on an older operating system called + <a href='http://en.wikipedia.org/wiki/Unix'>Unix</a>. Generally speaking, in the + Unix world, one of the design principles has been to write a lot of small programs + that do a particular job very well and then to chain those elegant tools together to + accomplish complex tasks. The other methodology is to write a small number of + programs that do a large number of things, but only do each task marginally well. + </div> + + <div class='standardMargins'> + What does this have to do with a nutrition database, you ask? Well, the goal of + this system is to do a few things very well. Namely, to give you concise and + trustworthy data about certains food. There are already lots of other tools + available to do other nutrition related things, and I don't see a need to reinvent + the wheel here. Those other tools are only a few keystrokes and clicks away. As an + example, at present I have no intention adding a BMI calculator. There are already + countless <a href='http://www.google.com/search?q=bmi+calculator'>other sites</a> + with fine BMI calculators, and to add yet another here would simply clutter up the + interface and add no real value. This is what Favorites and Bookmarks are for in + your browser. + </div> + + <div class='standardMargins'> + What this means from a user perspective is that the intention is that interface + should never get in your way. You should never have to hunt around for what you + need. You shouldn't have to sift through mounds of extraneous and unwanted data + and tools to find what you want. + </div> + + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} + diff --git a/templates/edit_account.tpl b/templates/edit_account.tpl new file mode 100644 index 0000000..48305c8 --- /dev/null +++ b/templates/edit_account.tpl @@ -0,0 +1,87 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData' style='margin-left: 5ex; margin-right: 5ex;'> + + <h3 style='text-align: center;'>Edit Profile</h3> + <div class='standardMargins' style='text-align: justify;'> + Use this form to edit your account profile. If you don't wish to change your + password, then simply leave the password boxes empty. +<!-- + Use this form to edit your account profile, or delete the account entirely. + <strong>NOTE</strong>: if you choose to delete the account, then be aware that + any and all data (foods, meals, diaries, etc.) associated with the account will + also be permanently and irrevocably deleted. This isn't a problem, but something + that you should be aware of. For this reason, you will be prompted twice as to + whether you really want to delete the account. If you don't wish to change your + password, then simply leave the password boxes empty. +--> + </div> + <div> + <form action='{$smarty.server.PHP_SELF}' method='post' id='formEditUser' onsubmit='validateEditUser("formEditUser"); return false;'> + <div class='standardMargins'> + <input type='text' name='username' size='25' value='{$smarty.session.user.username}' /> <strong>Login name</strong> + (min. 5 chars.) + </div> + <div class='standardMargins'> + <input type='password' name='password' size='25' /> <strong>New password</strong> + (min. 5 chars.) + </div> + <div class='standardMargins'> + <input type='password' name='password2' size='25' /> <strong>Confirm password</strong> + (min. 5 chars.) + </div> + <div class='standardMargins'> + <input type='text' name='birthday' id='birthday' value='{$birthday}' readonly='readonly' /> <strong>Birthday</strong> + <script type="text/javascript"> + Calendar.setup( + {literal}{{/literal} + inputField : "birthday", // ID of the input field + ifFormat : "%Y-%m-%d", // the date format + button : "birthday", // ID of the button + weekNumbers : false, + showsTime : true, + firstDay : 0 + {literal}}{/literal} + ); + </script> + </div> + <div class='standardMargins'> + <select name='gender'> +{foreach from=$genders item=gender} + {if $gender == $smarty.session.user.gender} + <option value='{$gender}' selected='selected'>{$gender}</option> + {else} + <option value='{$gender}'>{$gender}</option> + {/if} +{/foreach} + </select> <strong>Gender</strong> + </div> + <div class='standardMargins'> + <input type='hidden' name='action' value='' /> + <input type='submit' name='doEdit' value='Modify' onclick='getElement("formEditUser").action.value = "editUser";' /> +<!-- + <input type='submit' name='doDelete' value='Delete' onclick='return verifyDeleteUser();' /> +--> + </div> + </form> + </div> + + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/edit_food.tpl b/templates/edit_food.tpl new file mode 100644 index 0000000..9c9c379 --- /dev/null +++ b/templates/edit_food.tpl @@ -0,0 +1,40 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <h3 style='text-align: center;'>Edit Foods</h3> + <div style='float: left; padding-right: 2ex; width: 20%;'> + <div><span style='text-decoration: underline;'><strong>Saved foods</strong></span></div> +{if $savedFoods} + {foreach from=$savedFoods item=savedFood} + <div name='savedFoods' id='savedFood-{$savedFood.id}'><a href='{$smarty.server.REQUEST_URI}' title='{$savedFood.description}' onclick='loadFoodToEdit("{$savedFood.id}"); return false;'>{$savedFood.description|truncate:25:" ..."}</a></div> + {/foreach} +{else} + No saved foods. +{/if} + </div> + <div id='editFood' style='float: left; padding-left: 2ex; border-left: 1px solid black; width: 75%;'> +{if $editFood} + <script type='text/javascript'>xajax_loadFoodToEdit("{$editFood}");</script> +{else} + <= Select a food to edit. +{/if} + </div> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/edit_meal.tpl b/templates/edit_meal.tpl new file mode 100644 index 0000000..b0362fb --- /dev/null +++ b/templates/edit_meal.tpl @@ -0,0 +1,46 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <h3 style='text-align: center;'>Edit Meals</h3> + <div style='float: left; padding-right: 2ex; width: 25%;'> + <div> + <span style='text-decoration: underline;'><strong>Saved meals</strong></span> + </div> +{if $savedMeals} + {foreach from=$savedMeals item=savedMeal} + <div name='savedMeals' id='savedMeal-{$savedMeal.id}'><a href='{$smarty.server.REQUEST_URI}' title='{$savedMeal.description}' onclick='loadMealToEdit({$savedMeal.id}); return false;'>{$savedMeal.description|truncate:25:" ..."}</a></div> + {/foreach} +{else} + No saved meals. +{/if} + </div> + <div style='float: left; overflow: auto; margin-bottom: 1em;'> + <form action='edit_meal.php' method='post' name='formEditMeal' id='formEditMeal' style='onsubmit='return validateEditMeal("formEditMeal");'> + <div id='editMeal' style='float: left; padding-left: 2ex; border-left: 1px solid black;'> +{if $editMeal} + <script type='text/javascript'>xajax_loadMealToEdit("{$editMeal}");</script> +{else} + <= Select a meal to edit. +{/if} + </div> + </form> + </div> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/faq.tpl b/templates/faq.tpl new file mode 100644 index 0000000..011e192 --- /dev/null +++ b/templates/faq.tpl @@ -0,0 +1,203 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + + <h2 style='text-align: center;'>FAQ</h2> + + <ul class='helpIndex' style='margin-left: 1em; padding-left: 1em;'> + <li><a href='#whatisthis'>What is this thing?</a></li> + <li><a href='#datasource'>Where does the data come from?</a></li> + <li><a href='#searching'>What do all those search options mean?</a></li> + <li><a href='#noresults'>Why don't my searches return any results?</a></li> + <li><a href='#whyregister'>Why should I register?</a></li> + <li><a href='#timestamp'>What is a diary "timestamp?"</a></li> + <li><a href='#favorites'>What are "favorites" and how do they work?</a></li> + <li><a href='#nofavorites'> + I haven't marked anything as a favorite but things are still showing up in my favorites lists. Why?</a> + </li> + <li><a href='#favoritediary'>Where can I mark a diary as a favorite?</a></li> + </ul> + + <a name='whatisthis' id='whatisthis' style='position: absolute;'></a> + <div class='helpItem'> + <strong>What is this thing</strong>?<br /> + This is a searchable database of food nutrient content. Beyond being able to do simple + searches for foods, you are able to collect various individual foods into a "meal" and + then view a complete nutrition profile for that "meal." Once registered with the site, + you will also have the ability to save food searches as well as meals so that you can + easily and quickly reference them again later. There is also the functionality of a food + diary. You may create as many diaries as you like and then add food searches or saved foods + and meals to the diary. This is a simple way to record what you are eating on a daily + basis. + </div> + + <a name='datasource' id='datasource' style='position: absolute;'></a> + <div class='helpItem'> + <strong>Where does the data come from</strong>?<br /> + The USDA has done extensive testing of an impressive array of foods and food products to + determine their respective macronutrient (protein, carbohydrate, and fat), vitamin, and + mineral content. The data in this database was provided by the + <a href='http://www.ars.usda.gov/ba/bhnrc/ndl'>USDA Nutrient Data Laboratory</a>. + The data is public domain. nubridb.com is currently using the latest release known as + <a href='http://www.ars.usda.gov/Services/docs.htm?docid=8964'>SR19</a>. + </div> + + + <a id='searching' name='searching' style='position: absolute;'></a> + <div class='helpItem'> + <strong>What do all those search options mean</strong>?<br /> + All Words + <div class='helpItem'> + This is a logical 'AND' search. This is the default search type and is probably the + most useful. ALL word(s) in the search text box which are separated by any amount of + whitespace, MUST be present or the search will return an empty result set. For example, + if you entered 'cherry pudding dessert' - the following record might be returned:<br /> + - Babyfood, dessert, cherry vanilla pudding, strained<br /> + ... but the following record would not be returned because it does not contain the word 'dessert':<br /> + - Pie, cherry, prepared from recipe + </div> + Any Words + <div class='helpItem'> + This a logical 'OR' search. This search might be useful if you are having problems + getting any results with the 'All Words' search. If ANY word in the search text box + which is separated by any amount of whitespace is found, then the record is returned as a match. + For example, if you entered 'banana pudding' - the following records might be returned:<br /> + - Babyfood, dessert, cherry vanilla pudding, strained<br /> + - Bananas, dehydrated, or banana powder + </div> + Exact Phrase + <div class='helpItem'> + This is, as it states, an EXACT search. This search is probably not useful at + all unless you are either very familiar with the database, lucky, or both. For example, + if you entered 'babyfood, dessert, cherry vanilla pudding junior' - the following + record would NOT be returned because you are missing the comma between 'pudding' and 'junior':<br /> + - Babyfood, dessert, cherry vanilla pudding, junior<br /> + </div> + Partial Word + <div class='helpItem'> + Words that you enter in the search text box can constitute a portion of a word. + For example, if you entered 'mayo' the following record would be returned:<br /> + - Salad dressing, mayonnaise type, regular, with salt<br /> + ...this is because 'mayo' makes up part of the word 'mayonnaise'. You can see + that this type of search can get out of control in a hurry if you are not careful. + For example, if trying to be thorough you enter the text 'm', every single record + in the database that even contains the letter 'm' will be returned. Although this + is the default search type, use it with caution or you may get more records than + are useful - possibly thousands. + </div> + Full Word + <div class='helpItem'> + Any words that you enter in the search text box will be taken as full words in the + search. For example, if you entered 'mayo' the following record would NOT be returned:<br /> + - Salad dressing, mayonnaise type, regular, with salt<br /> + ... however, this record would be returned because it contains the exact word 'Mayo':<br /> + - Salad dressing, KRAFT Mayo Light Mayonnaise + </div> + Sort order + <div class='helpItem'> + This option determines how the results of your search should be ordered. If you select + 'Category' (the default), then your results will be grouped by food category and then + ordered alphabetically within each group. If you select 'Food Description' then the results + will not be ordered, grouped, or otherwise associated with a food category. Instead, the + search results will simply by ordered aphabetically. + </div> + </div> + + <a id='noresults' name='noresults' style='position: absolute;'></a> + <div class='helpItem'> + <strong>Why doesn't my search return any results</strong>?<br /> + There may be several reasons why your searches are coming up empty. Each food item in the database + has an associated description field which contains multiple descriptors for that particular food item. + When you search the database, you are simply looking for keywords in this field. The search options + you choose will affect how this field is searched. Please note that all searches are case-insensitive + e.g. 'a' and 'A' are treated the same. Also, the order of words does NOT matter - a search for 'cherry vanilla' + would return both a record that contained '...cherry...vanilla...' and '...vanilla...cherry...'. + </div> + + <div class='helpItem'> + TIP: Try pluralizing or singularizing your search terms. A good example of this is a search for + 'blueberry.' You may be looking for information on the fruit, yet a search for this word + doesn't turn up any fruit. This is because information for the fruit is registered with + a description of "blueberries, raw." In this case pluralizing the word would return the + fruit, among many other things. Another worthwhile way to search is using partial words. + For example, a search for simply 'blueberr', assuming you are doing a "Partial Word" search, + would return everything containing "blueberry" as well as "blueberries." + </div> + <a name='whyregister' id='whyregister' style='position: absolute;'></a> + <div class='helpItem'> + <strong>Why should I register</strong>?<br /> + You certainly don't have to register to use this site. However, if you don't register you will + be unable to save anything for future reference. Also, DRIs (similar to RDAs) are age/gender + specific and if you are not logged in then the system will report to you the DRI values for a + 30 year old male. Creating an account will also allow you to specify which nutrients you + do and don't want to see by default, which may be useful as there are around 140 nutrients, most + of which you probably won't be interested in. + </div> + + <a name='timestamp' id='timestamp' style='position: absolute;'></a> + <div class='helpItem'> + <strong>What is a diary "Timestamp"</strong>? + A food diary "Timestamp" allows you to specify exactly when you ate a particular food or meal. + Most people are not going to be able to enter foods into the food diary exactly at the + moment they are eaten. However, for a variety of reasons it is important to know when a + particular item was consumed, especially if you are trying to determine a food sensitivity, or + track statistics about your eating habits. For example, with a timestamp the system may be able + to make calculations to determine how many calories you are averaging per day, or how much + Calcium you are intaking per week, etc. Without a timestamp none of that would be possible. + </div> + + <a name='favorites' id='favorites' style='position: absolute;'></a> + <div class='helpItem'> + <strong>What are "favorites" and how do they work</strong>?<br /> + Marking a food or meal as a favorite will give you quick access to the items that you use most + frequently. For example, you may have saved 500 different foods, but perhaps you only reference, + say, 50 or 60 of those with any frequency, so you mark those 50 or 60 foods as "Favorites." There + is nothing different about a favorite saved food or meal from any other saved food or meal, except + that your favorites will be located in the quick-access drop-down menus in the left sidebar, and you + will also have access to the "Quick Edit" functions for your favorite foods and meals. There is no + limit to how many foods or meals can be marked as favorite. However, if you have many foods and + meals you may find it inconvenient to have a drop-down menu with hundreds of items, but this is a + personal choice. <strong>Note</strong>: you cannot mark a diary as a favorite. All diaries are + considered favorites. + </div> + + <a name='nofavorites' id='nofavorites' style='position: absolute;'></a> + <div class='helpItem'> + <strong>I haven't marked anything as a favorite but things are still showing up in my favorites lists. Why</strong>?<br /> + If your total saved foods or meals, respectively, are less than 15 then the system will automatically + place those items in your favorites lists as a convenience. However, only the first 15 will appear. + For example, if you have saved 40 foods, but haven't marked any as a favorite, then the system will + automatically select the first 15 saved foods and place them in the favorite foods drop-down menu. + Once you mark at least one food or meal as a favorite, only those foods or meals marked as favorites + will appear in the favorites drop-down menus, no matter how few or many. <strong>Note</strong>: you + cannot mark a diary as a favorite. All diaries are considered favorites. + </div> + + <a name='favoritediary' id='favoritediary' style='position: absolute;'></a> + <div class='helpItem'> + <strong>Where can I mark a diary as a favorite</strong>?<br /> + You can't. It is assumed that you generally won't have a great number of diaries, as this would + defeat the purpose of being able to summarize your nutritional trends over time. Perhaps you will + have only one food diary. However, the facility for having multiple diaries is present + and may be used as one sees fit. + </div> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} + diff --git a/templates/food_match.tpl b/templates/food_match.tpl new file mode 100644 index 0000000..3b9ca3f --- /dev/null +++ b/templates/food_match.tpl @@ -0,0 +1,47 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <p class='small'> + <strong>Search text</strong>: '{$searchString}'<br /> + <strong>Search type</strong>: {$searchType}/{$wordType}<br /> + <strong>Category</strong>: {$foodCategoryName} + </p> + +{if isset($searchResults)} + <p>The following items matched your search:</p> + + <p class='nowrap'> + {foreach from=$searchResults item=searchResult} + <a href='food_weight.php?ndb_no={$searchResult.ndb_no}'>{$searchResult.long_desc}</a><br /> + {/foreach} + </p> +{else} + <p> + <span class='msgError'>No items matched your search!</span><br /> + </p> + <p> + Would you like to <a href='index.php?{$queryString}'>refine your search</a>? + </p> + <p> + Don't understand the search options? See the <a href='faq.php#searching'>FAQ</a> on searching. + </p> +{/if} + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/food_quantity.tpl b/templates/food_quantity.tpl new file mode 100644 index 0000000..7da4cd8 --- /dev/null +++ b/templates/food_quantity.tpl @@ -0,0 +1,68 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <div> + <strong>You selected</strong>: {$foodQuantities[0].foodDesc}<br /> +{if ! empty($foodQuantities[0].sciname)} + <strong>Scientific name</strong>: <span style='text-decoration: italic;'>{$foodQuantities[0].sciname}</span> +{/if} + </div> + + <div style='margin-top: 2ex;'> + You must now choose a quantity for the selected food. You may choose between + various predefined quantities, or you may enter your own quantity. If you + enter your own quantity, any decimal number is allowable, including fractionals. + </div> + + <form action='view_food.php' method='post' id='formFoodQuantity' style='margin-top: 2ex;'> + <div> + <input type='radio' name='quantitySource' value='predefined' checked='checked' /> + Select a predefined quantity/weight: + </div> + <div style='margin-top: 2ex; margin-left: 5em;'> +{foreach from=$foodQuantities item=foodQuantity name=foodQuantity} + {if $smarty.foreach.foodQuantity.index == 0} + <input type='radio' name='predefinedWeight' value='{$foodQuantity.seq}' checked='checked' onfocus='return changeQuantitySource("formFoodQuantity", "0");' /> + {else} + <input type='radio' name='predefinedWeight' value='{$foodQuantity.seq}' onfocus='return changeQuantitySource("formFoodQuantity", "0");' /> + {/if} + {$foodQuantity.amount} {$foodQuantity.msre_desc} ({$foodQuantity.gm_wgt} grams)<br /> +{/foreach} + </div> + <div style='margin-top: 2ex;'> + <input type='radio' name='quantitySource' value='userdefined' /> + Enter your own quantity/weight: + </div> + <div style='margin-top: 2ex; margin-left: 5em;'> + <input type='text' name='quantity' size='5' onfocus='return changeQuantitySource("formFoodQuantity", "1");'/> + <select name='userdefinedWeight'> +{foreach from=$foodQuantities item=foodQuantity} + <option value='{$foodQuantity.seq}'>{$foodQuantity.msre_desc}</option> +{/foreach} + </select> + </div> + <div style='margin-top: 2ex;'> + <input type='hidden' name='food' value='{$food}' /> + <input type='hidden' name='action' value='getFood' /> + <input type='submit' name='doGetFood' value='Proceed' /> + </div> + </form> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/food_search.tpl b/templates/food_search.tpl new file mode 100644 index 0000000..21d4bb9 --- /dev/null +++ b/templates/food_search.tpl @@ -0,0 +1,77 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <div> + <strong>Search text</strong>: '{$searchString}'<br /> + <strong>Search type</strong>: {$searchType}/{$wordType}<br /> + <strong>Category</strong>: {$foodCatName}<br /> + <strong>Sort by</strong>: {$sortType} + </div> +{if isset($searchResults)} + <div style='margin-top: 2ex;'> + The following items matched your search. + Select one, or <a href='index.php?{$smarty.server.QUERY_STRING|escape:"url"}'>refine your search</a>. + </div> + <div style='margin-top: 2ex;'> + {if $sortType == "Category"} + {foreach from=$searchResults key=category item=foodCat} + <div style='text-align: center; background-color: #e0e0e0;'>{$foodCat.foodCatName}</div> + {foreach from=$foodCat.searchResults item=searchResult} + <div> + {if $category == "userFood"} + <a href='view_food.php?{$searchResult.food}&description={$searchResult.foodDesc}'>{$searchResult.foodDesc}</a> + {elseif $category == "userMeal"} + <a href='view_meal.php?meal={$searchResult.food}&description={$searchResult.foodDesc}'>{$searchResult.foodDesc}</a> + {else} + <a href='food_quantity.php?food={$searchResult.food}'>{$searchResult.foodDesc}</a> + {/if} + </div> + {/foreach} + {/foreach} + {else} + {foreach from=$searchResults item=searchResult} + <div> + {if $searchResult.category == "userFood"} + <a href='view_food.php?{$searchResult.food}&description={$searchResult.foodDesc}'>{$searchResult.foodDesc}</a> + {elseif $searchResult.category == "userMeal"} + <a href='view_meal.php?meal={$searchResult.food}&description={$searchResult.foodDesc}'>{$searchResult.foodDesc}</a> + {else} + <a href='food_quantity.php?food={$searchResult.food}'>{$searchResult.foodDesc}</a> + {/if} + </div> + {/foreach} + {/if} + </div> + <div class='pageNav'> + {$pageNav} + </div> +{else} + <div style='margin-top: 2ex;'> + <span class='msgError'>No items matched your search.</span><br /> + </div> + <div> + Would you like to <a href='index.php?{$smarty.server.QUERY_STRING|escape:"url"}'>refine your search</a>? + </div> + <div> + Don't understand the search options? See the <a href='help.php#searching'>help</a> on searching. + </div> +{/if} + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/footer.tpl b/templates/footer.tpl new file mode 100644 index 0000000..fe0ec08 --- /dev/null +++ b/templates/footer.tpl @@ -0,0 +1,18 @@ + +<div id='footer'> + <div id='footerLinks'> + <a href='index.php'>Search</a> | + <a href='help.php'>Help</a> | + <a href='terms.html' onclick='openInNewWindow("terms.html"); return false;'>Terms & Conditions</a> + </div> +</div> + +<script src='http://www.google-analytics.com/urchin.js' type='text/javascript'></script> +<script type='text/javascript'> + _uacct = 'UA-1658795-1'; + urchinTracker(); +</script> + +</body> + +</html> diff --git a/templates/guide.tpl b/templates/guide.tpl new file mode 100644 index 0000000..b781315 --- /dev/null +++ b/templates/guide.tpl @@ -0,0 +1,108 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData' style='text-align: justify;'> + + <h2 style='text-align: center;'>GUIDE</h2> + + <div class='standardMargins'> + This isn't by any means intended to be an exhaustive guide on how to use this site. + It is hoped that the site will be relatively intuitive for the majority of users, + obviating the need for an entire manual. If something is very important to know + then I will generally have included some instructions or tips at the appropriate + place in the user interface. In this sense, some of the site is somewhat self + documenting. + </div> + + <div class='standardMargins'> + The site can certainly be useful to those who don't create an account, but without + logging in one is limited to doing one-off searches and trying to build meals that + will disappear once you leave the site. This is good and well and may be all that + many people want. This site will perhaps be most useful to those who want to keep a + food diary, and in order to do this you must login. + </div> + + <div class='standardMargins'> + The notion is for a user to build up a collection of saved foods and meals, and then + to use those as the building blocks for keeping an accurate food diary. The + database has information on thousands of foods, but it takes time to search for them + individually. It seems to me that most people generally tend to eat the same things + over and over again, with some variety added in here and there. So rather than + searching for those repeated foods and meals each day in order to add them to a + diary, you can simply save a particular item and then with about two clicks it can + be added to a diary at any time in the future. + </div> + + <div class='standardMargins'> + Above, I mention the concept of a "meal." In the context of this database, a meal + is just a collection of an arbitrary number of individual foods. Once a meal has + been created, you can view the entire nutritional profile for all of the foods + together. Logically, any meal, dish, or dinner is just a combination of a number of + ingredients. Since we typically eat lots of foods in combinations, the ability to + create and add a meal to a diary makes sense. Foods can be added to or taken away + from an existing meal at any time, and existing meals can be used as templates for + creating new, similar meals. + </div> + + <div class='standardMargins'> + One legitimate complaint that is sure to arise is that not all of the foods you eat + can be located in the database. To be sure, it impossible to have every possible + food in the database, to say nothing of every processed, branded food. However, the + USDA data has quite a large selection of the most common foods. What I have found, + is that while a particular brand-name food might not be in the database, there will + generally be a generic food of more or less equivalent value. + </div> + + <div class='standardMargins'> + As an example, let's say you wanted to find the nutrition content for 1 pint of Ben + & Jerry's ice cream. At the moment that brand is not in the database, though + there are many other types of ice cream in the system. Because the system allows + you to name your foods and meals, you could simply find a similar ice cream and then + adjust the quantity such that the resulting nutrition information matches the + brand-name product as closely as possible. What this essentially does is allow you + to alias foods in the database with names that make more sense to you, or names of + brand-name products. + </div> + + <div class='standardMargins'> + I spent a lot of time thinking about how to handle cases such as this. Some sites + allow you to enter foods into their database, pending a review by someone at the + site before the food is actually entered. This is great, but has the major flaw + that it is impossible to verify all the data, which process takes time and resources + and introduces major problems of scalability. By allowing all users to be able to + enter nutritional data on brand-name products into the database you can be nearly + sure that a certain percentage of the data will be incorrect or incomplete. So, in + the end I decided it was best to rely on data that I felt I could trust at all + times. + </div> + + <div class='standardMargins'> + Foods and meals that users find and save are searchable by everyone. What this + means is that the more people use the site, the more foods and meals will be + searchable by everyone. Though you cannot guarantee that the name someone gave a + particular food will accurately represent the food itself, what can be counted upon + is the accuracy of the data, and in any case, next to every aliased (i.e. saved) + food will appear the original name the USDA gave to it, so it will be virtually + impossible for someone to maliciously load the database will inconspicuously + fraudulent data. + </div> + + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} + diff --git a/templates/header.tpl b/templates/header.tpl new file mode 100644 index 0000000..d280975 --- /dev/null +++ b/templates/header.tpl @@ -0,0 +1,51 @@ +<?xml version='1.0' ?> +<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> + +<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> + +<head>{$myHeaders}</head> + +{if $config->_thisScript == "index.php"} +<body onload='getElement("searchForm").searchString.focus();'> +{else} +<body> +{/if} + +<div id='header'> + <div id='headerLeft'> + <a href='{$config->_rootUri}/' style='color: #000000;'>Nutrition Information Database</a> + </div> + +{if isset($isLoggedIn)} + <div id='headerMiddle'></div> + <div id='headerRight'> + Hi {$smarty.session.user.username}.<br /> + [<a href='logout.php'>Logout</a>] + + </div> +{else} + <form action='login.php' method='post' id='loginForm' onsubmit='return validateLoginFields();'> + <div id='headerMiddle'> + Login <input type='text' name='username' id='username' size='15' maxlength='25' /><br /> + Password <input type='password' name='password' id='password' size='15' maxlength='25' /> + </div> + <div id='headerRight'> + <input type='submit' name='doLogin' value='Login' style='margin-bottom: 1ex;' /><br /> + <a href='register.php'>Register</a>. + </div> + </form> +{/if} + + <div id='headerLinkBar'> + <div id='headerLinks'> + <a href='{$config->_rootUri}/' title='Home/Search Page'>Search</a> | + <a href='{$config->_rootUri}/about.php' title='About nutridb.com'>About</a> | + <a href='{$config->_rootUri}/guide.php' title='A brief guide'>Guide</a> | + <a href='{$config->_rootUri}/resources.php' title='Other useful information'>Resources</a> | + <a href='faq.php' title='FAQ'>FAQ</a> + </div> + <div id='systemMsgs'>{$systemMsg}</div> + </div> +</div> + + diff --git a/templates/index.tpl b/templates/index.tpl new file mode 100644 index 0000000..12dcdfa --- /dev/null +++ b/templates/index.tpl @@ -0,0 +1,110 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <form action='food_search.php' method='post' id='searchForm' onsubmit='return validateSearchBox();'> + <div class='standardMargins' style='text-align: justify;'> + The default search options below are probably fine in most cases. + Generally you should be able to just type some text in the "Search for" box and then + click "Search." If you are having trouble finding the food you want or would like to make more + advanced searches on the database, change any or all of the options below. + To learn more about these search options see the + <a href='help.php#searching'>help on searching.</a> + </div> + <div class='standardMargins' style='text-align: justify;'> + <strong>NOTE</strong>: if the system has something to tell you, the message will be + <a href='{$smarty.server.PHP_SELF}' onmouseover='highlightSysMsgBox();' onmouseout='unhighlightSysMsgBox();' onclick='return false;'>displayed</a> + in the black navigation bar at the top of the screen, just below the login fields. If the + system seems to be acting strangely or in some way you didn't expect, then don't forget to check + this system message area, as the system frequently communicates with you there. + </div> + <div class='standardMargins' style='text-align: center;'> + <strong>Search for</strong>: + <input type='text' name='searchString' id='searchString' value='{$currentSearchString}' size='25' /> + <!-- + Apparently IE won't send the submit button's name/value pair when a form + is submitted via the Enter key ... unless there are at least two text + input fields. This is documented all over the web. + --> + <input type='text' name'IEHack' 'value='IEHack: see note above' style='display: none;' /> + <input type='submit' name='doSearch' value='Search' /> + </div> + <div class='standardMargins'> + <strong>Category</strong>:<br /> + <select name='foodCat'> +{foreach from=$foodCats item=foodCat} + {if $foodCat.fdgrp_cd == $currentFoodCat} + <option value='{$foodCat.fdgrp_cd}' selected='selected'>{$foodCat.fdgrp_desc}</option> + {else} + <option value='{$foodCat.fdgrp_cd}'>{$foodCat.fdgrp_desc}</option> + {/if} +{/foreach} + </select> + </div> + <div class='standardMargins'> + <strong>Type of search</strong>:<br /> +{foreach from=$searchTypes item=searchType} + {if $searchType == $currentSearchType} + <input type='radio' name='searchType' value='{$searchType}' checked='checked' />{$searchType}<br /> + {else} + <input type='radio' name='searchType' value='{$searchType}' />{$searchType}<br /> + {/if} +{/foreach} + </div> + <div class='standardMargins'> + <strong>Type of word search</strong>:<br /> +{foreach from=$wordTypes item=wordType} + {if $wordType == $currentWordType} + <input type='radio' name='wordType' value='{$wordType}' checked='checked' />{$wordType}<br /> + {else} + <input type='radio' name='wordType' value='{$wordType}' />{$wordType}<br /> + {/if} +{/foreach} + </div> + <div class='standardMargins'> + <strong>Sort order</strong>:<br /> +{foreach from=$sortTypes item=sortType} + {if $sortType == $currentSortType} + <input type='radio' name='sortType' value='{$sortType}' checked='checked' />{$sortType}<br /> + {else} + <input type='radio' name='sortType' value='{$sortType}' />{$sortType}<br /> + {/if} +{/foreach} + </div> + </form> + + <hr /> + + <div class='standardMargins'> + Alternatively, you can search for the top 50 foods in the database containing + the highest concentrations of the specified nutrient. + </div> + + <form action='nutrient_search.php' method='post' id='nutrientSearchForm'> + <div> + <select name='nutrient'> +{foreach from=$nutrientList item=nutrient} + <option value='{$nutrient.nutr_no}'>{$nutrient.nutrdesc}</option> +{/foreach} + </select> + <input type='submit' name='doFindNutrients' value='Search' /> + </div> + </form> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/list_diaries.tpl b/templates/list_diaries.tpl new file mode 100644 index 0000000..b7012e2 --- /dev/null +++ b/templates/list_diaries.tpl @@ -0,0 +1,45 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <h3 style='text-align: center;'>Diaries</h3> +{if $userDiaries} + {if $diaryCount < 50} + <div> + {foreach from=$userDiaries item=userDiary name=userDiaries} + <div>{$smarty.foreach.userDiaries.iteration}) <a href='view_diary.php?diary={$userDiary.id}&action=viewDiary'>{$userDiary.description|escape:'html'}</a></div> + {/foreach} + </div> + {else} + <div style='float: left; margin-right: 5ex;'> + {foreach from=$userDiaries item=userDiary name=userDiaries} + {math equation='ceil(x/2) + 1' x=$diaryCount assign=medianDiary} + {if $smarty.foreach.userDiaries.iteration == $medianDiary} + </div> + <div style='float: left; width: 49%;'> + {/if} + <div>{$smarty.foreach.userDiaries.iteration}) <a href='view_diary.php?diary={$userDiary.id}&action=viewDiary'>{$userDiary.description|escape:'html'}</a></div> + {/foreach} + </div> + {/if} +{else} + <div>* No saved diaries.</div> +{/if} + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/list_foods.tpl b/templates/list_foods.tpl new file mode 100644 index 0000000..7c35c23 --- /dev/null +++ b/templates/list_foods.tpl @@ -0,0 +1,45 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <h3 style='text-align: center;'>Saved Foods</h3> +{if $userFoods} + {if $foodCount < 50} + <div> + {foreach from=$userFoods item=userFood name=userFoods} + <div>{$smarty.foreach.userFoods.iteration}) <a href='view_food.php?food={$userFood.food}&weight={$userFood.weight}&quantity={$userFood.quantity}&description={$userFood.description|escape:'url'}&action=viewFood'>{$userFood.description|escape:'html'}</a></div> + {/foreach} + </div> + {else} + <div style='float: left; margin-right: 5ex;'> + {foreach from=$userFoods item=userFood name=userFoods} + {math equation='ceil(x/2) + 1' x=$foodCount assign=medianFood} + {if $smarty.foreach.userFoods.iteration == $medianFood} + </div> + <div style='float: left; width: 49%;'> + {/if} + <div>{$smarty.foreach.userFoods.iteration}) <a href='view_food.php?food={$userFood.food}&weight={$userFood.weight}&quantity={$userFood.quantity}&description={$userFood.description|escape:'url'}&action=viewFood'>{$userFood.description|escape:'html'}</a></div> + {/foreach} + </div> + {/if} +{else} + <div>* No saved foods.</div> +{/if} + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/list_meals.tpl b/templates/list_meals.tpl new file mode 100644 index 0000000..b357353 --- /dev/null +++ b/templates/list_meals.tpl @@ -0,0 +1,45 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <h3 style='text-align: center;'>Saved Meals</h3> +{if $userMeals} + {if $mealCount < 50} + <div> + {foreach from=$userMeals item=userMeal name=userMeals} + <div>{$smarty.foreach.userMeals.iteration}) <a href='view_meal.php?meal={$userMeal.id}&action=viewMeal'>{$userMeal.description|escape:'html'}</a></div> + {/foreach} + </div> + {else} + <div style='float: left; margin-right: 5ex;'> + {foreach from=$userMeals item=userMeal name=userMeals} + {math equation='ceil(x/2) + 1' x=$mealCount assign=medianMeal} + {if $smarty.foreach.userMeals.iteration == $medianMeal} + </div> + <div style='float: left; width: 49%;'> + {/if} + <div>{$smarty.foreach.userMeals.iteration}) <a href='view_meal.php?meal={$userMeal.id}&action=viewMeal'>{$userMeal.description|escape:'html'}</a></div> + {/foreach} + </div> + {/if} +{else} + <div>* No saved meals.</div> +{/if} + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/manage.tpl b/templates/manage.tpl new file mode 100644 index 0000000..20a7e96 --- /dev/null +++ b/templates/manage.tpl @@ -0,0 +1,162 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <h3 style='text-align: center;'>Manage Account</h3> + <div><strong>Quick edit favorites</strong>:</div> + <div style='border: 1px solid black;'> +{if $favFoods} + <div style='padding: 1ex;'> + <form action='edit_food.php' method='post' name='formQuickEditFood' id='formQuickEditFood' onsubmit='return validateEditFood("formQuickEditFood");'> + <div style='float: left; margin-right: .5ex; overflow: auto;'> + <strong>Foods:</strong><br /> + <select name='food' id='foodId'> + {foreach from=$favFoods item=favFood} + <option value='{$favFood.id}'>{$favFood.description|escape:'html'|truncate:50:" ..."}</option> + {/foreach} + </select> + </div> + <div style='float: left; margin-right: .5ex;'> + <strong>Action:</strong><br /> + <select name='action' id='foodAction' onchange='return toggleShowRenameField("foodAction","renameFood");'> + <option value='Edit'>Edit</option> + <option value='Delete'>Delete</option> + <option value='Rename'>Rename</option> + </select> + </div> + <div id='renameFood' style='display: none; float: left; margin-right: .5ex;'> + <strong>New name:</strong><br /> + <input type='text' name='newFoodName' id='newFoodName' size='20' /> + </div> + <div style='float: left;'> + <br /> + <input type='submit' name='doModifyFood' value='Go' /> + </div> + </form> + </div> + <div style='clear: both;'></div> +{else} + <div style='margin: 1ex;'>* No saved foods to manage.</div> +{/if} +{if $favMeals} + <div style='padding: 1ex;'> + <form action='edit_meal.php' method='post' name='formQuickEditMeal' id='formQuickEditMeal' onsubmit='return validateEditMeal("formQuickEditMeal");'> + <div style='float: left; margin-right: .5ex; overflow: auto;'> + <strong>Meals:</strong><br /> + <select name='meal' id='meal'> + {foreach from=$favMeals item=favMeal} + <option value='{$favMeal.id}'>{$favMeal.description|escape:"html"|truncate:50:" ..."}</option> + {/foreach} + </select> + </div> + <div style='float: left; margin-right: .5ex;'> + <strong>Action:</strong><br /> + <select name='action' id='mealAction' onchange='return toggleShowRenameField("mealAction","renameMeal");'> + <option value='Edit'>Edit</option> + <option value='Rename'>Rename</option> + <option value='Delete'>Delete</option> + </select> + </div> + <div id='renameMeal' style='display: none; float: left; margin-right: .5ex;'> + <strong>New name:</strong><br /> + <input type='text' name='newMealName' size='20' /> + </div> + <div style='float: left;'> + <br /> + <input type='submit' name='doModifyMeal' value='Go' /> + </div> + </form> + </div> + <div style='clear: both;'></div> +{else} + <div style='margin: 1ex;'>* No saved meals to manage.</div> +{/if} +{if $userDiaries} + <div style='margin: 1ex;'> + <form action='edit_diary.php' method='post' name='formQuickEditDiary' id='formQuickEditDiary' onsubmit='return validateEditDiary("formQuickEditDiary");'> + <div style='float: left; margin-right: .5ex; overflow: auto;'> + <strong>Diaries:</strong><br /> + <select name='diary' id='diaryId'> + {foreach from=$userDiaries item=userDiary} + <option value='{$userDiary.id}'>{$userDiary.description|escape:"html"|truncate:50:" ..."}</option> + {/foreach} + </select> + </div> + <div style='float: left; margin-right: .5ex;'> + <strong>Action:</strong><br /> + <select name='action' id='diaryAction' onchange='return toggleShowRenameField("diaryAction","renameDiary");'> + <option value='Delete'>Delete</option> + <option value='Rename'>Rename</option> + </select> + </div> + <div id='renameDiary' style='display: none; float: left; margin-right: .5ex;'> + <strong>New name:</strong><br /> + <input type='text' name='newDiaryName' id='newDiaryName' size='20' /> + </div> + <div style='float: left;'> + <br /> + <input type='submit' name='doModifyDiary' value='Go' /> + </div> + </form> + </div> + <div style='clear: both;'> </div> +{else} + <div style='margin: 1ex;'>* No saved diaries to manage.</div> +{/if} + </div> + + <div style='margin-top: 2ex; margin-bottom: 2ex;'> + <a href='edit_food.php?action=showFoods'>Edit foods</a> - use this section to edit any/all foods, + not just favorites. + </div> + + <div style='margin-top: 2ex; margin-bottom: 2ex;'> + <a href='edit_meal.php?action=showMeals'>Edit meals</a> - use this section to edit any/all meals, + not just favorites. + </div> + + <div style='margin-top: 2ex; margin-bottom: 2ex;'> + <form action='add_diary.php' method='post' onsubmit='return validateCreateDiary("newDiaryName");'> + <div> + <strong>Create</strong> a new diary named + <input type='text' name='newDiaryName' id='newDiaryName' /> + <input type='submit' name='doCreateDiary' value='Go' /> + </div> + </form> + </div> + <div style='margin-top: 2ex; margin-bottom: 2ex; text-align: justify;'> + <a href='nutrient_chooser.php'>Edit your list of standard nutrients.</a> There is + a large number of nutrients available for most foods. Usually you will not be + concerned with the majority of them, but rather only a small percentage of the + available nutrients. Use this section to filter out the nutrients you do not want + to see, though you will always have the option to view all nutrient data while + viewing any food or meal. + </div> + + <div style='margin-top: 2ex; margin-bottom: 2ex; text-align: justify;'> + <a href='edit_account.php'>Edit your profile.</a> Here you can change + things like your password, username, birthday or gender. +<!-- + <a href='edit_account.php'>Edit your profile.</a> Here you can change + things like your password, username, birthday, gender, or even delete your + whole account and all the data associated with it. +--> + </div> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/nutrient_chooser.tpl b/templates/nutrient_chooser.tpl new file mode 100644 index 0000000..cebe456 --- /dev/null +++ b/templates/nutrient_chooser.tpl @@ -0,0 +1,56 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <h3 style='text-align: center;'>Nutrient Chooser</h3> + <p style='text-align: justify;'> + There is fairly bewildering array of nutrient data available for most of the foods + in this database. In most cases, you may only be concerned with a select few of + these nutrients. This form allows you to select which nutrients will be displayed + in your food and meal summaries. Don't be afraid to uncheck too may options below. + With every summary you will have the option to view information for all nutrients, + including the ones you have selected to hide here. Checked nutrients will be displayed + in summaries. Unchecked nutrients will be hidden. + </p> + <a href='javascript: checkAll("nutrients[]");'>Check all</a> | + <a href='javascript: uncheckAll("nutrients[]");'>Uncheck all</a> + <div style='width: 100%;'> + <form action='{$_SERVER[PHP_SELF]}' method='post' id='nutrientChooser'> + <table class='standardTable'> + <tr class='tableTitleRow'> + <th>Show/Hide</th> + <th>Nutrient Description</th> + </tr> +{foreach from=$nutrients item=nutrient} + <tr class='{cycle values="bgDark,bgLight"}'> + {if ! empty($nutrient.myNutrient)} + <td style='text-align: center;'><input type='checkbox' name='nutrients[]' value='{$nutrient.nutr_no}' checked='checked' /></td> + {else} + <td style='text-align: center;'><input type='checkbox' name='nutrients[]' value='{$nutrient.nutr_no}' /></td> + {/if} + <td>{$nutrient.nutrdesc}</td> + </tr> +{/foreach} + </table> + <br /> + <input type='submit' name='setNutrients' value='Save Changes'> + </form> + </div> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/nutrient_search.tpl b/templates/nutrient_search.tpl new file mode 100644 index 0000000..d9a052f --- /dev/null +++ b/templates/nutrient_search.tpl @@ -0,0 +1,53 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + <div> + <strong>Nutrient</strong>: {$nutrientName}<br /> + </div> +{if isset($searchResults)} + <div style='margin-top: 2ex;'> + The following ({$smarty.get.count}) foods have the highest "{$nutrientName}" content in the database.<br /> + The results are in decending order (highest quantity first).<br /> + In parenthesis is the quantity of "{$nutrientName}" per 100g of the displayed item.<br /> + Please select one. + </div> + <div style='margin-top: 2ex;'> + <ol> + {foreach from=$searchResults item=searchResult} + <li><a href='food_quantity.php?food={$searchResult.food}'>({$searchResult.nutr_val}{$searchResult.units}) {$searchResult.foodDesc}</a><br /></li> + {/foreach} + </ol> + </div> + <div class='pageNav'> + {$pageNav} + </div> +{else} + <div style='margin-top: 2ex;'> + <span class='msgError'>No items matched your search.</span><br /> + </div> + <div> + Would you like to <a href='index.php?{$smarty.server.QUERY_STRING}'>refine your search</a>? + </div> + <div> + Don't understand the search options? See the <a href='help.php#searching'>help</a> on searching. + </div> +{/if} + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/register.tpl b/templates/register.tpl new file mode 100644 index 0000000..a1e760f --- /dev/null +++ b/templates/register.tpl @@ -0,0 +1,86 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData'> + + <h3 style='text-align: center;'>Register</h3> + <div style='text-align: center;'> <!-- this outer div here is to make IE6 center align a box correctly --> + <div class='registerDiv'> + <div class='standardMargins' style='text-align: justify;'> + Please complete the following form to register with nutridb.com. It is fairly + important that your birthday and gender be correct because the DRIs (Dietary Reference Intakes - + a newer version of the RDAs (Recommended Dietary Allowances)) are age/gender specific, so + if you give incorrect values here, then the returned DRIs may be incorrect for you in + particular. <strong>NOTE</strong>: nutridb.com does not request your real name, an email + address, or any other personal/private information, nor does nutridb.com want this + information. Below you simply need to select a unique login name, a password and basic + age/gender information. For more information see the help regarding + <a href='help.php#whyregister'>why you might want to register</a>. + </div> + </div> + <div class='registerDiv'> + <form action='{$smarty.server.PHP_SELF}' method='post' id='formRegisterUser' onsubmit='validateRegisterUser("formRegisterUser"); return false;'> + <div class='standardMargins'> + <input type='text' name='username' size='25' /> <strong>Login name</strong> + (min. 5 chars.) + </div> + <div class='standardMargins'> + <input type='password' name='password' size='25' /> <strong>Password</strong> + (min. 5 chars.) + </div> + <div class='standardMargins'> + <input type='password' name='password2' size='25' /> <strong>Confirm password</strong> + (min. 5 chars.) + </div> + <div class='standardMargins'> + <input type='text' name='birthday' id='birthday' readonly='readonly' value='' /> <strong>Birthday</strong> + <script type="text/javascript"> + Calendar.setup( + {literal}{{/literal} + inputField : "birthday", // ID of the input field + ifFormat : "%Y-%m-%d", // the date format + button : "birthday", // ID of the button + weekNumbers : false, + showsTime : true, + firstDay : 0 + {literal}}{/literal} + ); + </script> + </div> + <div class='standardMargins'> + <select name='gender'> + <option value='Female'>Female</option> + <option value='Male'>Male</option> + </select> <strong>Gender</strong> + </div> + <div class='standardMargins'> + <input type='checkbox' name='terms' value='accepted' /> + I have read, fully understand, and accept the <a href='{$smarty.server.REQUEST_URI}' onclick='openInNewWindow("terms.html"); return false;'> + Terms & Conditions</a> of use. + </div> + <div class='standardMargins'> + <input type='hidden' name='action' value='' /> + <input type='submit' name='doRegister' value='Register' onclick='getElement("formRegisterUser").action.value = "registerUser";' /> + </div> + </form> + </div> + </div> + + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/resources.tpl b/templates/resources.tpl new file mode 100644 index 0000000..10f6da7 --- /dev/null +++ b/templates/resources.tpl @@ -0,0 +1,45 @@ +{$header} +<div id='columnContainer'> + + <div id='middleColumn'> + <div id='middleData' style='text-align: justify;'> + + <h2 style='text-align: center;'>RESOURCES</h2> + + <a name='nutritionsites' id='nutritionsites' style='position: absolute;'></a> + <div class='standardMargins'> + Here are a few other nutrition information sites that stand out to me. They have a + very complete set of tools and information. You may find them useful. + <ul> + <li><a href='http://www.nutritiondata.com'>http://www.nutritiondata.com</a></li> + <li><a href='http://www.thedailyplate.com'>http://www.thedailyplate.com</a></li> + </ul> + </div> + + <a name='ndl' id='ndl' style='position: absolute;'></a> + <div class='standardMargins'> + The USDA Nutrient Data Laboratory is where the vast majority of reliable nutrient + data comes from, including for this site. + <ul> + <li><a href='http://www.ars.usda.gov/main/site_main.htm?modecode=12354500'>USDA Nutrient Data Laboratory</a></li> + </ul> + </div> + + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} + diff --git a/templates/sidebar_left.tpl b/templates/sidebar_left.tpl new file mode 100644 index 0000000..8ae0b1b --- /dev/null +++ b/templates/sidebar_left.tpl @@ -0,0 +1,71 @@ + <div><strong>Current meal</strong>:</div> + <div id='divCurrentMeal'> +{if $currentMealItems} + {foreach from=$currentMealItems key=key item=currentMealItem} + <div id='currentMealItem-{$key}'> + <a href='{$smarty.server.REQUEST_URI}' onclick='verifyRemoveCurrentMealItem("{$key}"); return false;' title='Remove: {$currentMealItem.description|escape:"html"}'><img src='{$config->_imgUri}/remove.png' alt='(Del)' /></a> + => <a href='view_food.php?food={$currentMealItem.food}&weight={$currentMealItem.weight}&quantity={$currentMealItem.quantity}&description={$currentMealItem.description|escape:"url"}&action=viewFood' id='currentMealItemDesc-{$key}' title='View this item'>{$currentMealItem.description|escape:"html"}</a> + </div> + {/foreach} + <div style='margin-top: 1ex;'> + <a href='view_meal.php?meal=0&action=getMeal' title='View current meal'>View meal</a> | + <a href='{$smarty.server.REQUEST_URI}' onclick='verifyClearCurrentMeal(); return false;' title='Remove all meal items'>Clear meal</a> + </div> +{else} + No items in meal. +{/if} + </div> +{if $isLoggedIn} + <div style='margin-top: 2ex;'><strong>Favorites:</strong></div> + <div style='margin-top: 1ex;'> + {if $favFoods} + <form action='view_food.php' method='post' id='frmFavFoods' style='margin: 0;'> + <select name='queryString' style='width: 100%;' onchange='return submitForm("frmFavFoods");'> + <option value=''> -- Foods -- </option> + <option value='viewAllFoods'>[View All]</option> + {foreach from=$favFoods item=favFood} + <option value='food={$favFood.food}&weight={$favFood.weight}&quantity={$favFood.quantity}&description={$favFood.description|escape:'url'}&action=viewFood'>{$favFood.description|escape:'html'}</option> + {/foreach} + </select> + <input type='hidden' name='action' value='viewFood' /> + </form> + {else} + * No favorite foods.<br /> + {/if} + </div> + <div style='margin-top: 1ex;'> + {if $favMeals} + <form action='view_meal.php' method='post' id='frmFavMeals' style='margin: 0;'> + <select name='meal' style='width: 100%;' onchange='return submitForm("frmFavMeals");'> + <option value=''> -- Meals -- </option> + <option value='viewAllMeals'>[View All]</option> + {foreach from=$favMeals item=favMeal} + <option value='{$favMeal.id}'>{$favMeal.description|escape:'html'}</option> + {/foreach} + </select> + <input type='hidden' name='action' value='viewMeal' /> + </form> + {else} + * No favorite meals.<br /> + {/if} + </div> + <div style='margin-top: 1ex;'> + {if $userDiaries} + <form action='view_diary.php' method='post' id='frmFavDiaries' style='margin: 0;'> + <select name='diary' style='width: 100%;' onchange='return submitForm("frmFavDiaries");'> + <option value=''> -- Diaries -- </option> + <option value='viewAllDiaries'>[View All]</option> + {foreach from=$userDiaries item=userDiary} + <option value='{$userDiary.id}'>{$userDiary.description|escape:'html'}</option> + {/foreach} + </select> + <input type='hidden' name='action' value='viewDiary' /> + </form> + {else} + * No diaries. + {/if} + </div> + <div style='margin-top: 2ex;'> + <a href='manage.php'>Manage account</a>. + </div> +{/if} diff --git a/templates/sidebar_left.tpl.orig b/templates/sidebar_left.tpl.orig new file mode 100644 index 0000000..dbd7881 --- /dev/null +++ b/templates/sidebar_left.tpl.orig @@ -0,0 +1,64 @@ + <div><strong>Current meal</strong>:</div> +{if isset($currentMealItems)} + <form action='view_meal.php' method='post'> +{foreach from=$currentMealItems key=key item=currentMealItem} + <span class='indent'> => {$currentMealItem.description|escape:'html'} (<a href='edit_new_meal.php?rm_item={$key}' title='Remove meal item'>Del</a>)</span> + <br /> +{/foreach} + <input type='hidden' name='source' value='new' /> + <input type='submit' name='view_new_meal' value='View Meal' /> + <a href='edit_new_meal.php?clear_meal=yes' title='Remove all meal items'>Clear Meal</a> + </form> +{else} + (No items in meal.) +{/if} +{if $isLoggedIn} + <div style='margin-top: 2ex;'><strong>Saved items</strong>:</div> +{if $myFoods} + <form action='view_food.php' method='post' id='frmMyFoods' style='margin: .5ex;'> + <select name='queryString' style='width: 70%; margin-bottom: .5ex;' onchange='return submitForm("frmMyFoods");'> + <option value=''> -- Select -- </option> +{foreach from=$myFoods item=myFood} + <option value='ndb_no={$myFood.ndb_no}&weight={$myFood.id_weight}&quantity={$myFood.my_qty}&foodDesc={$myFood.my_desc}&action=viewFood'>{$myFood.my_desc}</option> +{/foreach} + </select> + Foods + <input type='hidden' name='viewFood' value='viewFood' /> + </form> +{else} + No saved foods.<br /> +{/if} + +{if $myMeals} + <form action='view_meal.php' method='post' id='frmMyMeals' style='margin: .5ex;'> + <select name='mealId' style='width: 70%; margin-bottom: .5ex;' onchange='return submitForm("frmMyMeals");'> + <option value=''> -- Select -- </option> +{foreach from=$myMeals item=myMeal} + <option value='{$myMeal.id_my_meals}'>{$myMeal.meal_desc}</option> +{/foreach} + </select> + Meals + <input type='hidden' name='action' value='viewMeal' /> + </form> +{else} + No saved meals.<br /> +{/if} + +{if $myDiaries} + <form action='view_diary.php' method='post' id='frmMyDiaries' style='margin: .5ex;'> + <select name='id_my_diaries' style='width: 70%; margin-bottom: .5ex;' onchange='return submitForm("frmMyDiaries");'> + <option value=''> -- Select -- </option> +{foreach from=$myDiaries item=myDiary} + <option value='{$myDiary.id_my_diaries}'>{$myDiary.diary_desc}</option> +{/foreach} + </select> + Meals + </form> + Diaries +{else} + No saved diaries. +{/if} + <p> + <a href='my_stuff.php'>Manage my account</a>. + </p> +{/if} diff --git a/templates/sidebar_right.tpl b/templates/sidebar_right.tpl new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/templates/sidebar_right.tpl @@ -0,0 +1 @@ + diff --git a/templates/trash/sidebar_left.tpl.orig b/templates/trash/sidebar_left.tpl.orig new file mode 100644 index 0000000..dbd7881 --- /dev/null +++ b/templates/trash/sidebar_left.tpl.orig @@ -0,0 +1,64 @@ + <div><strong>Current meal</strong>:</div> +{if isset($currentMealItems)} + <form action='view_meal.php' method='post'> +{foreach from=$currentMealItems key=key item=currentMealItem} + <span class='indent'> => {$currentMealItem.description|escape:'html'} (<a href='edit_new_meal.php?rm_item={$key}' title='Remove meal item'>Del</a>)</span> + <br /> +{/foreach} + <input type='hidden' name='source' value='new' /> + <input type='submit' name='view_new_meal' value='View Meal' /> + <a href='edit_new_meal.php?clear_meal=yes' title='Remove all meal items'>Clear Meal</a> + </form> +{else} + (No items in meal.) +{/if} +{if $isLoggedIn} + <div style='margin-top: 2ex;'><strong>Saved items</strong>:</div> +{if $myFoods} + <form action='view_food.php' method='post' id='frmMyFoods' style='margin: .5ex;'> + <select name='queryString' style='width: 70%; margin-bottom: .5ex;' onchange='return submitForm("frmMyFoods");'> + <option value=''> -- Select -- </option> +{foreach from=$myFoods item=myFood} + <option value='ndb_no={$myFood.ndb_no}&weight={$myFood.id_weight}&quantity={$myFood.my_qty}&foodDesc={$myFood.my_desc}&action=viewFood'>{$myFood.my_desc}</option> +{/foreach} + </select> + Foods + <input type='hidden' name='viewFood' value='viewFood' /> + </form> +{else} + No saved foods.<br /> +{/if} + +{if $myMeals} + <form action='view_meal.php' method='post' id='frmMyMeals' style='margin: .5ex;'> + <select name='mealId' style='width: 70%; margin-bottom: .5ex;' onchange='return submitForm("frmMyMeals");'> + <option value=''> -- Select -- </option> +{foreach from=$myMeals item=myMeal} + <option value='{$myMeal.id_my_meals}'>{$myMeal.meal_desc}</option> +{/foreach} + </select> + Meals + <input type='hidden' name='action' value='viewMeal' /> + </form> +{else} + No saved meals.<br /> +{/if} + +{if $myDiaries} + <form action='view_diary.php' method='post' id='frmMyDiaries' style='margin: .5ex;'> + <select name='id_my_diaries' style='width: 70%; margin-bottom: .5ex;' onchange='return submitForm("frmMyDiaries");'> + <option value=''> -- Select -- </option> +{foreach from=$myDiaries item=myDiary} + <option value='{$myDiary.id_my_diaries}'>{$myDiary.diary_desc}</option> +{/foreach} + </select> + Meals + </form> + Diaries +{else} + No saved diaries. +{/if} + <p> + <a href='my_stuff.php'>Manage my account</a>. + </p> +{/if} diff --git a/templates/view_diary.tpl b/templates/view_diary.tpl new file mode 100644 index 0000000..28a3250 --- /dev/null +++ b/templates/view_diary.tpl @@ -0,0 +1,164 @@ +{$header} +<div id='columnContainer'> + <div id='middleColumn'> + <div id='middleData'> + <div class='standardMargins'> + <strong>Diary</strong>: {$diaryDesc} + </div> + + <div id='diaryCalendar' style='width: 15em; margin-bottom: 2ex; margin-right: 2ex; float: left;'></div> + <script type='text/javascript'> +{literal} + function dateChanged(calendar) { + if (calendar.dateClicked) { + var y = calendar.date.getFullYear(); + var m = calendar.date.getMonth(); + var d = calendar.date.getDate(); +{/literal} + window.location = "view_diary.php?diary={$smarty.get.diary}&action=viewDiary&date=" + y + "-" + (m + 1) + "-" + d; +{literal} + } + } + Calendar.setup( + { + flat : "diaryCalendar", // ID of the parent element + flatCallback : dateChanged, // our callback function +{/literal} + range : [{$firstYear},{$lastYear}], + date : "{$calendarStartDate}" +{literal} + } + ); +{/literal} + </script> + + <div style='float: left;'> + <div style='margin-bottom: 2ex;'> + Navigate this diary with the calendar. + </div> + <form action='edit_diary.php' method='post' id='formEditDiary' onsubmit='return validateAddDiaryNote("formEditDiary");'> + <div><strong>Add a note to this diary:</strong></div> + <textarea name='note' rows='3' style='width: 97%;'></textarea> + <div style='margin-bottom: .5em;'> + <input type='hidden' name='action' value='addNote' /> + <input type='hidden' name='diary' value='{$smarty.get.diary}' /> + <input type='submit' name='doAddNote' value='Add note' /> + with + <a href='help.php#timestamp' title='What is a diary timestamp?'>timestamp</a> + <input type='text' name='diaryTimestamp' id='diaryTimestamp' readonly='readonly' value='{$smarty.get.date|date_format:"%Y-%m-%d"}' size='20' /> + <script type="text/javascript"> + Calendar.setup( + {literal}{{/literal} + inputField : "diaryTimestamp", + ifFormat : "%Y-%m-%d %I:%M%p", + button : "diaryTimestamp", + weekNumbers : false, + showsTime : true, + firstDay : 0 + {literal}}{/literal} + ); + </script> + </div> + <div> + <small>TIP: leave the timestamp blank to use the present date/time.</small> + </div> + </form> + </div> + <div style='clear: both;'></div> + +{if $diaryItems} + <div class='standardMargins'> + <strong>Diary entries for {$smarty.get.date|date_format:"%A, %B %e, %Y"}.</strong><br /> + </div> + + <div class='standardMargins' style='width: 100%;'> + <table class='standardTable'> + <tr class='tableTitleRow'> + <th>Item</th> + <th>Date</th> + <th>Type</th> + <th>X</th> + </tr> + {foreach from=$diaryItems item=diaryItem} + <tr class='{cycle values="bgDark,bgLight"}' id='itemRow-{$diaryItem.id}'> + {if $diaryItem.type == "Food"} + <td><a href='view_food.php?{$diaryItem.uri}' id='itemDesc-{$diaryItem.id}'>{$diaryItem.description}</a></td> + {elseif $diaryItem.type == "Meal"} + <td><a href='view_meal.php?{$diaryItem.uri}' id='itemDesc-{$diaryItem.id}'>{$diaryItem.description}</a></td> + {elseif $diaryItem.type == "Note"} + <td><span id='itemDesc-{$diaryItem.id}'>{$diaryItem.data}</span></td> + {/if} + <td style='text-align: center;'>{$diaryItem.date}</td> + <td style='text-align: center;'>{$diaryItem.type}</td> + <td style='text-align: center;'> + <a href='{$smarty.server.REQUEST_URI}' onclick='verifyRemoveDiaryItem("{$diaryItem.id}"); return false;'> + <img src='{$config->_imgUri}/remove.png' alt='Del' title='Remove: {$diaryItem.description}' /> + </a> + </td> + </tr> + {/foreach} + </table> + </div> + + {if $summaryData} + <div class='standardMargins' style='width: 100%'> + <strong>Nutrient summary.</strong><br /> + {if $showAllNutrients} + <a href='{$config->_rootUri}/{$config->_thisScript}?diary={$smarty.get.diary}&action={$smarty.get.action}&date={$smarty.get.date}'> + Hide unwanted nutrients</a> | + {else} + <a href='{$config->_rootUri}/{$config->_thisScript}?diary={$smarty.get.diary}&action={$smarty.get.action}&date={$smarty.get.date}&showall'> + Show all nutrients</a> | + {/if} + <a href='nutrient_chooser.php'>Manage nutrient list</a> + </div> + + <div class='standardMargins' style='width: 100%;'> + <table class='standardTable'> + <tr class='tableTitleRow'> + <th>Nutrient</th> + <th>Total</th> + <th>%DRI</th> + </tr> + {foreach from=$summaryData item=nutrient} + <tr class='{cycle values="bgDark,bgLight"}'> + <td>{$nutrient.nutrientName}</td> + <td style='text-align: center;'>{$nutrient.total}{$nutrient.units}</td> + {if $nutrient.percentDri != "--"} + <td style='text-align: center;'>{$nutrient.percentDri}%</td> + {else} + <td style='text-align: center;'>--</td> + {/if} + {foreach from=$nutrient.quantities item=quantity} + <td style='text-align: center;'>{$quantity}</td> + {/foreach} + </tr> + {/foreach} + </table> + </div> + {/if} +{else} + <div class='standardMargins' style='text-align: justify;'> + This day has no diary entries. If you would like to add a food or a meal, search for or view an item as + you normally would and then use the form at the bottom of the nutrition summary page to add the item + to a diary. Using the "timestamp" field you can add a food or meal to this day. Here's a tip: create + a collection of saved foods that you eat frequently and use them as the building blocks for diaries and meals. + If you want to add a note to this diary, you may do so with the form below. + </div> +{/if} + </div> + </div> + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/view_food.tpl b/templates/view_food.tpl new file mode 100644 index 0000000..dda7005 --- /dev/null +++ b/templates/view_food.tpl @@ -0,0 +1,155 @@ +{$header} +<div id='columnContainer'> + <div id='middleColumn'> + <div id='middleData'> + <div style='margin-bottom: 1em;'> +{if $foodDesc} + <strong>Food</strong>: {$foodDesc} ({$foodData[0].foodDesc})<br /> +{else} + <strong>Food</strong>: {$foodData[0].foodDesc}<br /> +{/if} +{if ! empty($foodData[0].sciname)} + <strong>Scientific name</strong>: {$foodData[0].sciname}<br /> +{/if} + <strong>Quantity</strong>: {$quantity} {$foodData[0].msre_desc} (about {$gramWeight} grams) + </div> + <div style='margin-bottom: 1em;'> +{if $showAllNutrients} + <a href='{$config->_rootUri}/{$config->_thisScript}?food={$food}&weight={$weight}&quantity={$quantity}'> + Hide unwanted nutrients</a> +{else} + <a href='{$config->_rootUri}/{$config->_thisScript}?food={$food}&weight={$weight}&quantity={$quantity}&showall'> + Show all nutrients</a> +{/if} +{if $isLoggedIn} + | <a href='nutrient_chooser.php'>Manage nutrient list</a> +{/if} + </div> + <div style='width: 100%;'> + <table class='standardTable'> + <tr class='tableTitleRow'> + <th>Nutrient</th> + <th>Quantity</th> + <th>%DRI</th> + </tr> + +{foreach from=$foodData item=nutrient} + <tr class='{cycle values="bgDark,bgLight"}'> + <td>{$nutrient.nutrdesc}</td> + <td style='text-align: center;'>{$nutrient.nutrientQuantity}{$nutrient.units}</td> + {if $nutrient.percentDri != "--"} + <td style='text-align: center;'>{$nutrient.percentDri}%</td> + {else} + <td style='text-align: center;'>--</td> + {/if} + </tr> +{/foreach} + </table> + </div> + <div style='margin-top: 1em;'> + <form action='add_food.php' method='post' id="formAddFood" onsubmit='return validateAddFood("formAddFood","foodDesc");'> +{if $isLoggedIn} + <a name='save'></a> + <div style='margin-bottom: .5em; text-align: justify;'> + If you would like to save this item for later reference, or add it + to a meal or diary, enter a short descriptive entry in the + text box below and then select the appropriate button. A default + description may have been added for you. However, this description may + not be very helpful and could possibly be quite long. You are + encouraged to change this to something more meaningful, and possibly + shorter. Are you still <a href='help.php#saving'>confused</a>? + </div> + <div style='margin-bottom: .5em;'> + {if $foodDesc} + <input type='text' name='description' id='foodDesc' size='25' value='{$foodDesc|escape:'html'}' /> + {else} + <input type='text' name='description' id='foodDesc' size='25' value='{$quantity} {$foodData[0].msre_desc|escape:'html'} {$foodData[0].foodDesc|escape:'html'}' /> + {/if} + </div> + <div style='margin-bottom: .5em;'> + <input type='submit' name='saveFood' id='saveFood' value='Save food' style='width: 20ex;' onclick='getElement("formAddFood").action.value = "saveFood";' /> + </div> + <div style='margin-bottom: .5em;'> + <input type='submit' name='addFoodToMeal' id='addFoodToMeal' value='Add to meal =>' style='width: 20ex;' onclick='getElement("formAddFood").action.value = "addFoodToMeal";' /> + <select name='meal'> + <option selected='selected' value='0'>New meal</option> + {foreach from=$myMeals item=myMeal} + <option value='{$myMeal.id}'>{$myMeal.description}</option> + {/foreach} + </select> + </div> + {if $userDiaries} + <div style='margin-right: 1ex; margin-bottom: .5em; float: left;'> + <input type='submit' name='addFoodToDiary' id='addFoodToDiary' value='Add to diary =>' style='width: 20ex;' onclick='getElement("formAddFood").action.value = "addFoodToDiary";' /> + <select name='diary'> + {foreach from=$userDiaries item=userDiary} + <option value='{$userDiary.id}'>{$userDiary.description}</option> + {/foreach} + </select> + </div> + <div style='margin-bottom: .5em;'> + with + <a href='help.php#timestamp' title='What is a diary timestamp?'>timestamp</a> + <input type='text' name='diaryTimestamp' id='diaryTimestamp' readonly='readonly' value='' /> + <script type="text/javascript"> + Calendar.setup( + {literal}{{/literal} + inputField : "diaryTimestamp", // ID of the input field + ifFormat : "%Y-%m-%d %I:%M%p", // the date format + button : "diaryTimestamp", // ID of the button + weekNumbers : false, + showsTime : true, + firstDay : 0 + {literal}}{/literal} + ); + </script> + </div> + {/if} +{else} + <div style='margin-bottom: .5em; text-align: justify;'> + <a name='save'></a> + Would you like to add this food to a meal? Enter a short + descriptive entry in the text box below and then click the + "Add to meal" button. A default description may have been + added for you. However, this description may not be very + helpful and could possibly be quite long. You are encouraged + to change this to something more meaningful, and possibly + shorter. Are you still <a href='help.php#saving'>confused</a>? + </div> + <div style='margin-bottom: .5em;'> + {if $foodDesc} + <input type='text' name='description' size='25' value='{$foodDesc|escape:'html'}' /> + {else} + <input type='text' name='description' size='25' value='{$quantity} {$foodData[0].msre_desc|escape:'html'} {$foodData[0].foodDesc|escape:'html'}' /> + {/if} + </div> + <div style='margin-bottom: .5em;'> + <input type='submit' name='addFoodToMeal' value='Add to meal' style='width: 20ex;' /> + <input type='hidden' name='meal' value='0' /> + </div> +{/if} + <div> + <input type='hidden' name='food' value='{$food}' /> + <input type='hidden' name='weight' value='{$weight}' /> + <input type='hidden' name='quantity' value='{$quantity}' /> + <input type='hidden' name='action' value='' /> + </div> + </form> + </div> + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} diff --git a/templates/view_meal.tpl b/templates/view_meal.tpl new file mode 100644 index 0000000..68d5fc4 --- /dev/null +++ b/templates/view_meal.tpl @@ -0,0 +1,112 @@ +{$header} +<div id='columnContainer'> + <div id='middleColumn'> + <div id='middleData'> + <div style='margin-bottom: 1em;'> + <strong>Meal</strong>: {$mealDesc} +{if $isLoggedIn && $meal != "0"} + [<a href='edit_meal.php?meal={$meal}&action=showMeals'>Edit</a>] +{/if} + </div> + <div style='margin-bottom: 1em;'> +{if $showAllNutrients} + <a href='{$config->_rootUri}/{$config->_thisScript}?meal={$meal}&action={$smarty.get.action}'> + Hide unwanted nutrients</a> +{else} + <a href='{$config->_rootUri}/{$config->_thisScript}?meal={$meal}&action={$smarty.get.action}&showall'> + Show all nutrients</a> +{/if} +{if $isLoggedIn} + | <a href='nutrient_chooser.php'>Manage nutrient list</a> +{/if} + </div> + <div style='width: 100%;'> + <table class='standardTable'> + <tr class='tableTitleRow'> +{foreach from=$mealData.columnTitles item=columnTitle} + <th>{$columnTitle}</th> +{/foreach} + </tr> +{foreach from=$mealData.nutrients item=nutrient} + <tr class='{cycle values="bgDark,bgLight"}'> + <td>{$nutrient.nutrientName}</td> + <td style='text-align: center;'>{$nutrient.total}{$nutrient.units}</td> + {if $nutrient.percentDri != "--"} + <td style='text-align: center;'>{$nutrient.percentDri}%</td> + {else} + <td style='text-align: center;'>--</td> + {/if} + {foreach from=$nutrient.quantities item=quantity} + <td style='text-align: center;'>{$quantity}</td> + {/foreach} + </tr> +{/foreach} + </table> + </div> +{if $isLoggedIn} + <div style='margin-top: 1em;'> + <form action='add_meal.php' method='post' name='formAddMeal' id='formAddMeal' onsubmit='return validateAddMeal("formAddMeal","mealDesc");'> + <a name='save'></a> + <div style='margin-bottom: .5em; text-align: justify;'> + If you would like to save this meal for later reference, or add it + to a diary, enter a short descriptive entry in the text box below + and then select the appropriate button. If you are unsure how all + of this works, then take a look at the help on + <a href='help.php#meals'>creating meals</a>. + </div> + <div style='margin-bottom: .5em;'> + <input type='text' name='description' id='mealDesc' style='width: 100%' value='{$mealDesc}' /> + </div> + <div style='margin-bottom: .5em;'> + <input type='submit' name='saveMeal' value='Save meal' style='width: 20ex;' onclick='document.formAddMeal.action.value = "saveMeal";' /> + </div> + + {if $userDiaries} + <div style='margin-right: 1ex; margin-bottom: .5em; float: left;'> + <input type='submit' name='addMealToDiary' id='addMealToDiary' value='Add to diary =>' style='width: 20ex;' onclick='document.formAddMeal.action.value = "addMealToDiary";' /> + <select name='diary'> + {foreach from=$userDiaries item=userDiary} + <option value='{$userDiary.id}'>{$userDiary.description}</option> + {/foreach} + </select> + </div> + <div style='margin-bottom: .5em;'> + with <a href='help.php#timestamp' title='What is a diary timestamp?'>timestamp</a> + <input type='text' name='diaryTimestamp' id='diaryTimestamp' readonly='readonly' value='' /> + <script type="text/javascript"> + Calendar.setup( + {literal}{{/literal} + inputField : "diaryTimestamp", // ID of the input field + ifFormat : "%Y-%m-%d %I:%M%p", // the date format + button : "diaryTimestamp", // ID of the button + weekNumbers : false, + showsTime : true, + firstDay : 0 + {literal}}{/literal} + ); + </script> + </div> + {/if} + + <input type='hidden' name='meal' value='{$meal}' /> + <input type='hidden' name='action' value='' /> + </form> + </div> +{/if} + </div> + </div> + + <div id='leftColumn'> + <div id='leftData'> + {$sidebar_left} + </div> + </div> + + <div id='rightColumn'> + <div id='rightData'> + {$sidebar_right} + </div> + </div> + +</div> +{$footer} |
