Esempio n. 1
0
 /**
  * assign the chartdata object for open flash chart library
  * @param $config
  * @return unknown_type
  */
 function _setChartdata($config)
 {
     $model = $this->getModel();
     $rounds = $this->get('Rounds');
     $round_labels = array();
     foreach ($rounds as $r) {
         $round_labels[] = $r->name;
     }
     $division = $this->get('division');
     $data = $model->getDataByDivision($division->id);
     //create a line
     $length = count($rounds) - 0.5;
     $linewidth = $config['color_legend_line_width'];
     $lines = array();
     //$title = $division->name;
     $chart = new open_flash_chart();
     //$chart->set_title( $title );
     $chart->set_bg_colour($config['bg_colour']);
     //colors defined for ranking table lines
     //todo: add support for more than 2 lines
     foreach ($this->colors as $color) {
         foreach ($rounds as $r) {
             for ($n = $color['from']; $n <= $color['to']; $n++) {
                 $lines[$color['color']][$n][] = $n;
             }
         }
     }
     //set lines on the graph
     foreach ($lines as $key => $value) {
         foreach ($value as $line => $key2) {
             $chart->add_element(hline($key, $length, $line, $linewidth));
         }
     }
     //load team1, first team in the dropdown
     $team = $this->team1;
     $d = new $config['dotstyle_1']();
     $d->size((int) $config['line1_dot_strength']);
     $d->halo_size(1);
     $d->colour($config['line1']);
     $d->tooltip('Rank: #val#');
     $line = new line();
     $line->set_default_dot_style($d);
     $line->set_values($team->rankings);
     $line->set_width((int) $config['line1_strength']);
     $line->set_key($team->name, 12);
     $line->set_colour($config['line1']);
     $line->on_show(new line_on_show($config['l_animation_1'], $config['l_cascade_1'], $config['l_delay_1']));
     $chart->add_element($line);
     //load team2, second team in the dropdown
     $team = $this->team2;
     $d = new $config['dotstyle_2']();
     $d->size((int) $config['line2_dot_strength']);
     $d->halo_size(1);
     $d->colour($config['line2']);
     $d->tooltip('Rank: #val#');
     $line = new line();
     $line->set_default_dot_style($d);
     $line->set_values($team->rankings);
     $line->set_width((int) $config['line2_strength']);
     $line->set_key($team->name, 12);
     $line->set_colour($config['line2']);
     $line->on_show(new line_on_show($config['l_animation_2'], $config['l_cascade_2'], $config['l_delay_2']));
     $chart->add_element($line);
     $x = new x_axis();
     if ($config['x_axis_label'] == 1) {
         $xlabels = new x_axis_labels();
         $xlabels->set_labels($round_labels);
         $xlabels->set_vertical();
     }
     $x->set_labels($xlabels);
     $x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
     $chart->set_x_axis($x);
     $x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_CURVE_ROUNDS'));
     $x_legend->set_style('{font-size: 15px; color: #778877}');
     $chart->set_x_legend($x_legend);
     $y = new y_axis();
     $y->set_range(count($data), 1, -1);
     $y->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
     $chart->set_y_axis($y);
     $y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_CURVE_RANK'));
     $y_legend->set_style('{font-size: 15px; color: #778877}');
     $chart->set_y_legend($y_legend);
     ob_clean();
     echo $chart->toString();
 }
Esempio n. 2
0
function generate_ascii_table($row, $col, $a, $al, $tll, $val, $lng, $bord)
{
    global $charset;
    if ($bord) {
        hline($col, $lng, $bord);
    }
    for ($i = 0; $i < $row; $i++) {
        for ($j = 0; $j < $col; $j++) {
            $a[$i][$j] = array_pad_internal($a[$i][$j], $tll[$i], $val[$i]);
        }
        for ($k = 0; $k < $tll[$i]; $k++) {
            if ($bord) {
                echo "|";
            }
            for ($j = 0; $j < $col; $j++) {
                echo htmlspecialchars(mb_str_pad($a[$i][$j][$k], $lng[$j], " ", $al[$j]), ENT_QUOTES, $charset);
                if ($j < $col - 1) {
                    echo "|";
                }
            }
            if ($bord) {
                echo "|";
            }
            echo "\n";
        }
        if ($bord || $i < $row - 1) {
            hline($col, $lng, $bord);
        }
    }
}