function wcProfileRegats(array $regats, $sort_url, $priv = false, $hide_score = false) { $unknown = GWF_HTML::lang('unknown'); $headers = array(array(WC_HTML::lang('th_site_name')), array(WC_HTML::lang('th_score'), 'regat_score'), array(WC_HTML::lang('th_regat_onsitename')), array(WC_HTML::lang('th_progress'), 'regat_solved'), array(WC_HTML::lang('th_regat_lastdate'), 'regat_lastdate')); echo '<table>'; echo GWF_Table::displayHeaders1($headers); foreach ($regats as $regat) { $regat instanceof WC_RegAt; $site = $regat->getSite(); $color = GWF_Color::interpolatBound(0, 1, $site->calcPercent($regat), 0xff0000, 0x8800); if ($hide_score) { $score = $percent = '???'; } else { $score = $regat->getVar('regat_score'); $percent = $regat->displayPercent($site->getOnsiteScore()); } echo GWF_Table::rowStart(true, '', '', 'color:#' . $color . ';'); echo sprintf('<td>%s</td>', $site->displayLink()); echo sprintf('<td class="gwf_num">%s</td>', $score); echo sprintf('<td>%s</td>', $regat->displayOnsiteProfileLink($site)); echo sprintf('<td class="gwf_num">%s</td>', $percent); echo sprintf('<td class="nowrap gwf_date">%s</td>', $priv ? $unknown : $regat->displayLastDate()); echo GWF_Table::rowEnd(); } echo '</table>'; }
$lang_votes = ' ' . $tLang->lang('voted'); foreach ($o as $i => $opt) { if ($reveal) { $count = $p->displayVotecount($user, $i); $format = '%.02f'; } else { $count = '???'; $format = '%s'; } if ($total == 0) { $percent2 = 0; } else { $percent2 = round($count / $total * 100); } $percent = $count === '?' || $count == 0 ? 0 : round($count / $total * $tVars['pixels']); $color = GWF_Color::interpolatBound(0, $tVars['pixels'], $percent, 0xff0000, 0xff00); $onclick = "return gwfVoteMulti({$pid});"; $checked = $voterow !== false && $voterow->hasVotedOption($i) ? ' checked="checked"' : ''; echo GWF_Table::rowStart(); echo sprintf('<td><span id="vm_%s_%s">%s</span>%s</td>', $pid, $i, $count, $lang_votes); echo sprintf('<td>%s</td>', GWF_HTML::display($opt['vmo_text'])); if (!$reveal) { $percent2 = '???.??'; } echo sprintf('<td style="width: %dpx; white-space: nowrap;"><div style="width: %dpx; background: #%s; margin-top:1px;">' . $format . '%%</div></td>', $tVars['pixels'], $percent, $color, $percent2); if ($may_vote) { echo sprintf('<td><input type="checkbox"%s onclick="%s" name="opt[%d]" /></td>', $checked, $onclick, $i); } else { echo sprintf('<td></td>'); } echo GWF_Table::rowEnd();
private function getColor($image, $mincolor = 0xffff0000, $maxcolor = 0xff00ff00) { return GWF_Color::interpolateBound($image, 1, $this->of, $this->num, $mincolor, $maxcolor); #, $max, $value) }