public function display($tpl = null)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $model = KFactory::get('admin::com.nooku.model.translations');
     // Get data
     $stats = $model->getStats();
     $iso_code = KInput::get('iso_code', 'get', 'lang');
     // Requested table
     $table_name = KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename'));
     // Utilities
     $color = new NookuConfigColor();
     // get the chart
     $c = $this->getChart('bar');
     $c->setColor('red', $color->get('red'));
     $c->setColor('blue', $color->get('blue'));
     $c->setColor('yellow', $color->get('yellow'));
     $c->setColor('green', $color->get('green'));
     $c->SetBarWidth(5);
     $c->SetBarSpacing(1);
     $c->setData(0, $stats['MISSING'][$iso_code], 'red');
     $c->setData(1, $stats['OUTDATED'][$iso_code], 'yellow');
     $c->setData(2, $stats['COMPLETED'][$iso_code], 'green');
     $c->setData(3, $stats['ORIGINAL'][$iso_code], 'blue');
     return parent::display();
 }
 public function display($tpl = null)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $model = KFactory::get('admin::com.nooku.model.translators');
     // Get data from model
     $stats = $model->getStats();
     $dates = $model->getDates();
     // Get translators
     $translators = $nooku->getTranslators();
     // Get the languages
     //$primary       = $nooku->getPrimaryLanguage();
     $languages = $nooku->getLanguages();
     //unset($languages[$primary->iso_code]); // we don't display the primary lang in our chart
     // Request
     $table_name = KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename'));
     $user_id = KInput::get('user_id', 'get', 'int');
     if (!$user_id) {
         throw new KViewException('user_id is required in ' . JURI::getInstance()->toString());
     }
     // Utilities
     $color = new NookuConfigColor();
     // get the chart
     $c = $this->getChart('line');
     // Data
     $i = 1;
     foreach ($stats[$user_id]->count as $value) {
         $c->setData($i++, $value);
     }
     // Layout
     $c->SetLineSize(5);
     // The Sparkline lib always draws in black, this hack lets us use other colors
     $c->setColor('black', $color->get('blue'));
     parent::display();
 }
 public function getGoogleChartUrl()
 {
     $c = KChartGoogle::getInstance(KChartGoogle::PIE);
     $data = $this->getStats();
     $count = array();
     $names = array();
     foreach ($data as $stat) {
         $count[] = $stat->total;
         $names[] = $stat->name;
     }
     $color = new NookuConfigColor();
     //unset red
     $color->set('red', null);
     $color->setPrefix('');
     $c->addData($count)->setValueLabels($names)->setColors($color->getSet());
     return $c->getUrl();
 }