Example #1
0
 /**
  * Get a list of langpacks that haven't been added to the nooku languages table yet
  *
  * @return	array
  */
 public function getUnused()
 {
     $langs = KFactory::get('admin::com.nooku.model.languages')->getList();
     $list = $this->getList();
     foreach (KHelperArray::getColumn($langs->toArray(), 'iso_code') as $iso_code) {
         if (isset($list[$iso_code])) {
             unset($list[$iso_code]);
         }
     }
     return $list;
 }
Example #2
0
<?php

/** $Id: bar.php 567 2008-07-07 23:22:39Z mathias $ */
defined('_JEXEC') or die('Restricted access');
?>

<?php 
// get the chart
@$chart->title(@text('Translation Progress'));
// Data
@$chart->set_data(@$data['MISSING']);
@$chart->bar_3D(75, @$color->get('red'), @text('Missing'), 10);
@$chart->set_data(@$data['OUTDATED']);
@$chart->bar_3D(75, @$color->get('yellow'), @text('Outdated'), 10);
@$chart->set_data(@$data['COMPLETED']);
@$chart->bar_3D(75, @$color->get('green'), @text('Completed'), 10);
@$chart->set_data(@$data['ORIGINAL']);
@$chart->bar_3D(75, @$color->get('blue'), @text('Original'), 10);
// Text
$labels = KHelperArray::getColumn(@$languages, 'name');
@$chart->set_x_labels($labels);
@$chart->set_x_legend(@$table_name ? KInflector::humanize(@$table_name) . ' ' . @text('Table') : @text('All Tables'));
// Min, max and steps
$max = KHelperMath::roundup(max(@$data['TOTAL']), -1);
@$chart->set_y_max($max);
@$chart->set_y_min(0);
@$chart->set_y_label_steps($max / 10);
@$chart->set_y_legend(@text('Items'), 14, '#000000');
Example #3
0
 /**
  * Parse route callback function
  *
  * @return	array
  */
 public function _processParseRules($uri)
 {
     $vars = parent::_processParseRules($uri);
     $lang = null;
     //force to empty
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     switch ($this->getMode()) {
         case JROUTER_MODE_RAW:
             $lang = $uri->getVar('lang', '');
             break;
         case JROUTER_MODE_SEF:
             $languages = $nooku->getLanguages();
             /*
              * Try to find the language based on the first segment in thu URL
              */
             $path = $uri->getPath();
             $segments = explode('/', $path);
             /*
              * If no path information exist, set the language to empty
              */
             if (!empty($path)) {
                 $alias = array_shift($segments);
                 $aliases = array_flip(KHelperArray::getColumn($languages, 'alias'));
                 $lang = isset($aliases[$alias]) ? $aliases[$alias] : null;
             } else {
                 $lang = '';
             }
             /*
              * Prepend the URL with the default alias and perform a re-route. If the result returns 
              * option information the URL is valid and we assume the request doesn't contain any
              * language information, otherwise the URL did contain language information.
              */
             if (is_null($lang)) {
                 $primary = $nooku->getPrimaryLanguage();
                 $url = str_replace($path, $primary->alias . '/' . $path, JURI::current());
                 $result = $this->parse(new JURI($url));
                 if (isset($result['option'])) {
                     $lang = '';
                 }
             }
             //Remove the language from the path
             if (!empty($lang)) {
                 $uri->setPath(implode($segments, '/'));
             }
             break;
     }
     //Force a reload the menu
     if (!empty($lang) && strtolower($lang) != strtolower($nooku->getLanguage())) {
         //Set the language
         $nooku->setLanguage($lang);
         $menu = KFactory::get('lib.joomla.application')->getMenu();
         $menu->load();
     }
     $this->setVar('lang', $lang);
     return $vars;
 }
 /**
  * @dataProvider provideForGetColumn
  */
 public function testGetColumn($expected, $array, $key)
 {
     $this->assertEquals($expected, KHelperArray::getColumn($array, $key));
 }