本文整理汇总了PHP中AlternateRowStyle函数的典型用法代码示例。如果您正苦于以下问题:PHP AlternateRowStyle函数的具体用法?PHP AlternateRowStyle怎么用?PHP AlternateRowStyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AlternateRowStyle函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RunFreeQuery
function RunFreeQuery()
{
global $cnInfoCentral;
global $aRowClass;
global $rsQueryResults;
global $sSQL;
global $iQueryID;
//Run the SQL
$rsQueryResults = RunQuery($sSQL);
if (mysql_error() != "") {
echo gettext("An error occured: ") . mysql_errno() . "--" . mysql_error();
} else {
$sRowClass = "RowColorA";
echo "<table align=\"center\" cellpadding=\"5\" cellspacing=\"0\">";
echo "<tr class=\"" . $sRowClass . "\">";
//Loop through the fields and write the header row
for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
echo "<td align=\"center\"><b>" . mysql_field_name($rsQueryResults, $iCount) . "</b></td>";
}
echo "</tr>";
//Loop through the recordsert
while ($aRow = mysql_fetch_array($rsQueryResults)) {
$sRowClass = AlternateRowStyle($sRowClass);
echo "<tr class=\"" . $sRowClass . "\">";
//Loop through the fields and write each one
for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
echo "<td align=\"center\">" . $aRow[$iCount] . "</td>";
}
echo "</tr>";
}
echo "</table>";
echo "<br><p class=\"ShadedBox\" style=\"border-style: solid; margin-left: 50px; margin-right: 50 px; border-width: 1px;\"><span class=\"SmallText\">" . str_replace(Chr(13), "<br>", htmlspecialchars($sSQL)) . "</span></p>";
}
}
示例2: GenerateLabels
function GenerateLabels(&$pdf, $mode, $bOnlyComplete = false)
{
if ($mode == "indiv") {
$sSQL = "SELECT * FROM person_per LEFT JOIN family_fam ON person_per.per_fam_ID = family_fam.fam_ID WHERE per_ID IN (" . ConvertCartToString($_SESSION['aPeopleCart']) . ") ORDER BY per_LastName";
} else {
$sSQL = "(SELECT *, 0 AS memberCount FROM person_per LEFT JOIN family_fam ON per_fam_ID = fam_ID WHERE per_fam_ID = 0 AND per_ID in ( " . ConvertCartToString($_SESSION['aPeopleCart']) . " ))\n\t\tUNION (SELECT *, COUNT(*) AS memberCount FROM person_per LEFT JOIN family_fam ON per_fam_ID = fam_ID WHERE per_fam_ID > 0 AND per_ID in ( " . ConvertCartToString($_SESSION['aPeopleCart']) . " ) GROUP BY per_fam_ID HAVING memberCount = 1)\n\t\tUNION (SELECT *, COUNT(*) AS memberCount FROM person_per LEFT JOIN family_fam ON per_fam_ID = fam_ID WHERE per_fam_ID > 0 AND per_ID in ( " . ConvertCartToString($_SESSION['aPeopleCart']) . " ) GROUP BY per_fam_ID HAVING memberCount > 1)";
}
$rsCartItems = RunQuery($sSQL);
while ($aRow = mysql_fetch_array($rsCartItems)) {
$sRowClass = AlternateRowStyle($sRowClass);
if ($aRow['memberCount'] > 1 && $mode == "fam") {
$sName = $aRow['fam_Name'] . " Family";
} else {
$sName = FormatFullName($aRow['per_Title'], $aRow['per_FirstName'], "", $aRow['per_LastName'], $aRow['per_Suffix'], 1);
}
SelectWhichAddress($sAddress1, $sAddress2, $aRow['per_Address1'], $aRow['per_Address2'], $aRow['fam_Address1'], $aRow['fam_Address2'], false);
$sCity = SelectWhichInfo($aRow['per_City'], $aRow['fam_City'], False);
$sState = SelectWhichInfo($aRow['per_State'], $aRow['fam_State'], False);
$sZip = SelectWhichInfo($aRow['per_Zip'], $aRow['fam_Zip'], False);
$sAddress = $sAddress1;
if ($sAddress2 != "") {
$sAddress .= "\n" . $sAddress2;
}
if (!$bOnlyComplete || strlen($sAddress) && strlen($sCity) && strlen($sState) && strlen($sZip)) {
$pdf->Add_PDF_Label(sprintf("%s\n%s\n%s, %s %s", $sName, $sAddress, $sCity, $sState, $sZip));
}
}
}
示例3: GetMenuItem
function GetMenuItem($aMenu, $mIdx, $lvl)
{
global $sRootPath, $sRowClass;
$sRowClass = AlternateRowStyle($sRowClass);
$link = $aMenu['uri'] == "" ? " " : $sRootPath . "/" . $aMenu['uri'];
$text = $aMenu['statustext'];
if (!is_null($aMenu['session_var'])) {
if ($link > "" & $aMenu['session_var_in_uri']) {
if (strstr($link, "?") && true) {
$cConnector = "&";
} else {
$cConnector = "?";
}
$link .= $cConnector . $aMenu['url_parm_name'] . "=\$" . "_SESSION[" . $aMenu['session_var'] . "]";
}
if ($text > "" & $aMenu['session_var_in_text']) {
$text .= " " . $_SESSION[$aMenu['session_var']];
}
}
$sContent = $aMenu['content'];
if (strlen($sContent) < 1) {
$sContent = "{" . $aMenu['name'] . "}";
}
if ($aMenu['active']) {
$sContent .= " (" . gettext("Active") . ")";
} else {
$sContent .= " (" . gettext("Inactive") . ")";
}
if (strlen($sContent) < 1) {
$sContent = "{" . $aMenu['name'] . "}";
}
echo "<tr class=\"{$sRowClass}\"><td>" . str_repeat(" ", $lvl * 3) . $sContent . "</td>" . "<td>" . $link . "</td>";
echo "<td><a class=\"smallText\" href=\"MenuEditor.php?mid=" . $aMenu['mid'] . "\">" . gettext("Edit") . "</a></td>";
echo "<td> <a class=\"smallText\" href=\"MenuEditor.php?mid=" . $aMenu['mid'] . "&mode=Delete\">" . gettext("Delete") . "</a> </td>";
if ($aMenu['ismenu']) {
$sMenuName = $aMenu['name'];
echo "<td><a class=\"smallText\" href=\"javascript:void(0)\" onClick=\"Newwin=window.open('MenuManager.php?menu={$sMenuName}','Newwin','toolbar=no,status=no,scrollbars=yes,resizable=yes,width=400,height=500')\">" . gettext("Edit List Options") . "</a></td>";
} else {
echo "<td> </td>";
}
echo "</tr>";
if ($aMenu['ismenu']) {
GetMenu($aMenu['name'], $lvl);
}
}
示例4: DoQuery
function DoQuery()
{
global $cnInfoCentral;
global $aRowClass;
global $rsQueryResults;
global $qry_SQL;
global $iQueryID;
//Run the SQL
$rsQueryResults = RunQuery($qry_SQL);
//Set the first row style
$sRowClass = "RowColorA";
//Check for a count display
DisplayRecordCount();
//Start the table and the header row
echo "<table align=\"center\" cellpadding=\"5\" cellspacing=\"0\">";
echo "<tr class=\"TableHeader\">";
//Loop through the fields and write the header row
for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
//If this field is called "AddToCart", don't display this field...
if (mysql_field_name($rsQueryResults, $iCount) != "AddToCart") {
echo "<td>" . mysql_field_name($rsQueryResults, $iCount) . "</td>";
}
}
//Close the header row
echo "</tr>";
$aHiddenFormField = array();
//Loop through the recordset
while ($aRow = mysql_fetch_array($rsQueryResults)) {
//Alternate the background color of the row
$sRowClass = AlternateRowStyle($sRowClass);
//Begin the row
echo "<tr class=\"" . $sRowClass . "\">";
//Loop through the fields and write each one
for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
//If this field is called "AddToCart", add this to the hidden form field...
if (mysql_field_name($rsQueryResults, $iCount) == "AddToCart") {
$aHiddenFormField[] = $aRow[$iCount];
} else {
//Write the actual value of this row
echo "<td>" . $aRow[$iCount] . " </td>";
}
}
//Close the row
echo "</tr>";
}
//Close the table and allow a link to run the query again
echo "</table>";
echo "<p align=\"center\">";
if (count($aHiddenFormField) > 0) {
?>
<form method="post" action="CartView.php"><p align="center">
<input type="hidden" value="<?php
echo join(",", $aHiddenFormField);
?>
" name="BulkAddToCart">
<input type="submit" class="icButton" name="AddToCartSubmit" value="<?php
echo gettext("Add Results To Cart");
?>
">
<input type="submit" class="icButton" name="AndToCartSubmit" value="<?php
echo gettext("Intersect Results With Cart");
?>
">
<input type="submit" class="icButton" name="NotToCartSubmit" value="<?php
echo gettext("Remove Results From Cart");
?>
">
</p></form>
<?php
}
echo "<p align=\"center\"><a href=\"QueryView.php?QueryID=" . $iQueryID . "\">" . gettext("Run Query Again") . "</a></p>";
echo "<p align=\"center\"><a href=\"QueryList.php\">" . gettext("Return to Query Menu") . "</a></p>";
//Print the SQL to make debugging easier
echo "<br><p class=\"ShadedBox\"><span class=\"SmallText\">" . str_replace(Chr(13), "<br>", htmlspecialchars($qry_SQL)) . "</span></p>";
}
示例5: RunQuery
//Get Person who checked person out
if ($checkout_id > 1) {
$sSQL = "SELECT * FROM person_per WHERE per_ID = {$checkout_id}";
$perCheckout = RunQuery($sSQL);
$perCheckoutRow = mysql_fetch_array($perCheckout, MYSQL_BOTH);
extract($perCheckoutRow);
$sCheckoutby = FormatFullName($per_Title, $per_FirstName, $per_MiddleName, $per_LastName, $per_Suffix, 3);
} else {
$sCheckoutby = '';
}
$per_Title = '';
$per_FirstName = '';
$per_MiddleName = '';
$per_LastName = '';
$per_Suffix = '';
$sRowClass = AlternateRowStyle($sRowClass);
?>
<tr class="<?php
echo $sRowClass;
?>
">
<td class="TextColumn"><?php
echo $sPerson;
?>
</td>
<td class="TextColumn"><?php
echo $checkin_date;
?>
</td>
<td class="TextColumn"><?php
echo $sCheckinby;
示例6: GenerateLabels
function GenerateLabels(&$pdf, $mode, $iBulkMailPresort, $bToParents, $bOnlyComplete)
{
// $mode is "indiv" or "fam"
unset($didFam);
$sSQL = "SELECT cfg_name, IFNULL(cfg_value, cfg_default) AS value ";
$sSQL .= "FROM config_cfg WHERE cfg_section='General'";
$rsConfig = RunQuery($sSQL);
if ($rsConfig) {
while (list($cfg_name, $cfg_value) = mysql_fetch_row($rsConfig)) {
${$cfg_name} = $cfg_value;
}
}
$sAdultRole = $sDirRoleHead . "," . $sDirRoleSpouse;
$sAdultRole = trim($sAdultRole, " ,\t\n\r\v");
$aAdultRole = explode(",", $sAdultRole);
$aAdultRole = array_unique($aAdultRole);
sort($aAdultRole);
$sChildRole = trim($sDirRoleChild, " ,\t\n\r\v");
$aChildRole = explode(",", $sChildRole);
$aChildRole = array_unique($aChildRole);
sort($aChildRole);
$sSQL = "SELECT * FROM person_per LEFT JOIN family_fam ";
$sSQL .= "ON person_per.per_fam_ID = family_fam.fam_ID ";
$sSQL .= "WHERE per_ID IN (" . ConvertCartToString($_SESSION['aPeopleCart']) . ") ";
$sSQL .= "ORDER BY fam_Zip, per_LastName, per_FirstName";
$rsCartItems = RunQuery($sSQL);
$sRowClass = "RowColorA";
$didFam = array();
while ($aRow = mysql_fetch_array($rsCartItems)) {
// It's possible (but unlikely) that three labels can be generated for a
// family even when they are grouped.
// At most one label for all adults
// At most one label for all children
// At most one label for all others (for example, another church or a landscape
// company)
$sRowClass = AlternateRowStyle($sRowClass);
if ($aRow['per_fam_ID'] == 0 && $mode == "fam") {
// Skip people with no family ID
continue;
}
// Skip if mode is fam and we have already printed labels
if (array_key_exists($aRow['per_fam_ID'], $didFam) and $didFam[$aRow['per_fam_ID']] && $mode == "fam") {
continue;
}
$didFam[$aRow['per_fam_ID']] = 1;
unset($aName);
if ($mode == "fam") {
$aName = GroupBySalutation($aRow['per_fam_ID'], $aAdultRole, $aChildRole);
} else {
$sName = FormatFullName($aRow['per_Title'], $aRow['per_FirstName'], "", $aRow['per_LastName'], $aRow['per_Suffix'], 1);
$bChild = FALSE;
foreach ($aChildRole as $value) {
if ($aRow['per_fmr_ID'] == $value) {
$bChild = TRUE;
}
}
if ($bChild) {
$aName['child'] = substr($sName, 0, 33);
} else {
$aName['indiv'] = substr($sName, 0, 33);
}
}
foreach ($aName as $key => $sName) {
// Bail out if nothing to print
if ($sName == "Nothing to return") {
continue;
}
if ($bToParents && $key == "child") {
$sName = "To the parents of:\n" . $sName;
}
SelectWhichAddress($sAddress1, $sAddress2, $aRow['per_Address1'], $aRow['per_Address2'], $aRow['fam_Address1'], $aRow['fam_Address2'], false);
$sCity = SelectWhichInfo($aRow['per_City'], $aRow['fam_City'], False);
$sState = SelectWhichInfo($aRow['per_State'], $aRow['fam_State'], False);
$sZip = SelectWhichInfo($aRow['per_Zip'], $aRow['fam_Zip'], False);
$sAddress = $sAddress1;
if ($sAddress2 != "") {
$sAddress .= "\n" . $sAddress2;
}
if (!$bOnlyComplete || strlen($sAddress) && strlen($sCity) && strlen($sState) && strlen($sZip)) {
$sLabelList[] = array('Name' => $sName, 'Address' => $sAddress, 'City' => $sCity, 'State' => $sState, 'Zip' => $sZip);
//,'fam_ID'=>$aRow['fam_ID']);
}
}
// end of foreach loop
}
// end of while loop
unset($zipLabels);
if ($iBulkMailPresort) {
//
// now sort the label list by presort bundle definitions
//
$zipLabels = ZipBundleSort($sLabelList);
if ($iBulkMailPresort == 2) {
while (list($i, $sLT) = each($zipLabels)) {
$pdf->Add_PDF_Label(sprintf("%s\n%s\n%s\n%s, %s %s", $sLT['Note'], $sLT['Name'], $sLT['Address'], $sLT['City'], $sLT['State'], $sLT['Zip']));
}
// end while
} else {
while (list($i, $sLT) = each($zipLabels)) {
$pdf->Add_PDF_Label(sprintf("%s\n%s\n%s, %s %s", $sLT['Name'], $sLT['Address'], $sLT['City'], $sLT['State'], $sLT['Zip']));
//.........这里部分代码省略.........
示例7: RunFreeQuery
function RunFreeQuery()
{
global $cnInfoCentral;
global $aRowClass;
global $rsQueryResults;
global $sSQL;
global $iQueryID;
//Run the SQL
$rsQueryResults = RunQuery($sSQL);
if (mysql_error() != "") {
echo gettext("An error occured: ") . mysql_errno() . "--" . mysql_error();
} else {
$sRowClass = "RowColorA";
echo '<table align="center" cellpadding="5" cellspacing="0">';
echo '<tr class="' . $sRowClass . '">';
//Loop through the fields and write the header row
for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
//If this field is called "AddToCart", don't display this field...
if (mysql_field_name($rsQueryResults, $iCount) != "AddToCart") {
echo ' <td align="center">
<b>' . mysql_field_name($rsQueryResults, $iCount) . '</b>
</td>';
}
}
echo '</tr>';
//Loop through the recordsert
while ($aRow = mysql_fetch_array($rsQueryResults)) {
$sRowClass = AlternateRowStyle($sRowClass);
echo '<tr class="' . $sRowClass . '">';
//Loop through the fields and write each one
for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
//If this field is called "AddToCart", add this to the hidden form field...
if (mysql_field_name($rsQueryResults, $iCount) == "AddToCart") {
$aHiddenFormField[] = $aRow[$iCount];
} else {
//Write the actual value of this row
echo '<td align="center">' . $aRow[$iCount] . '</td>';
}
}
echo '</tr>';
}
echo '</table>';
echo "<p align=\"center\">";
if (count($aHiddenFormField) > 0) {
?>
<form method="post" action="CartView.php"><p align="center">
<input type="hidden" value="<?php
echo join(",", $aHiddenFormField);
?>
" name="BulkAddToCart">
<input type="submit" class="icButton" name="AddToCartSubmit" value="<?php
echo gettext("Add Results To Cart");
?>
">
<input type="submit" class="icButton" name="AndToCartSubmit" value="<?php
echo gettext("Intersect Results With Cart");
?>
">
<input type="submit" class="icButton" name="NotToCartSubmit" value="<?php
echo gettext("Remove Results From Cart");
?>
">
</p></form>
<?php
}
echo "<p align=\"center\"><a href=\"QueryList.php\">" . gettext("Return to Query Menu") . "</a></p>";
echo '<br><p class="ShadedBox" style="border-style: solid; margin-left: 50px; margin-right: 50 px; border-width: 1px;"><span class="SmallText">' . str_replace(Chr(13), "<br>", htmlspecialchars($sSQL)) . '</span></p>';
}
}