[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_languages/views/ -> catalogs.view.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 catalogsView extends View
  19  {
  20      function render(&$renderer, &$request)
  21      {
  22          $lang = $request->get('lang');
  23          $language =& new mamboLanguage($lang);
  24          $language->load(true);
  25          $session =& $request->session();
  26          $col = isset($session['col']) ? $session['col'] : 'domain';
  27          $asc = isset($session['asc']) ? $session['asc'] : 1;
  28          $order = array();
  29          $files = $language->files;
  30          // search
  31          $search = $request->get('search');
  32          if($search !== '') {
  33              $ds = defined('DIRECTORY_SEPARATOR') ? DIRECTORY_SEPARATOR : '/';
  34              $basePath = mamboCore::get('mosConfig_absolute_path');
  35              $results = array();
  36              foreach($files as $file) {
  37                  if($file['filetype'] !== 'po') continue;
  38                  $filename = preg_replace("/[\/\\\\]+/",$ds,$basePath.$ds.$file['filename']);
  39                  $content = file_get_contents($filename);
  40                  $result = strpos($content, $search);
  41                  if($result !== false) $results[] = $file;
  42              }
  43              if(count($results) > 0) $files = $results;
  44          }
  45          // end search
  46          foreach ($files as $key => $row) {
  47              if ($row['filetype'] == 'po'){
  48                  $catalogs[]  = $row;
  49              }
  50          }
  51          // Obtain a list of columns
  52          foreach ($catalogs as $key => $row) {
  53              $order[$key]  = $row[$col];
  54          }
  55          array_multisort($order, $asc == 1 ? SORT_ASC : SORT_DESC, $catalogs);
  56          $renderer->addvar('col', $col);
  57          $renderer->addvar('asc', $asc);
  58          $renderer->addvar('rows', $catalogs);
  59          $renderer->addvar('header', sprintf(T_('Manage Translations: %s'), $lang));        
  60          $renderer->addvar('content', $renderer->fetch('catalogs.tpl.php'));
  61          $renderer->display('form.tpl.php');
  62      }
  63  }
  64  ?>