Moved awardsList to Twig

This commit is contained in:
George Hotelling
2013-09-05 20:25:51 +00:00
parent a13b07189a
commit 0f6d48ad88
9 changed files with 248 additions and 174 deletions

View File

@@ -0,0 +1,10 @@
Feature:
As a visitor
I want to see a list of awards
So that I can learn what beers are successful
Scenario: Empty List
Given there are no awards
When I go to the page "awardsList"
Then I should see "Awards-Competitions"
And I should see "There are currently no awards/competition entries in the database."

View File

@@ -36,7 +36,7 @@ class FeatureContext extends MinkContext
* Opens specified regular brewblogger page (not URL).
*
* @Given /^(?:|I )am on the page "(?P<page>[^"]+)"$/
* @When /^(?:|I )go to page "(?P<page>[^"]+)"$/
* @When /^(?:|I )go to the page "(?P<page>[^"]+)"$/
*/
public function goToBrewBloggerPage($page)
{
@@ -57,4 +57,13 @@ class FeatureContext extends MinkContext
throw new \Behat\Mink\Exception\ExpectationException($message, $this->getSession());
}
}
/**
* @Given /^there are no awards$/
*/
public function thereAreNoAwards()
{
// Nothing to do here yet
}
}

View File

@@ -0,0 +1,11 @@
Feature:
As a brewer
I want to use calculators
So that I can work on beer recipes
#Scenario: Calculator homepage
# Given I am on the page "tools"
# When I select "Force Carbonation Calculator" from "jumpMenu"
# Then I should be on the page "tools"
# And I should see "Saturation by Style"

View File

@@ -3,7 +3,7 @@ Feature:
I want to log in
So that I can update the site
Scenario:
Scenario: Login
Given I am on the page "login"
When I fill in "loginUsername" with "nonpriv"
And I fill in "loginPassword" with "user"

View File

