[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/sitemgr/modules/ -> class.module_lang_block.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare SiteMgr - Web Content Management                              *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      \**************************************************************************/
  11  
  12      /* $Id: class.module_lang_block.inc.php 21740 2006-06-07 14:13:08Z nelius_weiss $ */
  13  
  14      class module_lang_block extends Module
  15      {
  16  		function module_lang_block()
  17          {
  18              $this->arguments = array( 
  19                  'layout' => array(
  20                                          'type' => 'select',
  21                                          'label' => lang('Select layout for lang selection'),
  22                                          'options' => array(
  23                                                  'plain' => lang('Plain selectbox'),
  24                                                  'flags' => lang('Flag symbols'),
  25                      ),
  26                  ),
  27              );
  28   
  29              $this->properties = array();
  30              $this->title = lang('Choose language');
  31              $this->description = lang('This module lets users choose language');
  32          }
  33      
  34  		function get_content(&$arguments,$properties)
  35          {
  36              if ($GLOBALS['sitemgr_info']['sitelanguages'])
  37              {
  38                  if ($arguments['layout'] == 'flags')
  39                  {
  40                      $content = '
  41                          <div id="langsel_flags">
  42                               <ul>';
  43                      foreach ($GLOBALS['sitemgr_info']['sitelanguages'] as $lang)
  44                                          {
  45                          $content .= '
  46                                  <li><a href="#." onClick="location.href=\''. str_replace('&','&amp;',$this->link(array(),array('lang'=>$lang))) . '\' ">'. '<img src="images/'. $lang. '.gif" width="32px" height="20px">'. '</a></li>';
  47                      }
  48                      $content .= '
  49                              </ul>
  50                          </div>';
  51                  }
  52                  else
  53                  {
  54                      $content = '<form name="langselect" method="post" action="">';
  55                      $content .= '<select onChange="location.href=this.value" name="language">';
  56                      foreach ($GLOBALS['sitemgr_info']['sitelanguages'] as $lang)
  57                      {
  58                          $selected='';
  59                          if ($lang == $GLOBALS['sitemgr_info']['userlang'])
  60                          {                                                 
  61                              $selected = 'selected="1" ';
  62                          }                                          
  63                          $content .= '<option ' . $selected . 'value="' . str_replace('&','&amp;',$this->link(array(),array('lang'=>$lang))) . '">'.$GLOBALS['Common_BO']->getlangname($lang) . '</option>';
  64                      }
  65                      $content .= '</select>';
  66                      $content .= '</form>';
  67                  }
  68              
  69                  return $content;
  70              }
  71              return lang('No sitelanguages configured');
  72          }
  73      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7