[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_languages/ -> toolbar.languages.php (source)

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