Changeset 9498 for trunk/MagicSoft/Mars/datacenter/db/include.php
- Timestamp:
- 08/20/09 14:43:59 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/db/include.php
r9486 r9498 255 255 } 256 256 257 //for download of output 257 258 function PrintText($result0) 258 259 { 259 // header("Content-type: application/octet");260 // header("Content-Disposition: attachment; filename=query-result.txt");261 262 260 while ($row0 = mysql_fetch_assoc($result0)) 263 261 { … … 293 291 } 294 292 295 function Checkbox2($val, $set, $text) 296 { 297 $value=$val.$set; 298 switch ($set) 299 { 300 case "ON": 301 if (!isset($_POST["submit"]) && ereg(" ".$val." ", $_GET["Set"])) 302 $_POST[$value]="On"; 303 break; 304 case "Off": 305 if (!isset($_POST["submit"]) && ereg(" ".$val." ", $_GET["Set2"])) 306 $_POST[$value]="On"; 307 break; 308 } 309 310 if ($_POST[$value]=="On") 293 function Checkbox2($value, $text) 294 { 295 if ($_SESSION[$value]=="On") 311 296 $checked = "checked"; 312 297 else … … 316 301 } 317 302 318 function CheckWhere($column , $_GET)303 function CheckWhere($column) 319 304 { 320 305 foreach ($_GET as $key => $element) … … 330 315 } 331 316 332 function CheckGroup($column , $_GET)317 function CheckGroup($column) 333 318 { 334 319 foreach ($_GET as $key => $element) … … 344 329 } 345 330 346 function CheckStatusGroup($column , $_GET)331 function CheckStatusGroup($column) 347 332 { 348 333 foreach ($_GET as $key => $element) … … 353 338 } 354 339 355 function CheckEnumGroup($column , $_GET)340 function CheckEnumGroup($column) 356 341 { 357 342 foreach ($_GET as $key => $element) … … 360 345 return -1; 361 346 return 0; 362 }363 364 function CreateMenu($rows)365 {366 $menu = "";367 368 if (empty($_GET["fNumResults"]))369 return;370 371 if ($_GET["fNumStart"]!=0)372 {373 $uri = htmlspecialchars($_SERVER["REQUEST_URI"]);374 $pos = strpos($uri, "fNumStart");375 $amp3=FALSE;376 if ($pos!=FALSE)377 {378 $amp1 = substr($uri, 0, $pos-1);379 $amp2 = substr($uri, $pos);380 $amp3 = strchr($amp2, "&");381 382 $uri = $amp1;383 }384 $pos = $_GET["fNumStart"]-$rows;385 if ($pos<0)386 $pos=0;387 $uri .= "&fNumStart=" . $pos;388 if ($amp3!=FALSE)389 $uri .= $amp3;390 391 $menu .= "<A HREF='" . $uri . "'><<< Prev</A>\n";392 }393 394 $menu .= " --- <B>";395 $menu .= $_GET["fNumStart"];396 $menu .= "</B> --- \n";397 398 if ($rows==$_GET["fNumResults"])399 {400 $uri = $_SERVER["REQUEST_URI"];401 $pos = strpos($uri, "fNumStart");402 $amp3=FALSE;403 if ($pos!=FALSE)404 {405 $amp1 = substr($uri, 0, $pos-1);406 $amp2 = substr($uri, $pos);407 $amp3 = strchr($amp2, "&");408 409 $uri = $amp1;410 }411 $uri .= "&fNumStart=" . ($_GET["fNumStart"]+$rows);412 if ($amp3!=FALSE)413 $uri .= $amp3;414 415 $menu .= "<A HREF='" . htmlspecialchars($uri) . "'>Next >>></A>\n";416 }417 return $menu;418 347 } 419 348 … … 455 384 } 456 385 457 function PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $form, $_GET) 386 //function for button in builddatasets.php 387 function GetClearedURL($all) 388 { 389 // $url=htmlspecialchars($_SERVER["REQUEST_URI"]); 390 $url=$_SERVER["REQUEST_URI"]; 391 // echo "before:".$url."<br>"; 392 if ($all=="yes") 393 { 394 // echo "replace <br>"; 395 // $url=str_replace("&DisplaySelected", "halo", $url); 396 $url=str_replace("&DisplaySelected=yes", "", $url); 397 $url=str_replace("&DisplaySelected=no", "", $url); 398 } 399 $url=str_replace("&insert=yes", "", $url); 400 $url=str_replace("&fSendTxt=2", "", $url); 401 $url=str_replace("&fSendTxt=1", "", $url); 402 // echo "after:".$url."<br>"; 403 $url=htmlspecialchars($url); 404 return $url; 405 } 406 407 function PrintUpdateDataSetButton() 408 { 409 if (empty($_SESSION["insert"])) 410 printf("<input type='submit' value='Update Data Set'> \n"); 411 else 412 printf("<input type='button' value='Continue' onClick='self.location.href=\"%s\"'> \n", GetClearedURL()); 413 414 } 415 416 //function for button in builddatasets.php 417 function PrintDisplaySequencesButtons() 418 { 419 if ($_SESSION["DisplaySelected"]!="yes" && ($_SESSION["sequon"]!=" " || $_SESSION["sequoff"]!=" ")) 420 { 421 PrintUpdateDataSetButton(); 422 printf("<input type='button' value='Display Selected Sequences' onClick='self.location.href=\"%s&DisplaySelected=yes\"'><br><br>\n", GetClearedURL("yes")); 423 } 424 425 if ($_SESSION["DisplaySelected"]=="yes") 426 { 427 PrintUpdateDataSetButton(); 428 printf("<input type='button' value='Display All Sequences' onClick='self.location.href=\"%s&DisplaySelected=no\"'>\n", GetClearedURL("yes")); 429 printf(" <i>Currently only selected sequences are displayed.</i><br><br>\n"); 430 } 431 } 432 433 434 function ReplaceInUri($name, $rows, $direction, $result1=0) 435 { 436 $uri = htmlspecialchars($_SERVER["REQUEST_URI"]); 437 $pos = strpos($uri, "fNumStart"); 438 $amp3=FALSE; 439 if ($pos!=FALSE) 440 { 441 $amp1 = substr($uri, 0, $pos-1); 442 $amp2 = substr($uri, $pos); 443 $amp3 = strchr($amp2, "&"); 444 445 $uri = $amp1; 446 } 447 448 switch($direction) 449 { 450 case 0: 451 $pos = $_GET["fNumStart"]-$rows; 452 if ($pos<0) 453 $pos=0; 454 break; 455 case 1: 456 $pos = $_GET["fNumStart"]+$rows; 457 break; 458 case 2: 459 $pos = 0; 460 break; 461 case 3: 462 $row1 = mysql_fetch_assoc($result1); 463 $pos = $row1["FOUND_ROWS()"]-$rows+1; 464 break; 465 } 466 467 $uri .= "&fNumStart=" . $pos; 468 if ($amp3!=FALSE) 469 $uri .= $amp3; 470 471 switch($direction) 472 { 473 case 0: 474 $link .= " <A HREF='" . $uri . "'>< Prev</A> \n"; 475 break; 476 case 1: 477 $link .= " <A HREF='" . $uri . "'>Next ></A> \n"; 478 break; 479 case 2: 480 $link .= " <A HREF='" . $uri . "'><< First</A> \n"; 481 break; 482 case 3: 483 $link .= " <A HREF='" . $uri . "'>Last >></A> \n"; 484 break; 485 } 486 return $link; 487 } 488 489 function CreateMenu($rows, $result1) 490 { 491 $menu = ""; 492 493 if (empty($_GET["fNumResults"])) 494 return; 495 496 if ($_GET["fNumStart"]!=0) 497 { 498 $menu .= ReplaceInUri("fNumStart", $rows, 2); 499 $menu .= ReplaceInUri("fNumStart", $rows, 0); 500 } 501 502 $menu .= " --- <B>"; 503 if (empty($_GET["fNumStart"])) 504 $menu .= "0"; 505 else 506 $menu .= $_GET["fNumStart"]; 507 $menu .= "</B> --- \n"; 508 509 if ($rows==$_GET["fNumResults"]) 510 { 511 $menu .= ReplaceInUri("fNumStart", $rows, 1); 512 $menu .= ReplaceInUri("fNumStart", $rows, 3, $result1); 513 } 514 return $menu; 515 } 516 517 function PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $result1, $form="") 458 518 { 459 519 $col = FALSE; … … 470 530 471 531 472 $menu = CreateMenu(mysql_num_rows($result0)); 473 532 $menu = CreateMenu(mysql_num_rows($result0), $result1); 533 534 if ($form) 535 { 536 printf("<form method='POST'>"); 537 PrintDisplaySequencesButtons(); 538 } 474 539 printf("\n<center>\n"); 475 if ($form)476 printf("<form method='POST'>");477 540 if (empty($_GET["fPrintTable"])) 478 541 printf("%s\n", $menu); 542 479 543 printf("<table BORDER='0' style='margin-top:1ex'>\n"); 480 544 $counter=0; … … 518 582 if ($form) 519 583 { 520 CheckBox2($row0["Sequ"] ,"ON","");521 CheckBox2($row0["Sequ"] ,"Off","");584 CheckBox2($row0["Sequ"]."ON",""); 585 CheckBox2($row0["Sequ"]."Off",""); 522 586 } 523 587 foreach ($row0 as $key => $element) … … 607 671 */ 608 672 609 printf("<P><B>Number of displayed results: %d</B><P><P>\n", mysql_num_rows($result0)); 673 $row1 = mysql_fetch_assoc($result1); 674 printf("<P><B>Number of displayed results: %d of %s in total</B><P><P>\n", mysql_num_rows($result0), $row1["FOUND_ROWS()"]); 610 675 if (empty($_GET["fPrintTable"])) 611 676 printf("%s\n", $menu); 612 677 printf("<P>\n"); 678 printf("</center>\n"); 613 679 614 680 if (!$form) 615 681 { 616 printf("</center>\n");617 682 printf("</td>\n"); 618 683 printf("</tr>\n"); 619 684 } 685 else 686 PrintDisplaySequencesButtons(); 620 687 } 621 688
Note:
See TracChangeset
for help on using the changeset viewer.