Programmatic table support. Enhances several tables with highlightable and clickable rows and
cleans up the existing table row highlight and click code.
This commit is contained in:
@@ -22,38 +22,75 @@ if (empty($aClean['sRating']))
|
||||
echo "<b>Rating: $sPathtrail</b>";
|
||||
echo html_frame_end();
|
||||
echo html_frame_start("", '98%', '', 2);
|
||||
echo "<table width=100% border=0 cellspacing=1 cellpadding=3\n";
|
||||
echo " <tr class=color4>\n";
|
||||
echo " <td><b>Rating</b></td>\n";
|
||||
echo " <td><b>Description</b></td>\n";
|
||||
echo " <td><b>No. Apps</b></td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".PLATINUM_RATING, "platinum", "platinum", "platinum");
|
||||
echo " <td><a href=\"browse_by_rating.php?sRating=".PLATINUM_RATING."\">Platinum</a></td>";
|
||||
echo " <td>Applications that install and run out of the box</td>\n";
|
||||
echo " <td>".Application::countWithRating(PLATINUM_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".GOLD_RATING, "gold", "gold", "gold");
|
||||
echo " <td><a href=\"browse_by_rating.php?sRating=".GOLD_RATING."\">Gold</a></td>";
|
||||
echo " <td>Applications that work flawlessly with some DLL overrides or other settings, crack etc.</td>\n";
|
||||
echo " <td>".Application::countWithRating(GOLD_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".SILVER_RATING, "silver", "silver", "silver");
|
||||
echo " <td><a href=\"browse_by_rating.php?sRating=".SILVER_RATING."\">Silver</a></td>";
|
||||
echo " <td>Applications that work excellently for 'normal use'</td>\n";
|
||||
echo " <td>".Application::countWithRating(SILVER_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".BRONZE_RATING, "bronze", "bronze", "bronze");
|
||||
echo " <td><a href=\"browse_by_rating.php?sRating=".BRONZE_RATING."\">Bronze</a></td>";
|
||||
echo " <td>Applications that work but have some issues, even for 'normal use'</td>\n";
|
||||
echo " <td>".Application::countWithRating(BRONZE_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
html_tr_highlight_clickable("browse_by_rating.php?sRating=".GARBAGE_RATING, "garbage", "garbage", "garbage");
|
||||
echo " <td><a href=\"browse_by_rating.php?sRating=".GARBAGE_RATING."\">Garbage</a></td>";
|
||||
echo " <td>Applications that don't work as intended, there should be at least one bug report if an app gets this rating</td>\n";
|
||||
echo " <td>".Application::countWithRating(GARBAGE_RATING)."</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
// create the table
|
||||
$oTable = new Table();
|
||||
$oTable->SetCellSpacing(1);
|
||||
$oTable->SetCellPadding(3);
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetWidth("100%");
|
||||
|
||||
// create the header row
|
||||
$aHeaderCells = array();
|
||||
$oTableCell = new TableCell("Rating");
|
||||
$oTableCell->SetBold(true);
|
||||
$aHeaderCells[] = $oTableCell;
|
||||
|
||||
$oTableCell = new TableCell("Description");
|
||||
$oTableCell->SetBold(true);
|
||||
$aHeaderCells[] = $oTableCell;
|
||||
|
||||
$oTableCell = new TableCell("No. Apps");
|
||||
$oTableCell->SetBold(true);
|
||||
$aHeaderCells[] = $oTableCell;
|
||||
|
||||
$oTableRowHeader = new TableRow();
|
||||
$oTableRowHeader->AddCells($aHeaderCells);
|
||||
$oTableRowHeader->SetClass("color4");
|
||||
|
||||
$oTable->SetHeader($oTableRowHeader);
|
||||
|
||||
// setup arrays for processing in the below loop
|
||||
$aColorName = array("Platinum", "Gold", "Silver", "Bronze", "Garbage");
|
||||
$aRating = array(PLATINUM_RATING, GOLD_RATING, SILVER_RATING,
|
||||
BRONZE_RATING, GARBAGE_RATING);
|
||||
$aRatingText = array("Applications that install and run out of the box",
|
||||
"Applications that work flawlessly with some DLL overrides or other settings, crack etc.",
|
||||
"Applications that work excellently for 'normal use'",
|
||||
"Applications that work but have some issues, even for 'normal use'",
|
||||
"Applications that don't work as intended, there should be at least one bug report if an app gets this rating");
|
||||
|
||||
$iIndex = 0;
|
||||
foreach($aColorName as $sColor)
|
||||
{
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetClass($aRating[$iIndex]);
|
||||
|
||||
$sUrl = "browse_by_rating.php?sRating=".$aRating[$iIndex];
|
||||
|
||||
$oTableCell = new TableCell($aColorName[$iIndex]);
|
||||
$oTableCell->SetCellLink($sUrl);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
$oTableRow->AddTextCell($aRatingText[$iIndex]);
|
||||
$oTableRow->AddTextCell(Application::countWithRating($aRating[$iIndex]));
|
||||
|
||||
// click entry for the row
|
||||
$oInactiveColor = new color();
|
||||
$oInactiveColor->SetColorByName($aColorName[$iIndex]);
|
||||
$oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
|
||||
$oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
|
||||
$oTableRowClick = new TableRowClick($sUrl);
|
||||
$oTableRowClick->SetHighlight($oTableRowHighlight);
|
||||
|
||||
// set the clickable row
|
||||
$oTableRow->SetRowClick($oTableRowClick);
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
|
||||
$iIndex++;
|
||||
}
|
||||
|
||||
echo $oTable->GetString();
|
||||
|
||||
echo html_frame_end();
|
||||
} else
|
||||
@@ -142,33 +179,60 @@ if (empty($aClean['sRating']))
|
||||
echo "</center>";
|
||||
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
|
||||
|
||||
$oTable = new Table();
|
||||
$oTable->SetWidth("100%");
|
||||
$oTable->SetBorder(0);
|
||||
$oTable->SetCellPadding(3);
|
||||
$oTable->SetCellSpacing(1);
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetClass("color4");
|
||||
|
||||
$oTableCell = new TableCell("Application Name");
|
||||
$oTableCell->SetBold(true);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
|
||||
$oTableCell = new TableCell("Description");
|
||||
$oTableCell->SetBold(true);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td><b>Application Name</b></td>\n";
|
||||
echo " <td><b>Description</b></td>\n";
|
||||
echo " <td><b>No. Versions</b></td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTableCell = new TableCell("No. Versions");
|
||||
$oTableCell->SetBold(true);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
|
||||
while(list($i, $iAppId) = each($apps))
|
||||
while(list($iIndex, $iAppId) = each($apps))
|
||||
{
|
||||
$oApp = new Application($iAppId);
|
||||
|
||||
//set row color
|
||||
$bgcolor = ($i % 2) ? "color0" : "color1";
|
||||
|
||||
$oTableRowHighlight = GetStandardRowHighlight($iIndex);
|
||||
|
||||
$sUrl = $oApp->objectMakeUrl();
|
||||
|
||||
$sColor = ($iIndex % 2) ? "color0" : "color1";
|
||||
|
||||
$oTableRowClick = new TableRowClick($sUrl);
|
||||
$oTableRowClick->SetHighlight($oTableRowHighlight);
|
||||
|
||||
//format desc
|
||||
$desc = util_trim_description($oApp->sDescription);
|
||||
$sDesc = util_trim_description($oApp->sDescription);
|
||||
|
||||
//display row
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td>".$oApp->objectMakeLink()."</td>\n";
|
||||
echo " <td>$desc </td>\n";
|
||||
echo " <td>".sizeof($oApp->aVersionsIds)."</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->SetRowClick($oTableRowClick);
|
||||
$oTableRow->SetClass($sColor);
|
||||
|
||||
$oTableRow->AddTextCell($oApp->objectMakeLink());
|
||||
$oTableRow->AddTextCell("$sDesc ");
|
||||
$oTableRow->AddTextCell(sizeof($oApp->aVersionsIds));
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
}
|
||||
|
||||
echo "</table>\n\n";
|
||||
// output the table
|
||||
echo $oTable->GetString();
|
||||
|
||||
echo html_frame_end();
|
||||
echo "<center>";
|
||||
|
||||
Reference in New Issue
Block a user