'Playball', 'version' => null, 'demo' => 'Playball', 'license' => 'SIL Open Font License Version 1.1', 'author' => null, 'Designer(s)' => null, 'Foundry' => 'TypeSETit, LLC (typesetit@att.net)', 'links' => array( 'SIL OFL' => 'http://scripts.sil.org/OFL', 'Package' => 'http://www.google.com/fonts/specimen/Playball' ) ); ?>Statistik **/ if ($_REQUEST['ext']=='qr') { $tpl->tpl_layout = $dir['root']['fs'].'templates/popup.tpl.php'; $this->cell = true; } $this->name = $name = get_class($this); $this->template = fs(__FILE__).$name.'.tpl.php'; $tpl->css[$name] = ws(__FILE__).$name.'.css'; if (!$cCompetitions) $cCompetitions = new cCompetitions(); $this->cCompetitions = &$cCompetitions; $this->u = $user->get($par['u']); $this->c = $cCompetitions->get($par['c']); if ($this->u) { $filter = array('users_id' => $this->u['id'], 'wkGruppen_id' => $par['g'], 'challenge' => $this->c['challenge_content_id']); $r = $cCompetitions->getResultList($filter, array('order' => '`c`.`datum` DESC')); $filter['method'] = 'wmaAgeGrade'; $meth = $cCompetitions->getResultList($filter, array('order' => '`c`.`datum` DESC')); } unset($k,$v,$next); $nk = $next = false; $safetiii = 0; if ($r) foreach ($r as $k=>$last) if ($last['time']) { if (100 < $safetiii++) die('looooooooop!?'); $r[$k]['c'] = $cCompetitions->get($last['wkCompetitions_id']); $r[$k]['c']['stat'] = $cCompetitions->getComStat($last['wkCompetitions_id']); if ($r[$k]['c']['stat']) foreach ($r[$k]['c']['stat'] as $statk=>$statv) $r[$k]['c']['stat'][$statk.'Time'] = $cCompetitions->toTime($statv); if ($next !== false) { $s = array ( 'improved' => $next['time'] < $last['time'] ? true : false, 'change' => round($next['time'] - $last['time'], 2), 'changeTime' => $cCompetitions->toTime(abs($next['time'] - $last['time']), null, true), 'gainSelf' => $cCompetitions->getPercent($last['time'], $next['time'], null, 2), //'gainOffset' => $this->getPercent($last['time'], $next['time'], 1800), 'wtlIndex' => round($next['index'], 2)//$this->getPercent($last['time'], $next['time'], 1800) +100 ); if ($nk !== false) $r[$nk]['stat'] = $s;// we're in if($next) and $next should be available at next iteration only? } $nk = $k;//nk is the key of the next competition in time, but since we're going back in time it's the last iteration key in array! $next = $last;//see nk... back in time - next competition in time } $this->results = $r; $this->meth = $meth; } function getPercent ($last, $next, $offset = 0, $precision = 2) { if ($offset === null) $offset = 0; if ($precision === null) $precision = 2; $last -= $offset; $next -= $offset; $r = ( $last - $next ) / ( $last / 100 ); return $precision ? round($r, $precision) : $r; } } ?>