ServerCollationsController.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Holds the PhpMyAdmin\Controllers\Server\ServerCollationsController
  5. *
  6. * @package PhpMyAdmin\Controllers
  7. */
  8. namespace PhpMyAdmin\Controllers\Server;
  9. use PhpMyAdmin\Controllers\Controller;
  10. use PhpMyAdmin\Charsets;
  11. use PhpMyAdmin\Server\Common;
  12. use PhpMyAdmin\Template;
  13. /**
  14. * Handles viewing character sets and collations
  15. *
  16. * @package PhpMyAdmin\Controllers
  17. */
  18. class ServerCollationsController extends Controller
  19. {
  20. /**
  21. * Index action
  22. *
  23. * @return void
  24. */
  25. public function indexAction()
  26. {
  27. $dbi = $GLOBALS['dbi'];
  28. $disableIs = $GLOBALS['cfg']['Server']['DisableIS'];
  29. /**
  30. * Does the common work
  31. */
  32. include_once 'libraries/server_common.inc.php';
  33. $this->response->addHTML(
  34. Template::get('server/sub_page_header')->render([
  35. 'type' => 'collations',
  36. ])
  37. );
  38. $this->response->addHTML(
  39. $this->_getHtmlForCharsets(
  40. Charsets::getMySQLCharsets($dbi, $disableIs),
  41. Charsets::getMySQLCollations($dbi, $disableIs),
  42. Charsets::getMySQLCharsetsDescriptions($dbi, $disableIs),
  43. Charsets::getMySQLCollationsDefault($dbi, $disableIs)
  44. )
  45. );
  46. }
  47. /**
  48. * Returns the html for server Character Sets and Collations.
  49. *
  50. * @param array $mysqlCharsets Mysql Charsets list
  51. * @param array $mysqlCollations Mysql Collations list
  52. * @param array $mysqlCharsetsDesc Charsets descriptions
  53. * @param array $mysqlDftCollations Default Collations list
  54. *
  55. * @return string
  56. */
  57. function _getHtmlForCharsets(array $mysqlCharsets, array $mysqlCollations,
  58. array $mysqlCharsetsDesc, array $mysqlDftCollations
  59. ) {
  60. return Template::get('server/collations/charsets')->render(
  61. array(
  62. 'mysql_charsets' => $mysqlCharsets,
  63. 'mysql_collations' => $mysqlCollations,
  64. 'mysql_charsets_desc' => $mysqlCharsetsDesc,
  65. 'mysql_dft_collations' => $mysqlDftCollations,
  66. )
  67. );
  68. }
  69. }