browse_foreigners.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * display selection for relational field values
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\BrowseForeigners;
  9. use PhpMyAdmin\Relation;
  10. use PhpMyAdmin\Response;
  11. use PhpMyAdmin\Util;
  12. require_once 'libraries/common.inc.php';
  13. /**
  14. * Sets globals from $_POST
  15. */
  16. $request_params = array(
  17. 'data',
  18. 'field'
  19. );
  20. foreach ($request_params as $one_request_param) {
  21. if (isset($_POST[$one_request_param])) {
  22. $GLOBALS[$one_request_param] = $_POST[$one_request_param];
  23. }
  24. }
  25. Util::checkParameters(array('db', 'table', 'field'));
  26. $response = Response::getInstance();
  27. $response->getFooter()->setMinimal();
  28. $header = $response->getHeader();
  29. $header->disableMenuAndConsole();
  30. $header->setBodyId('body_browse_foreigners');
  31. $relation = new Relation();
  32. /**
  33. * Displays the frame
  34. */
  35. $foreigners = $relation->getForeigners($db, $table);
  36. $browseForeigners = new BrowseForeigners(
  37. $GLOBALS['cfg']['LimitChars'],
  38. $GLOBALS['cfg']['MaxRows'],
  39. $GLOBALS['cfg']['RepeatCells'],
  40. $GLOBALS['cfg']['ShowAll'],
  41. $GLOBALS['pmaThemeImage']
  42. );
  43. $foreign_limit = $browseForeigners->getForeignLimit(
  44. isset($_POST['foreign_showAll']) ? $_POST['foreign_showAll'] : null
  45. );
  46. $foreignData = $relation->getForeignData(
  47. $foreigners, $_POST['field'], true,
  48. isset($_POST['foreign_filter'])
  49. ? $_POST['foreign_filter']
  50. : '',
  51. isset($foreign_limit) ? $foreign_limit : null,
  52. true // for getting value in $foreignData['the_total']
  53. );
  54. // HTML output
  55. $html = $browseForeigners->getHtmlForRelationalFieldSelection(
  56. $db,
  57. $table,
  58. $_POST['field'],
  59. $foreignData,
  60. isset($fieldkey) ? $fieldkey : null,
  61. isset($data) ? $data : null
  62. );
  63. $response->addHtml($html);