$font = './Passion_One/PassionOne-Regular.ttf'; $size = 32; $text = $data['format_title']; $text_dim = imagettfbbox($size, 0, $font, $text); $img = imagecreatetruecolor($text_dim[2] + 88, 96); imagesavealpha($img, true); $trans = imagecolorallocatealpha($img, 0, 0, 0, 127); imagefill($img, 0, 0, $trans); $color = create_color($pal['color1'], $img); $y = floor($size * 1.1); imagettftext($img, $size, 0, 88, $y + 12, $color, $font, $text); $icon = imagecreatefrompng('assets/format_icon.png'); imagecopymerge($img, $icon, 0, 0, 0, 0, imagesx($icon), imagesy($icon), 100); imagedestroy($icon); imagepng($img, 'assets/format.png'); imagedestroy($img); # battle and time $size = 32; $text = 'submitted to ' . $data['battle_data']['title']; $text = wordwrap($text, 50, "\n"); $text .= "\n" . ' on ' . substr($data['datetime'], 0, 10); $text_dim = imagettfbbox($size, 0, $font, $text); $img = imagecreatetruecolor($text_dim[2], 246); imagesavealpha($img, true); $trans = imagecolorallocatealpha($img, 0, 0, 0, 127); imagefill($img, 0, 0, $trans); $color = create_color($pal['color1'], $img); $y = floor($size * 1.1); imagettftext($img, $size, 0, 0, $y, $color, $font, $text); imagepng($img, 'assets/battle-time.png'); imagedestroy($img);
function create_percent_color($percent) { $percent_ary = array('r' => array(86, 100), 'g' => array(0, 50), 'b' => array(51, 85)); foreach ($percent_ary as $key => $value) { if ($percent <= $value[1]) { $percent_color = create_color($key, round(200 - ($percent - $value[0]) * (200 / ($value[1] - $value[0])))); break; } } return $percent_color; }
function showComboDiff($keyword, $db=NULL) { global $SessSemName; $version2=getLatestVersion($keyword, $SessSemName[1]); $version1=getFirstVersion($keyword, $SessSemName[1]); $version2=$version2["version"]; $version1=$version1["version"]; showPageFrameStart(); wikiSinglePageHeader($wikiData, $keyword); echo "\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"; // create combodiff $wd1 = getWikiPage($keyword, $version1); $diffarray1 = toDiffLineArray($wd1['body'], $wd1['user_id']); $current_version = $version1 + 1; $differ = new line_diff(); while ($current_version <= $version2) { $wd2 = getWikiPage($keyword, $current_version); if ($wd2) { $diffarray2 = toDiffLineArray($wd2['body'], $wd2['user_id']); $newarray = $differ->arr_compare("diff", $diffarray1, $diffarray2); $diffarray1=array(); foreach ($newarray as $i) { if ($i->status["diff"] != "-") { $diffarray1[]=$i; } } } $current_version++; } $content="<table>"; $count=0; $authors=array(); foreach ($diffarray1 as $i) { if ($i && !in_array($i->who, $authors)) { $authors[]=$i->who; if ($count % 4 == 0) { $content.= "<tr width=\"100%\">"; } $content.= "<td bgcolor=".create_color($count)." width=14> </td><td><font size=-1>".get_fullname($i->who,'full',1)."</font></td><td> </td>"; if ($count % 4 == 3) { $content .= "</tr>"; } $count++; } } echo "<tr><td class=\"table_row_even\" colspan=2>"; echo "<p><font size=-1> <br>"; echo _("Legende der Autor/-innenfarben:"); echo "<table cellpadding=6 cellspacing=6>$content</table>\n"; echo "</p>"; echo "<table cellpadding=0 cellspacing=0 width=\"100%\">"; $last_author=None; $collect=""; $diffarray1[]=NULL; foreach ($diffarray1 as $i) { if (!$i || $last_author != $i->who) { if (trim($collect)!="") { $idx=array_search($last_author, $authors); $col=create_color($idx); echo "<tr bgcolor=$col>"; echo "<td width=30 align=center valign=top>"; echo Icon::create('info-circle', 'inactive', ['title' => _("Änderung von").' ' . get_fullname($last_author)])->asImg(); echo "</td>"; echo "<td><font size=-1>"; echo wikiReady($collect); echo "</font></td>"; echo "</tr>"; } $collect=""; } if ($i) { $last_author = $i->who; $collect .= $i->text; } } echo "</table></td></tr>"; echo "</table> "; getDiffPageInfobox($keyword); showPageFrameEnd(); }