PageRenderTime 26ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/4.8/administrator/components/com_languages/toolbar.languages.php

http://miacms.googlecode.com/
PHP | 120 lines | 92 code | 10 blank | 18 comment | 13 complexity | d8b09b17db30bc415807778810771c78 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, LGPL-2.0
  1. <?php
  2. /**
  3. * @package MiaCMS
  4. * @subpackage Languages
  5. * @author MiaCMS see README.php
  6. * @copyright MiaCMS
  7. * See COPYRIGHT.php for copyright notices and details.
  8. * @license GNU/GPL Version 2, see LICENSE.php
  9. * MiaCMS is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; version 2 of the License.
  12. */
  13. defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  14. class ToolBar
  15. {
  16. var $request = array();
  17. var $map = array();
  18. var $has_gettext;
  19. function ToolBar()
  20. {
  21. $this->request = $_REQUEST;
  22. $gettext_admin = new PHPGettextAdmin();
  23. $this->has_gettext = $gettext_admin->gettextAble();
  24. }
  25. function display($method = null)
  26. {
  27. $task = mosGetParam($_REQUEST,'task','index');
  28. $act = mosGetParam($_REQUEST,'act','');
  29. if($task == 'index' && $act) $task = $act;
  30. if (is_null($method))$method = $task;
  31. if (in_array($method, array_keys($this->map)))$method = $this->map[$method];
  32. if ($method && strlen($method) > 2 && method_exists($this, $method))
  33. return $this->$method();
  34. return false;
  35. }
  36. function _default(){}
  37. }
  38. class languagesToolbar extends ToolBar {
  39. var $map = array('index' => 'language','extract' => 'language', 'sort' => 'catalogs', 'new' => 'newlang', 'save' => 'edit', 'auto_translate' => 'edit', 'convert' => 'edit', 'apply' => 'edit');
  40. function edit() {
  41. mosMenuBar::startTable();
  42. if ($this->request['act'] != 'catalogs') {
  43. #mosMenuBar::custom( 'translate', 'edit.png', 'edit_f2.png', T_('Manage'), false );
  44. #mosMenuBar::spacer();
  45. } else {
  46. mosMenuBar::custom( 'auto_translate', 'copy.png', 'copy_f2.png', T_('Auto'), false );
  47. mosMenuBar::spacer(20);
  48. mosMenuBar::apply();
  49. mosMenuBar::spacer();
  50. }
  51. mosMenuBar::save();
  52. mosMenuBar::spacer();
  53. mosMenuBar::cancel();
  54. mosMenuBar::spacer();
  55. #mosMenuBar::help( 'screen.languages.edit' );
  56. mosMenuBar::endTable();
  57. }
  58. function update() {
  59. mosMenuBar::startTable();
  60. mosMenuBar::cancel();
  61. mosMenuBar::spacer();
  62. #mosMenuBar::help( 'screen.languages.update' );
  63. mosMenuBar::endTable();
  64. }
  65. function language() {
  66. mosMenuBar::startTable();
  67. if (!is_dir(mamboCore::get('rootPath').'/language/untranslated') && $this->has_gettext) {
  68. mosMenuBar::customX( 'extract', 'query.png', 'query.png', T_('Scan Sources'), false );
  69. mosMenuBar::spacer(50);
  70. }
  71. mosMenuBar::custom( 'install', 'move.png', 'move_f2.png', T_('Install'), false );
  72. mosMenuBar::spacer();
  73. mosMenuBar::custom( 'translate', 'edit.png', 'edit_f2.png', T_('Manage'), true );
  74. mosMenuBar::spacer();
  75. mosMenuBar::custom( 'export', 'upload.png', 'upload_f2.png', T_('Export'));
  76. mosMenuBar::spacer();
  77. mosMenuBar::addNewX();
  78. mosMenuBar::spacer();
  79. mosMenuBar::editListX( 'edit' );
  80. mosMenuBar::spacer();
  81. mosMenuBar::deleteList();
  82. mosMenuBar::spacer();
  83. #mosMenuBar::help( 'screen.languages.language' );
  84. mosMenuBar::endTable();
  85. }
  86. function newlang() {
  87. mosMenuBar::startTable();
  88. mosMenuBar::save();
  89. mosMenuBar::spacer();
  90. mosMenuBar::cancel();
  91. mosMenuBar::spacer();
  92. #mosMenuBar::help( 'screen.languages.main' );
  93. mosMenuBar::endTable();
  94. }
  95. function catalogs()
  96. {
  97. mosMenuBar::startTable();
  98. mosMenuBar::customX( 'update', 'publish.png', 'publish_f2.png', T_('Update'), false );
  99. mosMenuBar::spacer();
  100. mosMenuBar::editListX( 'edit' );
  101. mosMenuBar::spacer();
  102. mosMenuBar::cancel();
  103. mosMenuBar::spacer();
  104. #mosMenuBar::help( 'screen.languages.main' );
  105. mosMenuBar::endTable();
  106. }
  107. }
  108. $toolbar = new languagesToolbar('languages');
  109. $toolbar->display();
  110. ?>