@@ -159,15 +159,13 @@ if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) {
$content .= include(SECTIONS . 'recipeList.inc.php');
$tplVars['page_title'] = 'Recipes';
} elseif ($page == "awardsList") {
ob_start();
include(SECTIONS . 'awardsList.inc.php');
$content .= ob_get_clean();
$content .= include(SECTIONS . 'awardsList.inc.php');
$tplVars['page_title'] = 'Awards-Competitions';
} elseif ($page == "login") {
$content .= include(SECTIONS . 'login.inc.php');
} elseif ($page == "tools") {
ob_start();
include(SECTIONS . 'tools.inc.php');
$content .= ob_get_clean();
$tplVars['page_title'] = 'Calculators';
$content .= include(SECTIONS . 'tools.inc.php');
} elseif ($page == "about") {
$content .= include(SECTIONS . 'about.inc.php');
$tplVars['page_title'] = 'About';

View File

@@ -1,75 +1,51 @@
<?php
mysql_select_db($database_brewing, $brewing);
$query_styles = sprintf("SELECT * FROM styles WHERE brewStyle='%s'", $row_awardsList['brewStyle']);
$styles = mysql_query($query_styles, $brewing) or die(mysql_error());
$row_styles = mysql_fetch_assoc($styles);
$totalRows_styles = mysql_num_rows($styles);
?>
<div id="content-wide">
<?php
if ($total == 0)
{ ?>
<table class="dataTable">
<tr>
<td class="dataHeadingList">There are currently no awards/competition entries in the database<?php if ($filter != "all") echo " for this member"; ?>.<br><br></td>
</tr>
</table>
</div>
<?php } else { ?>
<table class="dataTable">
<tr>
<td colspan="<?php if ($filter != "default") echo "8"; else echo "7"; ?>"><div id="paginate"><?php echo $total." Total Awards/Competition Entries"; if ($total > $display) echo "&nbsp;&nbsp;&nbsp;&#8226"; if ($view == "all") echo "&nbsp;&nbsp;&nbsp&#8226;&nbsp;&nbsp;&nbsp;"; if ($total > $display) { echo "&nbsp;&nbsp;&nbsp;"; paginate($display, $pg, $total); if ($view == "limited") { ?>&nbsp;&nbsp;&nbsp;&#8226;&nbsp;&nbsp;&nbsp;<a href="index.php?page=awardsList&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&view=all">Entire List of <?php if ($filter != "all") echo $row_user2['realFirstName']."'s "; if (($row_pref['mode'] == "2") && ($filter == "all")) echo "&nbsp;"; ?>Awards/Competition Entries</span></a><?php } } if ($view == "all") { ?><a href="index.php?page=awardsList&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&view=limited">Limited List of <?php if (($row_pref['mode'] == "2") && ($filter != "all")) echo $row_user2['realFirstName']."'s "; if (($row_pref['mode'] == "2") && ($filter == "all")) echo "&nbsp;"; ?>Award/Competition Entries</a><?php } ?></div></td>
</tr>
<tr>
<?php if (isset($_SESSION["loginUsername"])) echo "<td class=\"dataList\"><img src=\"".$imageSrc."pencil.png\" border=\"0\" align=\"absmiddle\"></td>"; ?>
<td class="dataHeadingList">Entered Name&nbsp;<a href="?page=awardsList&sort=awardBrewName&dir=ASC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardBrewName&dir=DESC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList">Style&nbsp;<a href="?page=awardsList&sort=awardStyle&dir=ASC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardStyle&dir=DESC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList">Competition&nbsp;<a href="?page=awardsList&sort=awardContest&dir=ASC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardContest&dir=DESC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList">Date&nbsp;<a href="?page=awardsList&sort=awardDate&dir=ASC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardDate&dir=DESC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList" colspan="2">Place&nbsp;<a href="?page=awardsList&sort=awardPlace&dir=ASC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardPlace&dir=DESC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_down.gif" border="0" alt="Sort Descending"></a></td>
<?php if (($row_pref['mode'] == "2") && ($filter == "all")) { ?><td class="dataHeadingList">Brewer&nbsp;<a href="?page=awardsList&sort=brewBrewerID&dir=ASC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=brewBrewerID&dir=DESC&filter=<?php echo $filter; ?>&view=<?php echo $view; ?>"><img src="<?php echo $imageSrc; ?>sort_down.gif" border="0" alt="Sort Descending"></a></td><?php } ?>
</tr>
<?php do { ?>
<?php
// Get brew style information for all listed styles
mysql_select_db($database_brewing, $brewing);
$query_styles = sprintf("SELECT * FROM styles WHERE brewStyle='%s'", $row_awardsList['awardStyle']);
$styles = mysql_query($query_styles, $brewing) or die(mysql_error());
$row_styles = mysql_fetch_assoc($styles);
$totalRows_styles = mysql_num_rows($styles);
// Get real user names
mysql_select_db($database_brewing, $brewing);
$query_user2 = sprintf("SELECT * FROM users WHERE user_name = '%s'", $row_awardsList['brewBrewerID']);
$user2 = mysql_query($query_user2, $brewing) or die(mysql_error());
$row_user2 = mysql_fetch_assoc($user2);
$totalRows_user2 = mysql_num_rows($user2);
?>
<tr <?php echo "style=\"background-color:$color\""; ?>>
<?php if (isset($_SESSION["loginUsername"])) { if (($row_user['userLevel'] == "1") || ($row_recipeList['brewBrewerID'] == $loginUsername)) echo "<td class=\"dataList\"><a href=\"admin/index.php?action=edit&dbTable=awards&id=".$row_awardsList['id']."\"><img src=\"".$imageSrc."pencil.png\" alt=\"Edit ".$row_awardsList['awardBrewName']."\" title=\"Edit ".$row_awardsList['awardBrewName']."\" border=\"0\" align=\"absmiddle\"></a></td>"; else echo "<td>&nbsp;</td>"; } ?>
<td class="dataList"><a href="index.php?page=<?php $dbGo = rtrim($row_awardsList['awardBrewID'], "0123456789"); if ($dbGo == "r") echo "recipe"; else echo "brewBlog"; ?>Detail&filter=<?php echo $row_awardsList['brewBrewerID']; ?>&id=<?php $brewID = ltrim ($row_awardsList['awardBrewID'], "rb"); echo $brewID; ?>"><?php echo $row_awardsList['awardBrewName']; ?></a></td>
<td class="dataList">
<div id="moreInfo"><a href="#"><?php echo $row_awardsList['awardStyle']; ?>
<span>
<div id="wideWrapper">
<?php include ('reference/styles.inc.php'); ?>
</div>
</span>
</a>
</div>
</td>
<td class="dataListLeft"><?php if ($row_awardsList['awardContestURL'] != "") { ?><a href="<?php echo $row_awardsList['awardContestURL']; ?>" target="_blank"><?php } echo $row_awardsList['awardContest']; if ($row_awardsList['awardContestURL'] != "") { ?></a><?php } ?></td>
<td class="dataList" nowrap="nowrap"><?php $date = $row_awardsList['awardDate']; $realdate = dateconvert($date,3); echo $realdate; ?></td>
<td class="dataList" width="16"><img src="<?php echo $imageSrc; ?><?php if ($row_awardsList['awardPlace'] == "best") echo "award_star_gold_3.png"; elseif ($row_awardsList['awardPlace'] == "1") echo "medal_gold_3.png"; elseif ($row_awardsList['awardPlace'] == "2") echo "medal_silver_3.png"; elseif ($row_awardsList['awardPlace'] == "3") echo "medal_bronze_3.png"; elseif ($row_awardsList['awardPlace'] == "entry") echo "tag_blue.png"; else echo "star.png"; ?>" border="0"/></td>
<td class="dataList" nowrap="nowrap"><?php if ($row_awardsList['awardPlace'] == "best") echo "Best In Show"; elseif ($row_awardsList['awardPlace'] == "1") echo "1st (Gold)"; elseif ($row_awardsList['awardPlace'] == "2") echo "2nd (Silver)"; elseif ($row_awardsList['awardPlace'] == "3") echo "3rd (Bronze)"; elseif ($row_awardsList['awardPlace'] == "honMen") echo "Honorable Mention"; else echo "Entry Only"; ?></td>
<?php if (($row_pref['mode'] == "2") && ($filter == "all")) { ?><td class="dataList"><a href="?page=awardsList&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&filter=<?php echo $row_user2['user_name']; ?>&view=limited"><?php echo $row_user2['realFirstName']."&nbsp;".$row_user2['realLastName']; ?></a></td><?php } ?>
</tr>
<?php if ($color == $color1) { $color = $color2; } else { $color = $color1; } ?>
<?php } while ($row_awardsList = mysql_fetch_assoc($awardsList)); ?>
<tr>
<td colspan="<?php if ($filter != "default") echo "8"; else echo "7"; ?>"><div id="paginate"><?php echo $total." Total Awards/Competition Entries"; if ($total > $display) echo "&nbsp;&nbsp;&nbsp;&#8226"; if ($view == "all") echo "&nbsp;&nbsp;&nbsp&#8226;&nbsp;&nbsp;&nbsp;"; if ($total > $display) { echo "&nbsp;&nbsp;&nbsp;"; paginate($display, $pg, $total); if ($view == "limited") { ?>&nbsp;&nbsp;&nbsp;&#8226;&nbsp;&nbsp;&nbsp;<a href="index.php?page=awardsList&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&view=all">Entire List of <?php if ($filter != "all") echo $row_user2['realFirstName']."'s "; if (($row_pref['mode'] == "2") && ($filter == "all")) echo "&nbsp;"; ?>Awards/Competition Entries</span></a><?php } } if ($view == "all") { ?><a href="index.php?page=awardsList&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&view=limited">Limited List of <?php if (($row_pref['mode'] == "2") && ($filter != "all")) echo $row_user2['realFirstName']."'s "; if (($row_pref['mode'] == "2") && ($filter == "all")) echo "&nbsp;"; ?>Award/Competition Entries</a><?php } ?></div></td>
</tr>
</table>
</div>
<?php } ?>
<?php
$pageVars = array(
'filter' => $filter,
'view' => $view,
'display' => $display,
'image_src' => $imageSrc,
'sort' => $sort,
'dir' => $dir,
'pg' => $pg,
'pref' => $row_pref,
'user' => $user,
'user2' => isset($user2) ? : null,
'login_username' => isset($_SESSION["loginUsername"]) ? : null,
'color1' => $color1,
'color2' => $color2,
);
ob_start();
paginate($display, $pg, $total);
$pageVars['paginate'] = ob_get_clean();
$pageVars['awards'] = array();
do {
if (empty($row_awardsList)) {
continue;
}
$award = $row_awardsList;
// Get brew style information for all listed styles
mysql_select_db($database_brewing, $brewing);
$query_styles = sprintf("SELECT * FROM styles WHERE brewStyle='%s'", $row_awardsList['awardStyle']);
$styles = mysql_query($query_styles, $brewing) or die(mysql_error());
$row_styles = mysql_fetch_assoc($styles);
$totalRows_styles = mysql_num_rows($styles);
ob_start();
include('reference/styles.inc.php');
$award['style_include'] = ob_get_clean();
// Get real user names
mysql_select_db($database_brewing, $brewing);
$query_user2 = sprintf("SELECT * FROM users WHERE user_name = '%s'", $row_awardsList['brewBrewerID']);
$user2 = mysql_query($query_user2, $brewing) or die(mysql_error());
$row_user2 = mysql_fetch_assoc($user2);
$totalRows_user2 = mysql_num_rows($user2);
$award['user'] = $row_user2;
$pageVars['awards'][] = $award;
} while ($row_awardsList = mysql_fetch_assoc($awardsList));
return $twig->render('awardsList.html.twig', $pageVars);

View File

@@ -1,95 +1,30 @@
<?php
$imageSrc = "images/";
?>
<table>
<?php if (!checkmobile()) { ?>
<tr>
<td class="dataLabelLeft">Choose:</td>
<td class="data">
<form name="form" id="form">
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
<option value="?page=tools"></option>
<option value="?page=tools&section=bitterness" <?php if ($section == "bitterness") echo "SELECTED"; ?>>Bitterness Calculator</option>
<option value="?page=tools&section=efficiency" <?php if ($section == "efficiency") echo "SELECTED"; ?>>Brewhouse Efficiency Calculator</option>
<option value="?page=tools&section=calories" <?php if ($section == "calories") echo "SELECTED"; ?>>Calories, Alcohol, and Plato Calculator</option>
<option value="?page=tools&section=force_carb" <?php if ($section == "force_carb") echo "SELECTED"; ?>>Force Carbonation Calculator</option>
<option value="?page=tools&section=plato" <?php if ($section == "plato") echo "SELECTED"; ?>>Plato/Brix/SG Calculator</option>
<option value="?page=tools&section=sugar" <?php if ($section == "sugar") echo "SELECTED"; ?>>Priming Sugar Calculator</option>
<option value="?page=tools&section=strike" <?php if ($section == "strike") echo "SELECTED"; ?>>Strike Water Temperature Calculator</option>
<option value="?page=tools&section=water" <?php if ($section == "water") echo "SELECTED"; ?>>Water Amounts Calculator</option>
<option value="?page=tools&section=hyd" <?php if ($section == "hyd") echo "SELECTED"; ?>>Hydrometer Correction Calculator</option>
</select>
</form>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="2">
<?php
if ($section == "calories") include (ADMIN_TOOLS.'gravity.php');
elseif ($section == "bitterness") include (ADMIN_TOOLS.'bitterness.php');
elseif ($section == "efficiency") include (ADMIN_TOOLS.'efficiency.php');
elseif ($section == "water") include (ADMIN_TOOLS.'water_amounts.php');
elseif ($section == "sugar") include (ADMIN_TOOLS.'priming.php');
elseif ($section == "force_carb") include (ADMIN_TOOLS.'force_carb.php');
elseif ($section == "plato") include (ADMIN_TOOLS.'sg.php');
elseif ($section == "strike") include (ADMIN_TOOLS.'strike.php');
elseif ($section == "hyd") include (ADMIN_TOOLS.'hydrometer.php');
// elseif ($section == "recipe") include (ADMIN_TOOLS.'recipe_calculator.php');
?>
</td>
</tr>
</table>
<div class="calcNav">
<?php
// Navigation links
// First row
if ($section == "bitterness")
echo "<strong>Bitterness Calculator</strong>";
else
echo "<a href=\"?page=tools&section=bitterness\">Bitterness Calculator</a>";
echo '&nbsp;|&nbsp;';
if ($section == "efficiency")
echo "<strong>Brewhouse Efficiency Calculator</strong>";
else
echo "<a href=\"?page=tools&section=efficiency\">Brewhouse Efficiency Calculator</a>";
echo '&nbsp;|&nbsp;';
if ($section == "calories")
echo "<strong>Calories, Alcohol, and Plato Calculator</strong>";
else
echo "<a href=\"?page=tools&section=calories\">Calories, Alcohol, and Plato Calculator</a>";
echo '&nbsp;|&nbsp;';
if ($section == "force_carb")
echo "<strong>Force Carbonation Calculator</strong>";
else
echo "<a href=\"?page=tools&section=force_carb\">Force Carbonation Calculator</a>";
echo '<br />';
$pageVars = array(
'current_section' => $section,
'sections' => array(
'bitterness' => 'Bitterness Calculator',
'efficiency' => 'Brewhouse Efficiency Calculator',
'calories' => 'Calories, Alcohol, and Plato Calculator',
'force_carb' => 'Force Carbonation Calculator',
'plato' => 'Plato/Brix/SG Calculator',
'sugar' => 'Priming Sugar Calculator',
'strike' => 'Strike Water Temperature Calculator',
'water' => 'Water Amounts Calculator',
'hyd' => 'Hydrometer Correction Calculator',
),
);
// Second row
if ($section == "plato")
echo "<strong>Plato/Brix/SG Calculator</strong>";
else
echo "<a href=\"?page=tools&section=plato\">Plato/Brix/SG Calculator</a>";
echo '&nbsp;|&nbsp;';
if ($section == "sugar")
echo "<strong>Priming Sugar Calculator</strong>";
else
echo "<a href=\"?page=tools&section=sugar\">Priming Sugar Calculator</a>";
echo '&nbsp;|&nbsp;';
if ($section == "strike")
echo "<strong>Strike Water Temperature Calculator</strong>";
else
echo "<a href=\"?page=tools&section=strike\">Strike Water Temperature Calculator</a>";
echo '&nbsp;|&nbsp;';
if ($section == "water")
echo "<strong>Water Amounts Calculator</strong>";
else
echo "<a href=\"?page=tools&section=water\">Water Amounts Calculator</a>";
echo '&nbsp;|&nbsp;';
if ($section == "hyd")
echo "<strong>Hydrometer Correction Calculator</strong>";
else
echo "<a href=\"?page=tools&section=hyd\">Hydrometer Correction Calculator</a>";
?>
</div>
ob_start();
if ($section == "calories") include (ADMIN_TOOLS.'gravity.php');
elseif ($section == "bitterness") include (ADMIN_TOOLS.'bitterness.php');
elseif ($section == "efficiency") include (ADMIN_TOOLS.'efficiency.php');
elseif ($section == "water") include (ADMIN_TOOLS.'water_amounts.php');
elseif ($section == "sugar") include (ADMIN_TOOLS.'priming.php');
elseif ($section == "force_carb") include (ADMIN_TOOLS.'force_carb.php');
elseif ($section == "plato") include (ADMIN_TOOLS.'sg.php');
elseif ($section == "strike") include (ADMIN_TOOLS.'strike.php');
elseif ($section == "hyd") include (ADMIN_TOOLS.'hydrometer.php');
$pageVars['content'] = ob_get_clean();
return $twig->render('tools.html.twig', $pageVars);

94
twig/awardsList.html.twig Normal file
View File

@@ -0,0 +1,94 @@
{% set total = awards|length %}
<div id="content-wide">
{% if awards is empty %}
<table class="dataTable">
<tr>
<td class="dataHeadingList">There are currently no awards/competition entries in the database{% if filter != "all" %} for this member{% endif %}.<br><br></td>
</tr>
</table>
</div>
{% else %}
{{ dump(awards) }}
{% if filter == "defualt" %}
{% set columns = 7 %}
{% else %}
{% set columns = 8 %}
{% endif %}
<table class="dataTable">
<tr>
<td colspan="{{ columns }}"><div id="paginate">
{{ total }} Total Awards/Competition Entries
{% if total > display %}echo "&nbsp;&nbsp;&nbsp;&#8226";{% endif %}
{% if view == "all" %}&nbsp;&nbsp;&nbsp;&#8226;&nbsp;&nbsp;&nbsp;{% endif %}
{% if total > display %}
&nbsp;&nbsp;&nbsp;
{{ paginate }}
{% if view == "limited" %}
&nbsp;&nbsp;&nbsp;&#8226;&nbsp;&nbsp;&nbsp;<a href="?page=awardsList&sort={{ sort|url_encode }}&dir={{ dir|url_encode }}&view=all">Entire List of
{% if (pref.mode == "2") and (filter != "all") %}{{ user2.realFirstName }}'s {% endif %}
Awards/Competition Entries</span></a>
{% endif %}
{% endif %}
{% if view == "all" %}
<a href="?page=awardsList&sort={{ sort|url_encode }}&dir={{ dir|url_encode }}&view=limited">Limited List of
{% if (pref.mode == "2") and (filter != "all") %}{{ user2.realFirstName }}'s {% endif %}
Award/Competition Entries</a>
{% endif %}
</div></td>
</tr>
<tr>
{% if login_username is not empty %}<td class="dataList"><img src="{{ image_src }}pencil.png" border="0" align="absmiddle"></td>{% endif %}
<td class="dataHeadingList">Entered Name&nbsp;<a href="?page=awardsList&sort=awardBrewName&dir=ASC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardBrewName&dir=DESC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList">Style&nbsp;<a href="?page=awardsList&sort=awardStyle&dir=ASC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardStyle&dir=DESC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList">Competition&nbsp;<a href="?page=awardsList&sort=awardContest&dir=ASC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardContest&dir=DESC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList">Date&nbsp;<a href="?page=awardsList&sort=awardDate&dir=ASC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardDate&dir=DESC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_down.gif" border="0" alt="Sort Descending"></a></td>
<td class="dataHeadingList" colspan="2">Place&nbsp;<a href="?page=awardsList&sort=awardPlace&dir=ASC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=awardPlace&dir=DESC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_down.gif" border="0" alt="Sort Descending"></a></td>
{% if (pref.mode == "2") and (filter != "all") %}<td class="dataHeadingList">Brewer&nbsp;<a href="?page=awardsList&sort=brewBrewerID&dir=ASC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_up.gif" border="0" alt="Sort Ascending"></a><a href="?page=awardsList&sort=brewBrewerID&dir=DESC&filter={{ filter|url_encode }}&view={{ view|url_encode }}"><img src="{{ image_src }}sort_down.gif" border="0" alt="Sort Descending"></a></td>{% endif %}
</tr>
{% for award in awards %}
<tr style="background-color: {{ cycle([color1, color2], loop.index) }}">
{% if login_username is not empty %}
{% if (user.userLevel == "1") or (recipe.brewBrewerID == login_username) %}
<td class="dataList"><a href="admin/index.php?action=edit&dbTable=awards&id={{ award.id|url_encode }}"><img src="{{ image_src }}pencil.png" alt="Edit {{ award.awardBrewName }}" title="Edit {{ award.awardBrewName }}" border="0" align="absmiddle"></a></td>
{% else %}
<td>&nbsp;</td>
{% endif %}
{% endif %}
<td class="dataList"><a href="index.php?page={% if db_go == "r" %}recipe{% else %}brewBlog{% endif %}Detail&filter={{ award.brewBrewerId|url_encode }}&id={{ award.rbtrim_brew_id|url_encode }}">{{ award.awardBrewName }}</a></td>
<td class="dataList">
<div id="moreInfo"><a href="#">{{ award.awardStyle }}
<span><div id="wideWrapper">{{ award.style_include }}</div></span>
</a>
</div>
</td>
<td class="dataListLeft">{% if award.awardContestURL is not empty %}<a href="{{ award.awardContestURL }}" target="_blank">{% endif %}{{ award.awardContest }}{% if award.awardContestURL is not empty %}</a>{% endif %}</td>
<td class="dataList" nowrap="nowrap">{{ award.awardDate|date("M j, Y") }}</td>
<td class="dataList" width="16"><img src="{{ image_src }}{% if award.awardPlace == "best" %}award_star_gold_3.png{% elseif award.awardPlace == "1" %}medal_gold_3.png{% elseif award.awardPlace == "2" %}medal_silver_3.png{% elseif award.awardPlace == "3" %}medal_bronze_3.png{% elseif award.awardPlace == "entry" %}tag_blue.png{% else %}star.png{% endif %}" border="0"/></td>
<td class="dataList" nowrap="nowrap">{% if award.awardPlace == "best" %}Best In Show{% elseif award.awardPlace == "1" %}1st (Gold){% elseif award.awardPlace == "2" %}2nd (Silver){% elseif award.awardPlace == "3" %}3rd (Bronze){% elseif award.awardPlace == "honMen" %}Honorable Mention{% else %}Entry Only{% endif %}</td>
{% if (pref.mode == "2") and (filter != "all") %}<td class="dataList"><a href="?page=awardsList&sort={{ sort|url_encode }}&dir={{ dir|url_encode }}&filter={{ award.user.user_name|url_encode }}&view=limited">{{ award.user.realFirstName }} {{ award.user.realLastName }}</a></td>{% endif %}
</tr>
{% endfor %}
<tr>
<td colspan="{{ columns }}"><div id="paginate">
{{ total }} Total Awards/Competition Entries
{% if total > display %}echo "&nbsp;&nbsp;&nbsp;&#8226";{% endif %}
{% if view == "all" %}&nbsp;&nbsp;&nbsp;&#8226;&nbsp;&nbsp;&nbsp;{% endif %}
{% if total > display %}
&nbsp;&nbsp;&nbsp;
{{ paginate }}
{% if view == "limited" %}
&nbsp;&nbsp;&nbsp;&#8226;&nbsp;&nbsp;&nbsp;<a href="?page=awardsList&sort={{ sort|url_encode }}&dir={{ dir|url_encode }}&view=all">Entire List of
{% if (pref.mode == "2") and (filter != "all") %}{{ user2.realFirstName }}'s {% endif %}
Awards/Competition Entries</span></a>
{% endif %}
{% endif %}
{% if view == "all" %}
<a href="?page=awardsList&sort={{ sort|url_encode }}&dir={{ dir|url_encode }}&view=limited">Limited List of
{% if (pref.mode == "2") and (filter != "all") %}{{ user2.realFirstName }}'s {% endif %}
Award/Competition Entries</a>
{% endif %}
</div></td>
</tr>
</table>
</div>
{% endif %}

41
twig/tools.html.twig Normal file
View File

@@ -0,0 +1,41 @@
<table>
{% if not checkmobile %}
<?php if (!checkmobile()) { ?>
<tr>
<td class="dataLabelLeft">Choose:</td>
<td class="data">
<form name="form" id="form">
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
<option value="?page=tools"></option>
{% for section, name in sections %}
<option value="?page=tools&section={{ section|url_encode }}" {% if section == current_section %}selected="selected"{% endif %}>{{ name }}</option>
{% endfor %}
</select>
</form>
</td>
</tr>
{% endif %}
<tr>
<td colspan="2">
{{ content }}
</td>
</tr>
</table>
<div class="calcNav">
{# Maybe move to batch? #}
{% for section, name in sections -%}
{%- if section == current_section -%}
<strong>{{ name }}</strong>
{%- else -%}
<a href="?page=tools&section={{ section|url_encode }}">{{ name }}</a>
{%- endif -%}
{%- if section == "force_carb" -%}
<br />
{%- elseif section == "hyd" -%}{# no output#}
{%- else -%}
&nbsp;|&nbsp;
{%- endif -%}
{%- endfor %}
</div>