Changeset 7873 for trunk/MagicSoft/Mars/datacenter/db/include.php
- Timestamp:
- 08/15/06 14:39:31 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/db/include.php
r7546 r7873 118 118 } 119 119 120 function PrintLimitsMenu($limits, $rms, $alias)121 {122 foreach($limits as $key => $element)123 {124 printf("<tr><td>%s</td>\n", $alias[$key]);125 $mean=$key . "Mean";126 $limitmean=$_GET[$mean];127 printf("<td><input name=\"%sMean\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"></td>\n", $key, $limitmean);128 if ($rms[$key]=="yes")129 {130 $rms2=$key . "Rms";131 $limitrms=$_GET[$rms2];132 printf("<td><input name=\"%sRms\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"></td>\n", $key, $limitrms);133 }134 else135 printf("<td><br></td>\n");136 printf("</tr>\n");137 }138 139 }140 141 120 function PrintPullDown($host, $user, $pw, $db, $table, $name, $index, $descr) 142 121 { … … 257 236 printf("\n"); 258 237 } 238 } 239 240 function PrintSubmittedQuery($query0, $html, $db, $old) 241 { 242 //diplay query on old websites 243 if (empty($old)) 244 printf("<tr class='Block' id='showquery' style='display:none'><td>"); 245 else 246 printf("<tr class='Block' id='showquery' style='display:block'><td>"); 247 printf("<b>DB:</b> %s <br>", $db); 248 if ($html=="1") 249 printf("<U><B>submitted query:</B></U><BR>%s<BR>", htmlspecialchars($query0)); 250 printf("</td></tr>"); 259 251 } 260 252 … … 323 315 324 316 if ($_GET["fNumStart"]!=0) 317 { 318 $uri = htmlspecialchars($_SERVER["REQUEST_URI"]); 319 $pos = strpos($uri, "fNumStart"); 320 $amp3=FALSE; 321 if ($pos!=FALSE) 322 { 323 $amp1 = substr($uri, 0, $pos-1); 324 $amp2 = substr($uri, $pos); 325 $amp3 = strchr($amp2, "&"); 326 327 $uri = $amp1; 328 } 329 $pos = $_GET["fNumStart"]-$rows; 330 if ($pos<0) 331 $pos=0; 332 $uri .= "&fNumStart=" . $pos; 333 if ($amp3!=FALSE) 334 $uri .= $amp3; 335 336 $menu .= "<A HREF='" . $uri . "'><<< Prev</A>\n"; 337 } 338 339 $menu .= " --- <B>"; 340 $menu .= $_GET["fNumStart"]; 341 $menu .= "</B> --- \n"; 342 343 if ($rows==$_GET["fNumResults"]) 325 344 { 326 345 $uri = $_SERVER["REQUEST_URI"]; … … 335 354 $uri = $amp1; 336 355 } 337 $pos = $_GET["fNumStart"]-$rows;338 if ($pos<0)339 $pos=0;340 $uri .= "&fNumStart=" . $pos;341 if ($amp3!=FALSE)342 $uri .= $amp3;343 344 $menu .= "<A HREF='" . $uri . "'><<< Prev</A>\n";345 }346 347 $menu .= " --- <B>";348 $menu .= $_GET["fNumStart"];349 $menu .= "</B> --- \n";350 351 if ($rows==$_GET["fNumResults"])352 {353 $uri = $_SERVER["REQUEST_URI"];354 $pos = strpos($uri, "fNumStart");355 $amp3=FALSE;356 if ($pos!=FALSE)357 {358 $amp1 = substr($uri, 0, $pos-1);359 $amp2 = substr($uri, $pos);360 $amp3 = strchr($amp2, "&");361 362 $uri = $amp1;363 }364 356 $uri .= "&fNumStart=" . ($_GET["fNumStart"]+$rows); 365 357 if ($amp3!=FALSE) 366 358 $uri .= $amp3; 367 359 368 $menu .= "<A HREF='" . $uri. "'>Next >>></A>\n";360 $menu .= "<A HREF='" . htmlspecialchars($uri) . "'>Next >>></A>\n"; 369 361 } 370 362 return $menu; 371 363 } 372 364 373 function RemoveSortBy( $rows)365 function RemoveSortBy() 374 366 { 375 367 $menu = ""; … … 399 391 } 400 392 401 function PrintMagicTable($result0, $alias, $rightalign, $limits , $rms, $_GET)393 function PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $_GET) 402 394 { 403 395 $col = FALSE; 404 396 $first = TRUE; 405 397 398 $sigma = array 399 ( 400 5 => "#FF9900", 401 3 => "#FFFF66", 402 2 => "#33CC00", 403 1 => "#006600", 404 ); 405 $offlimitcolour="#FF0000"; 406 407 408 406 409 $menu = CreateMenu(mysql_num_rows($result0)); 407 410 408 printf("\n<center>\n<p>%s<P>\n", $menu); 411 printf("\n<center>\n"); 412 if (empty($_GET["fPrintTable"])) 413 printf("<p>%s<P>\n", $menu); 409 414 printf("<table BORDER=\"0\">\n"); 410 415 while ($row0 = mysql_fetch_assoc($result0)) … … 430 435 $issort=" <IMG SRC='up.gif'>"; 431 436 } 432 printf(" <th> <A HREF='%s& fSortBy=%s%s'>%s</A>%s </th>\n",433 RemoveSortBy($_SERVER["REQUEST_URI"]), $col, $ord, $key, $issort);437 printf(" <th> <A HREF='%s&fSortBy=%s%s'>%s</A>%s </th>\n", 438 htmlspecialchars(RemoveSortBy()), $col, $ord, $key, $issort); 434 439 } 435 440 printf(" </tr>\n\n"); … … 449 454 printf(" <td align=\"right\">"); 450 455 451 if (!(empty($limits) && empty($rms))) 456 //determine color of text in cell 457 foreach($limitsmean as $key2 => $element2) 452 458 { 453 foreach($limits as $key2 => $element2) 459 $mean=$key2 . "Mean"; 460 $rms2=$key2 . "Rms"; 461 if ($key==$alias[$element2] && !empty($_GET[$mean])) 454 462 { 455 $mean=$key2 . "Mean"; 456 $rms2=$key2 . "Rms"; 457 if ($key==$alias[$element2] && !empty($_GET[$mean])) 463 if (!empty($_GET[$rms2])) 458 464 { 459 if ($rms[$key2]=="yes") 465 $colour=$offlimitcolour; 466 foreach ($sigma as $margin => $newcolour) 460 467 { 461 if (!empty($_GET[$rms2])) 462 { 463 $min=$_GET[$mean] - $_GET[$rms2]; 464 $max=$_GET[$mean] + $_GET[$rms2]; 465 if ($min < $element && $element < $max) 466 printf("<font color='green'>"); 467 else 468 printf("<font color='red'>"); 469 } 468 $min=$_GET[$mean] - ($margin * $_GET[$rms2]); 469 $max=$_GET[$mean] + ($margin * $_GET[$rms2]); 470 if ($min < $element && $element < $max) 471 $colour=$newcolour; 470 472 } 471 else 473 printf("<font color='%s' style='font-weight:bold'>", $colour); 474 } 475 } 476 } 477 478 foreach($limitsmin as $key2 => $element2) 479 { 480 $limit1=$key2 . "1"; 481 $limit2=$key2 . "2"; 482 if ($key==$alias[$element2] && !empty($_GET[$limit1])) 483 { 484 $colour=$offlimitcolour; 485 if ($_GET[$limit1] <= $element) 486 $colour=$sigma[1]; 487 else 488 { 489 if (!empty($_GET[$limit2])) 472 490 { 473 if ($rms[$key2]=="min") 474 { 475 if ($_GET[$mean] <= $element) 476 printf("<font color='green'>"); 477 else 478 printf("<font color='red'>"); 479 } 480 481 if ($rms[$key2]=="max") 482 { 483 if ($_GET[$mean] >= $element) 484 printf("<font color='green'>"); 485 else 486 printf("<font color='red'>"); 487 } 491 if ($_GET[$limit2] <= $element) 492 $colour=$sigma[5]; 488 493 } 489 494 } 490 495 printf("<font color='%s' style='font-weight:bold'>", $colour); 496 } 497 498 } 499 500 foreach($limitsmax as $key2 => $element2) 501 { 502 $limit1=$key2 . "1"; 503 $limit2=$key2 . "2"; 504 if ($key==$alias[$element2] && !empty($_GET[$limit1])) 505 { 506 $colour=$offlimitcolour; 507 if ($_GET[$limit1] >= $element) 508 $colour=$sigma[1]; 509 else 510 { 511 if (!empty($_GET[$limit2])) 512 { 513 if ($_GET[$limit2] >= $element) 514 $colour=$sigma[5]; 515 } 516 } 517 printf("<font color='%s' style='font-weight:bold'>", $colour); 491 518 } 492 519 } 493 520 521 //fill text in cell 494 522 printf(" %s </td>\n", str_replace("&ws;", " ", str_replace(" ", " ", $element))); 495 523 } … … 505 533 506 534 printf("<P><B>Number of displayed results: %d</B><P><P>\n", mysql_num_rows($result0)); 507 printf("%s\n", $menu); 535 if (empty($_GET["fPrintTable"])) 536 printf("%s\n", $menu); 508 537 printf("<P>\n"); 509 538 printf("</center>\n"); 510 printf("</tr><tr class='Block'><td>\n"); 539 printf("</td>\n"); 540 printf("</tr>\n"); 511 541 } 512 542
Note:
See TracChangeset
for help on using the changeset viewer.