function draw_clusters($tset, $clusters, $centroids = null, $lines = False, $w = 300, $h = 200) { if (!function_exists('imagecreate')) { return null; } $im = imagecreatetruecolor($w, $h); $white = imagecolorallocate($im, 255, 255, 255); $colors = array(); $NC = count($clusters); for ($i = 1; $i <= $NC; $i++) { list($r, $g, $b) = getColor($i / $NC); $colors[] = imagecolorallocate($im, $r, $g, $b); } imagefill($im, 0, 0, $white); foreach ($clusters as $cid => $cluster) { foreach ($cluster as $idx) { $data = $tset[$idx]->getDocumentData(); imagesetpixel($im, $data['x'], $data['y'], $colors[$cid]); } if (is_array($centroids)) { $x = $centroids[$cid]['x']; $y = $centroids[$cid]['y']; if ($lines) { // draw line // for cosine similarity //imagesetthickness($im,5); //imageline($im,0,0,$x*400,$y*400,$colors[$cid]); } else { // draw circle for euclidean imagefilledarc($im, $x, $y, 10, 10, 0, 360, $colors[$cid], 0); } } } return $im; }
function createGistagramm($width, $heigth) { $image = @imagecreate($width, $heigth); $maxKey = findMaxKey($this->array); $maxValue = findMaxValue($this->array); ImageColorAllocate($image, 255, 255, 255); ImageLine($image, $this->align, $heigth - $this->align, $width - $this->align, $heigth - $this->align, 1); ImageLine($image, $this->align, $this->align, $this->align, $heigth - $this->align, 1); $widthRect = round(($width - 2 * $this->align) / ($maxKey + 1)) * $this->widthColumn; foreach ($this->array as $key => $value) { $color = getColor($image, $value, $maxValue); $heigthRect = round($value * ($heigth - 2 * $this->align) / $maxValue); $pos = round($key / ($maxKey + 1) * ($width - 2 * $this->align)) + $this->align; ImageFilledRectangle($image, $pos - $widthRect / 2, $heigth - $heigthRect, $pos + $widthRect / 2, $heigth - $this->align, $color); ImageString($image, 0, $pos - $widthRect / 2, $heigth - $heigthRect - 10, $value, 1); ImageString($image, 0, $pos - $widthRect / 2, $heigth - $this->align, $key, 1); } $this->image = $image; }
function getPlayers() { $mysqli = new MySQLi("localhost", "wotmanager", "DT5HtrpaUlJ3iVGm", "testing", 3306); $stmt = $mysqli->prepare("SELECT ID,nick,battles,tier,wn8,wr,rwn8,rwr,clan,time FROM result order by time desc"); $stmt->bind_result($id, $nick, $battles, $tier, $wn8, $wr, $rwn8, $rwr, $clan, $updated); $stmt->execute(); while ($stmt->fetch()) { echo '<tr> <td><b><a href="http://stats.wotmanager.com/na/player/' . $nick . '" target="_blank">' . $nick . '</a></b></td> <td><b><font color="' . getColor($battles, "bat") . '">' . $battles . '</font></b></td> <td><b><font color="' . getColor($tier, "tier") . '">' . $tier . '</font></b></td> <td><b><font color="' . getColor($wn8, "wn8") . '">' . $wn8 . '</font></b></td> <td><b><font color="' . getColor($wr, "wr") . '">' . $wr . '</font></b></td> <td><b><font color="' . getColor($rwn8, "wn8") . '">' . $rwn8 . '</font></b></td> <td><b><font color="' . getColor($rwr, "wr") . '">' . $rwr . '</font></b></td> <td>' . $clan . '</td> <td>' . $updated . '</td> <td><a href="http://forum.worldoftanks.com/index.php?app=members&module=messaging§ion=send&do=form&preview=1&_from=quickPM&fromMemberID=' . $id . '"target="_blank"><i class="fa fa-envelope fa-lg"></i></a></td> </tr>'; } }
function htmlGetSpots($data) { $retour = ""; $spots = getSpots($data); $j = 1; // Parcours les spots foreach ($spots as $spot) { $td_monstres = ""; $i = 0; $level = 0; // Parcours le spot foreach ($spot as $monstre) { if (count($monstre) != 1) { $a = explode(" [", $monstre["name"]); $name = trim($a[0]); $age = trim(str_replace("]", "", $a[1])); $td_monstres .= '<tr><td>' . $monstre["level"] . '</td>'; if ($monstre["level"] != "?") { $level += $monstre["level"]; } else { --$i; } $td_monstres .= '<td><a href="" onClick="window.open(\'http://games.mountyhall.com/mountyhall/View/MonsterView.php?ai_IDPJ=' . $monstre["id"] . '\',\'_blank\',\'toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width=766, height=636\');return(false);">' . $monstre["id"] . '</a></td>'; $td_monstres .= '<td><a href="/bestiaire2/bestiaire.php?Monstre=' . $name . '&Age=' . $age . '&MH=' . $monstre["id"] . '" target="_blank">' . $monstre["name"] . '</a></td>'; $td_monstres .= '<td><a href="/cockpit.php?cX=' . $monstre["X"] . '&cY=' . $monstre["Y"] . '&cZ=' . $monstre["N"] . '" target="_blank">' . $monstre["X"] . " " . $monstre["Y"] . " " . $monstre["N"] . "</a></td></tr>"; ++$i; } } // Affiche le spot si il correspond aux critères de recherche if (intval($data["number"]) <= $i && intval($data["level"]) <= intval($level / $i)) { $retour .= '<table class="mh_tdtitre" border="1" align="center" cellpadding="5"><tr bgcolor="' . getColor($i) . '"><th>Niv. Moyen : ' . intval($level / $i) . '</th><th colspan="3">Spot numéro : ' . $j . '</th></tr>' . $td_monstres . '</table><br/>'; } ++$j; } return $retour; }
echo getTitle(3); ?> </div> <p> <span class="CuerpoArticulo"><?php echo getCopete(3, 160); ?> </span> </p> </div> <div align="left" id="divNoticia4" style="cursor:hand; height:120px;" title="Click aquí para modificar la Noticia 4" onClick="editarNoticia(4)" onMouseOut="mouseOutNotica(4)" onMouseOver="mouseOverNotica(4)"> <div align="left" class="TituloNoticiasSecundarias" style="background-image: url('/modules/arteria_noticias/fondo_titulos/fondo_chico_<?php echo getColor(4); ?> .jpg'); background-repeat:no-repeat; color:#<?php echo getColor(4); ?> ; height:53px; line-height:56px;"><?php echo getTitle(4); ?> </div> <p> <span class="CuerpoArticulo"><?php echo getCopete(4, 160); ?> </span> </p> </div> </td> </tr> </table>
$im = imagecreatetruecolor($title_row["w"], $title_row["h"]); imageantialias($im, true); imagealphablending($im, false); $alpha = imagecolorallocatealpha($im, 255, 255, 255, 127); imagefilledrectangle($im, 0, 0, $title_row["w"], $title_row["h"], $alpha); imagealphablending($im, true); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); if ($title_row["type"] == "text") { $commands = getLinesFromText($title_row["path"]); } else { $commands = array(); } foreach ($commands as $c) { if ($c["command"] == "poly") { $color = getColor($id, $c["color"], $im); imagefilledpolygon($im, $c["points"], count($c["points"]) / 2, $color); } elseif ($c["command"] == "asset") { $asset = imagecreatefrompng($c["asset"]); imagecopy($im, $asset, $c["points"][0], $c["points"][1], 0, 0, $c["points"][2], $c["points"][3]); } elseif ($c["command"] == "img") { $imgsrc = getContent($id, $c["asset"]); $img = imagecreatefrompng("{$imgsrc}"); $size = getimagesize("{$imgsrc}"); imagecopyresampled($im, $img, $c["points"][0], $c["points"][1], 0, 0, $c["points"][2], $c["points"][3], $size[0], $size[1]); } elseif ($c["command"] == "text") { $content = getContent($id, $c["content"]); $font = getFont($c["font"]); if ($c["align"] == "r") { $r = imagefttext($im, $c["size"], 0, 700, 0, $white, $font, $content); $c["points"][0] -= $r[2] - $r[0];
function writeText($image, $size, $xpos, $ypos, $color, $font, $text, $shadow) { $color = getColor($color, $image); // Create a drop shadow if ($shadow != '') { $shadow = getColor($shadow, $image); imagettftext($image, $size, 0, $xpos + 1, $ypos + 1, $shadow, $font, $text); } // Write the text imagettftext($image, $size, 0, $xpos, $ypos, $color, $font, $text); }
<tr> <td><img src="images/<?php if (isset($_SESSION['color'][$flowername])) { echo $_SESSION['color'][$flowername]; } else { echo $_SESSION['image'][$flowername]; } ?> .jpg" alt="" width="80" height="80"/></td> <td><?php echo str_replace('_', ' ', $flowername); ?> </td> <td><?php if (isset($_SESSION['color'][$flowername])) { echo getColor($_SESSION['color'][$flowername]); } else { echo ' '; } ?> </td> <td><?php echo $amount; ?> </td> <td>$<?php echo $cost = $amount * $price[$flowername]; $total += $cost; ?> </td> </tr>
$graph->title->SetFont(FF_SIMSUN, FS_BOLD); $graph->SetBox(false); $graph->ygrid->SetFill(false); $graph->yaxis->HideLine(false); $graph->yaxis->HideTicks(false, false); $graph->yaxis->HideZeroLabel(); $graph->yaxis->title->Set(iconv("UTF-8", "GB2312//IGNORE", "得分")); $graph->yaxis->title->SetFont(FF_SIMSUN, FS_BOLD); $graph->xaxis->SetTickLabels($X); $graph->xaxis->SetFont(FF_SIMSUN, FS_BOLD); $graph->xaxis->title->Set(iconv("UTF-8", "GB2312//IGNORE", "日期")); $graph->xaxis->title->SetFont(FF_SIMSUN, FS_BOLD); $i = 0; $p = new LinePlot($datas); $graph->Add($p); $color = getColor($i++); $p->mark->SetType(MARK_FILLEDCIRCLE, '', 1.0); $p->mark->SetColor($color); $p->mark->SetFillColor($color); $p->SetCenter(); $p->SetColor($color); $p->value->SetFormat('%d'); $p->value->Show(); $p->value->SetColor($color); $graph->Stroke(); exit; } else { die("No graph, please check your params!"); } } }
$tabla = "reclamos"; $id_proceso = "id_reclamo"; break; } $objDB->execute("SET lc_time_names = 'es_VE';"); $query = "SELECT nombre, count({$id_proceso}) AS total, id_usuario\n FROM {$tabla}\n INNER JOIN usuarios \n WHERE usuarios.id_usuario = {$tabla}.idusuario\n AND MONTHNAME(STR_TO_DATE(MONTH(fecha_registro), '%m'))='{$mes}'\n AND year = '{$year}' \n GROUP BY idusuario"; $rs = $objDB->getRecords($query); $rows = array(); $indice = 0; foreach ($rs as $data) { $total = $data['total']; $id_usuario = $data['id_usuario']; settype($total, int); settype($id_usuario, int); $indice = $indice + 1; $color = getColor($indice); array_push($rows, array("c" => array(array("v" => $data['nombre']), array("v" => $total), array("v" => $id_usuario), array("v" => $color)))); } if (isset($_GET['tipoProceso'])) { $tipo_proceso = $_GET['tipoProceso']; } $cols = array(array("label" => "Nombre", "type" => "string"), array("label" => "Total por funcionario", "type" => "number"), array("label" => "Id Usuario", "type" => "number"), array("type" => "string", "role" => "style")); //$rows = array(array("c"=>array(array("v"=>$tipo_proceso), array("v"=>$total))));//, // array("c"=>array(array("v"=>"Solicitudes"),array("v"=>$totSolicitudes))), // array("c"=>array(array("v"=>"Denuncias"),array("v"=>$totDenuncias))), // array("c"=>array(array("v"=>"Reclamos"),array("v"=>$totReclamos)))); $data = array("cols" => $cols, "rows" => $rows); echo json_encode($data); } ?>
function drawPath($myDoc, $name, $n, $weights) { global $doc, $SCALE, $dx, $dy; $path = $doc->createElement("path"); $myD = ""; if (isset($name) && $name != "") { $tree = $myDoc->getWeightedSubTree($name, $weights); } else { $tree = $myDoc->getWeightedTree($weights); } /*N $totalWeight = 0; for ($i=0; $i < count($tree); $i++) { $totalWeight = $totalWeight + $weights[$tree[$i]->name]; }*/ drawAxis(count($tree)); $angle = 0; for ($i = 0; $i < count($tree); $i++) { /*N $delta = $weights[$tree[$i]->name]*2*pi()/$totalWeight; $angle_text = $angle + $delta/2; $angle = $angle + $delta; drawSingleAxis($angle);*/ $myD .= $i == 0 ? "M" : "L"; //N: should be commented $angle = ($i + 1) * 2 * pi() / count($tree); $x = $tree[$i]->score * $SCALE * cos($angle); $x = $x + $dx; $y = $tree[$i]->score * $SCALE * sin($angle); $y = $y + $dy; $myD .= " {$x} {$y} "; //2.1 = 2 + 0.1 of padding before actual text display //N: drawText(2.1*$SCALE*cos($angle_text), 2.1*$SCALE*sin($angle_text), $tree[$i]); drawText(2.1 * $SCALE * cos($angle), 2.1 * $SCALE * sin($angle), $tree[$i]); } $myD .= "z"; $path->setAttribute("d", $myD); $path->setAttribute("fill", getColor($n)); $path->setAttribute("fill-opacity", "0.2"); $path->setAttribute("stroke-width", "3"); $path->setAttribute("stroke", getColor($n)); return $path; }
function BRIGHT($rgb, $mult = 1.5) { getRGB($rgb, $r, $g, $b); $darker = false; if ($mult < 0) { $darker = true; $mult = -$mult; } $a = round(($r - 128) * $mult - ($r - 128)); $ag = round(($g - 128) * $mult - ($g - 128)); $ab = round(($b - 128) * $mult - ($b - 128)); if (abs($ag) > abs($a)) { $a = $ag; } if (abs($ab) > abs($a)) { $a = $ab; } if ($darker) { $r = $r - $a; $g = $g - $a; $b = $b - $a; } else { $r = $r + $a; $g = $g + $a; $b = $b + $a; } $r = $r > 255 ? 255 : ($r < 0 ? 0 : $r); $g = $g > 255 ? 255 : ($g < 0 ? 0 : $g); $b = $b > 255 ? 255 : ($b < 0 ? 0 : $b); return getColor($r, $g, $b); }
<td><input class="style_input" type="text" id="wordColor" name="wordColor" value="<?php echo getColor("wordColor", "#000000"); ?> " /></td> </tr> <tr> <td class="style_title">边框颜色:</td> <td><input class="style_input" type="text" id="border" name="border" value="<?php echo getColor("border", "#C7C5B8"); ?> " /></td> </tr> <tr> <td class="style_title">横条颜色:</td> <td><input class="style_input" type="text" id="line" name="line" value="<?php echo getColor("line", "#FFFFFF"); ?> " /></td> </tr> <tr> <td colspan="2"><input type="submit" style="float:left;" class="submit_btn" value="保存" /> <a href="setting.php?reset=true" class="link_btn" style="float:left;" >恢复默认</a> </td> </tr> </table> </form> <?php } else { if ($type == 1) { ?>
} if ($process) { preg_match_all("/{[^{]*/", $s, $points); foreach ($points[0] as $point) { $point = rtrim($point); // remove possible trailing newline // 1: first half // 2: point ID // 3: P or L or '' // 4: second half // 5, 6, 7: x, y, z if (preg_match("/({([^}]*)} ?([PL])?)([^-0-9]*(-?[0-9]+\\.[0-9]*)[ ,]+(-?[0-9]+\\.[0-9]*)[ ,]+(-?[0-9]+\\.[0-9]*))/", $point, $parts)) { $x = $parts[5] + 0.0; $y = $parts[6] + 0.0; $z = $parts[7] + 0.0; $color = getColor($parts[2]); if ($hasPrev && $parts[3] != 'P') { fwrite($stdout, "{}U {$prevColor} " . ($x + $prevX) / 2.0 . " " . ($y + $prevY) / 2.0 . " " . ($z + $prevZ) / 2.0 . "\n"); fwrite($stdout, "{$parts['1']} {$color} {$parts['4']}\n"); } else { fwrite($stdout, $point . "\n"); } $hasPrev = TRUE; $prevX = $x; $prevY = $y; $prevZ = $z; $prevColor = $color; } } } else { fwrite($stdout, $s);
function GraphSonda($chart, $id_chart, $id_plan, $id_item, $from, $avg, $tag) { $offset = getOffset(); // setTimezone(); $dt = getDates($from); $index = 0; $average = getAverage($avg); $format = $average[0]; $divide = $average[1]; if ($divide == 60 * 60 * 6) { $offset = -60 * 60 * 2; } if ($divide == 60 * 60 * 12) { $offset = +60 * 60 * 4; } if ($divide == 60 * 60 * 24) { $offset = +60 * 60 * 4; } $colorIndex = 0; $ldata = loadRAWData($from, $id_plan, $id_item); $percentile = calculatePercentile($ldata['allData']); $div = $ldata['div']; if (isset($ldata['hostList'])) { foreach ($ldata['hostList'] as $host) { $id_host = $host['id_host']; $hostName = $host['host']; $nacD = $host['nacD']; $nacU = $host['nacU']; $critical = $host['critical']; $warning = $host['warning']; $nominal = $host['nominal']; if ($warning > 100) { $dir = 1; } else { $dir = 0; } if ($nominal == -1) { $nominal = $nacD; } if ($nominal == -2) { $nominal = $nacU; } unset($theSondaAvg); unset($theSondaQoE); unset($dataAvg); unset($dataQoE); if (isset($ldata['historyList'][$id_host])) { foreach ($ldata['historyList'][$id_host] as $key => $row) { $tk = round($row['clock'] / $divide, 0) * $divide; $skip = false; if (isset($_SESSION['filter']['P95']) && $row['value'] > $percentile['P95']) { $skip = true; } if (isset($_SESSION['filter']['P5']) && $row['value'] < $percentile['P5']) { $skip = true; } if (!$skip) { if (!isset($theSondaAvg[$tk])) { $theSondaAvg[$tk] = array($tk, 0, 0); } if (!isset($theSondaQoE[$tk])) { $theSondaQoE[$tk] = array($tk, 0, 0); } $sum = $theSondaAvg[$tk][1]; $cnt = $theSondaAvg[$tk][2]; $x = $sum + $row['value']; $y = $cnt + 1; $theSondaAvg[$tk] = array($tk, $x, $y); if ($row['value'] > $nominal) { $row['value'] = $nominal; } $sum = $theSondaQoE[$tk][1]; $cnt = $theSondaQoE[$tk][2]; $x = $sum + $row['value']; $y = $cnt + 1; $theSondaQoE[$tk] = array($tk, $x, $y); } } } if (isset($theSondaAvg)) { aasort($theSondaAvg, 0); $next = 0; $prev = 0; foreach ($theSondaAvg as $tvalue) { $next = $tvalue[0] + $offset; if ($prev > 0 && $next > 0 && $next - $prev > $divide * 2) { $dataAvg[] = array(($prev + 1000) * 1000, null); } $dataAvg[] = array($next * 1000, round($tvalue[1] / $tvalue[2] / $div, 2)); $prev = $next; } aasort($theSondaQoE, 0); $next = 0; $prev = 0; foreach ($theSondaQoE as $tvalue) { $next = $tvalue[0] + $offset; if ($prev > 0 && $next > 0 && $next - $prev > $divide * 2) { $dataQoE[] = array(($prev + 1000) * 1000, null); } $dataQoE[] = array($next * 1000, round($tvalue[1] / $tvalue[2] / $div, 2)); $prev = $next; } } if (isset($dataAvg)) { if (!isset($minClock)) { $minClock = $dataAvg[0][0]; $maxClock = $dataAvg[count($dataAvg) - 1][0]; } else { if ($dataAvg[0][0] < $minClock) { $minClock = $dataAvg[0][0]; } if ($dataAvg[count($dataAvg) - 2][0] > $maxClock) { $maxClock = $dataAvg[count($dataAvg) - 2][0]; } } if ($_GET['qoe'] == 'Average On' || $_GET['qoe'] == 'Both') { $chart->series[]->name = $hostName . "-AVG"; $chart->series[$index]->type = 'spline'; $chart->series[$index]->dashStyle = 'spline'; $chart->series[$index]->data = $dataAvg; $chart->series[$index]->color = getColor($colorIndex); $chart->series[$index]->lineWidth = 1; $chart->series[$index]->marker->radius = 2; $index++; } if ($_GET['qoe'] == 'QoE On' || $_GET['qoe'] == 'Both') { $chart->series[]->name = $hostName . '-QoE'; $chart->series[$index]->type = 'shortdot'; $chart->series[$index]->color = getColor($colorIndex); $chart->series[$index]->data = $dataQoE; $chart->series[$index]->lineWidth = 1; $chart->series[$index]->marker->radius = 2; $index++; } $colorIndex++; } } } $title = 'Sondas for "' . $ldata['item'] . '" on plan "' . $ldata['plan'] . '"'; $subtitle = 'From ' . $ldata['from'] . ' to ' . $ldata['to']; $chart = chartHeader($chart, $id_chart, $title, $subtitle, $ldata['unit'], null); if (!isset($minClock)) { $minClock = 0; $maxClock = 0; } $chart->xAxis->type = 'datetime'; $chart->tooltip->formatter = new HighchartJsExpr("\n function() {\n var s = '<b>'+ Highcharts.dateFormat('%e. %b %H:%M',this.x) +'</b>'; \n \$.each(this.points, function(i, point) {\n s += '<br/><span style=\"color:'+point.series.color+'\">'+ point.series.name +': '+ point.y +' " . $ldata['unit'] . "</span><b>';\n });\n return s;\n }"); echo "\n" . '<script> function redraw() { chart1.xAxis[0].setExtremes(' . $minClock . ', ' . (round($maxClock / (3600 * 24), 0) * 3600 * 24 + $divide * 1000) . ');} </script>'; //var_dump($chart->chart); return $chart; }
function createGraph($itemids, $name, $width, $height, $graphtype, $func, $drawtype, $yaxisside) { if (!$name) { error(_s('Warning. Incorrect value for field "%1$s"', '[name]')); return false; } if (!$graphtype) { $graphtype = 0; } if (!$width) { $width = 900; } if (!$height) { $height = 200; } // Check permissions if (!empty($itemids)) { $options = array('nodeids' => get_current_nodeid(true), 'itemids' => $itemids, 'filter' => array('flags' => array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)), 'webitems' => 1, 'editable' => 1, 'output' => API_OUTPUT_EXTEND); $items = API::Item()->get($options); $items = zbx_toHash($items, 'itemid'); foreach ($itemids as $inum => $itemid) { if (!isset($items[$itemid])) { access_deny(); } } } if (empty($items)) { info(_('Items required for graph')); return false; } else { $gitems = array(); $num = 0; foreach ($items as $inum => $item) { if ($item['value_type'] != ITEM_VALUE_TYPE_UINT64 && $item['value_type'] != ITEM_VALUE_TYPE_FLOAT) { info(_s('Cannot create graph for non-numeric item, skipping "%1$s"', $item['name'])); continue; } $gitem['itemid'] = $item['itemid']; $gitem['drawtype'] = $drawtype; $gitem['sortorder'] = $num; $gitem['color'] = getColor($num); $gitem['yaxisside'] = $yaxisside; $gitem['calc_fnc'] = $func; $gitem['type'] = 0; $gitems[] = $gitem; $num++; } $graph = array('name' => $name, 'width' => $width, 'height' => $height, 'ymin_type' => 0, 'ymax_type' => 0, 'yaxismin' => 0, 'yaxismax' => 0, 'ymin_itemid' => 0, 'ymax_itemid' => 0, 'show_work_period' => 1, 'show_triggers' => 1, 'graphtype' => $graphtype, 'show_legend' => 1, 'show_3d' => 0, 'percent_left' => 0, 'percent_right' => 0, 'gitems' => $gitems); $result = API::Graph()->create($graph); if ($result) { info(_('Graph added')); add_audit(AUDIT_ACTION_ADD, AUDIT_RESOURCE_GRAPH, 'Graph [' . $name . ']'); } else { info(_('Cannot add graph')); } } return $result; }
<?php echo $suiteName; ?> : <span class="badge"><?php echo count($suite['scenarios']); ?> scenarios</span> </h3> </div> <div class="panel-body"> <!-- Suite content --> <?php foreach ($suite['scenarios'] as $scenario) { ?> <div class="panel scenarios panel-<?php echo getColor($scenario['scenarioStatus']); ?> " style="border: 0px solid #fff"> <div class="panel-heading"> <h3 class="panel-title"> <span class="pull-left clickable scenario-collapse"> <i class="glyphicon clickable glyphicon-th-list"></i> </span> <?php echo " " . $scenario['name'] . " "; ?> <span class="pull-right"> <span class="badge"> time : <?php echo $scenario['time']; ?>
<?php include 'picmatch.php'; $pic = 'match.jpg'; $images = glob('images/*.jpg'); $matchs = array(); foreach ($images as $img) { $color1 = getColor($pic); $color2 = getColor($img); $matchs[floor(match($color1, $color2))] = $img; } krsort($matchs); echo '<img src="' . $pic . '" /><br>最相似的图片是:<hr>'; foreach ($matchs as $img) { echo '<img src="' . $img . '" />'; }
foreach ($arrData as $release => $versions) { $releaseExecCount = 0; $releaseBuildCount = 0; foreach ($versions[vers] as $version => $builds) { $versionExecCount = 0; foreach ($builds[blds] as $build => $runs) { $buildExecCount = 0; $pass = $fail = 0; foreach ($runs[run] as $scriptResultID => $execData) { $buildExecCount++; if ($execData[status] != "PASSED") { $fail++; } else { $pass++; } $arrData[$release][vers][$version][blds][$build][run][$scriptResultID][color] = getColor($execData[status]); } $versionExecCount += $buildExecCount; $arrData[$release][vers][$version][blds][$build][exec_count] = $buildExecCount; $arrData[$release][vers][$version][blds][$build][p] = $pass; $arrData[$release][vers][$version][blds][$build][f] = $fail; } $releaseExecCount += $versionExecCount; $releaseBuildCount += count($builds[blds]); $arrData[$release][vers][$version][exec_count] = $versionExecCount; $arrData[$release][vers][$version][build_count] = count($builds[blds]); } $arrData[$release][exec_count] = $releaseExecCount; $arrData[$release][build_count] = $releaseBuildCount; } $rs = mysql_query("select caseName from cases where caseID=" . $caseID);
die("-1"); } var_dump(json_decode($_GET['data'], true)); if ($data = json_decode($_GET['data'], true)) { getFileContent('./data/structure.json'); $clustering = $content; $data['_color'] = array(); $i = 0; foreach ($data as $key => $value) { $i++; foreach ($clustering['setup'] as $eachCluster) { if ($eachCluster['name'] == $key) { if ($eachCluster['type'] == 'choice') { for ($j = 0; $j < count($eachCluster['choice']); $j++) { if ($eachCluster['choice'][$j]['value'] == $value) { $data["_color"][md5($key)] = getColor($j + $i * 2); break; } } } break; } } } if ($connect->query("update shortcircuit_each_info set info='" . json_encode($data, JSON_UNESCAPED_UNICODE) . "' where hash='{$hash}'")) { die("ok"); } else { die($connect->error()); } } }
} echo '<th style="background-color:' . $colorArray[$colIndex] . '" title="region ' . ($group2region[$i] + 1) . '">' . $groups1[$i]['Chr'] . '<br />' . round($groups1[$i]['start']) . ' - ' . round($groups1[$i]['end']) . '</th>'; } ?> </tr> </thead> <tbody> <?php for ($j = 0; $j < sizeof($groups2); $j++) { $rowArray = array(); $boolNonEmpty = false; for ($i = 0; $i < sizeof($groups1); $i++) { if (in_array($j, $groupSynteny_ex12ex2[$i])) { $cnt2 = sizeof($groups2[$j]['loci']); $cnt1 = sizeof($groups1[$i]['loci']); $rowArray[$i] = '<td class="syn"' . getColor($cnt1 + $cnt2) . ' title="click for detail view">' . $cnt2 . ' : ' . $cnt1 . '</td>'; $boolNonEmpty = true; } else { $rowArray[$i] = '<td></td>'; } } //TODO: update "if" with an "else" that shows the user -> a row has been deleted! if ($boolNonEmpty) { echo '<tr><th>' . $groups2[$j]['Chr'] . '<br />' . round($groups2[$j]['start']) . ' - ' . round($groups2[$j]['end']) . '</th>'; echo implode("", $rowArray); echo "</tr>\n"; } } ?> </tbody> </table>
function processFile($category, $file) { echo "Processing {$file} in category {$category}.\n"; global $cat; global $col; global $argv; if ($argv[3] == 'nt') { $notail = true; } if ($argv[3] == 'ntw') { $notail = true; $wide = true; } $color = $col[$category]; @mkdir($category . '/'); $basecolorarr['r'] = hexdec(substr($color, 0, 2)); $basecolorarr['g'] = hexdec(substr($color, 2, 2)); $basecolorarr['b'] = hexdec(substr($color, 4, 2)); if (substr($file, -4, 4) != '.png') { echo "Not a png file.\n"; return; } $im = @imagecreatefrompng('src/' . $file); if (imagesx($im) != 32 || imagesy($im) != 37) { echo "File is wrong shape.\n"; return; } $dst_im = imagecreate(24, 24); imagecopy($dst_im, $im, 0, 0, 4, 14, 24, 24); $gs = true; $gs = true; $colors = array(); for ($i = 2; $i <= 22; $i++) { $colors[(string) getAverageColor($dst_im, 0, $i)]++; $colors[(string) getAverageColor($dst_im, 23, $i)]++; $colors[(string) getAverageColor($dst_im, $i, 0)]++; $colors[(string) getAverageColor($dst_im, $i, 23)]++; } /* $t = 2; $colors[(string)getAverageColor($dst_im, 0+$t, 0+$t)]++; $colors[(string)getAverageColor($dst_im, 23-$t, 0+$t)]++; $colors[(string)getAverageColor($dst_im, 0+$t, 23-$t)]++; $colors[(string)getAverageColor($dst_im, 23-$t, 23-$t)]++; */ arsort($colors); //print_r($colors); $color = array_shift(array_keys($colors)); //echo $color; $color = 1; //$maxsat = 0; //$minsat = 1; for ($y = 0; $y < 24; $y++) { for ($x = 0; $x < 24; $x++) { /* if($x + $y <= 1 || (23-$x) + $y <= 1 || $x + (23-$y) <= 1 || (23-$x) + (23-$y) <= 1) { $sat[$x][$y] = $color; $sat[$x][$y] = 0; } else { */ if ($gs) { $sat[$x][$y] = getAverageColor($dst_im, $x, $y); } else { $sat[$x][$y] = getColor($dst_im, $x, $y); } /* } */ //$maxsat = max($maxsat, $sat[$x][$y]); //$minsat = max($minsat, $sat[$x][$y]); } } $w = 32; if ($notail) { $h = 32; } else { $h = 37; } if ($wide) { $w = 240; $h = 28; } $gs_im = imagecreatetruecolor($w, $h); /* if($basecolor == 'default') { $primcolors = array(); for($i = 2; $i <= 22; $i++) { $primcolors[(string)getPrimaryColor($dst_im, 0, $i)]++; $primcolors[(string)getPrimaryColor($dst_im, 23, $i)]++; $primcolors[(string)getPrimaryColor($dst_im, $i, 0)]++; $primcolors[(string)getPrimaryColor($dst_im, $i, 23)]++; } arsort($primcolors); $primcolor = array_shift(array_keys($primcolors)); $primcolor = explode("/", $primcolor); $primcolor = pickColor($primcolor); $basecolorobj = imagecolorallocate($gs_im, $primcolor[0], $primcolor[1], $primcolor[2]); } else { */ $basecolorobj = imagecolorallocate($gs_im, $basecolorarr['r'], $basecolorarr['g'], $basecolorarr['b']); /* } */ imagealphablending($gs_im, false); imagefilledrectangle($gs_im, 0, 0, $w, $h, imagecolorallocatealpha($gs_im, 255, 255, 255, 127)); imagealphablending($gs_im, true); $markershape = array(1, 0, $w - 2, 0, $w - 1, 1, $w - 1, $h - 2, $w - 2, $h - 1, 1, $h - 1, 0, $h - 2, 0, 1); $markershape2 = array(20, 32, 16, 36, 15, 36, 11, 32); imagefilledpolygon($gs_im, $markershape, count($markershape) / 2, $basecolorobj); if (!$notail) { imagefilledpolygon($gs_im, $markershape2, count($markershape2) / 2, $basecolorobj); } if ($notail) { $stoph = $h - 2; $stopw = $w - 2; } else { $stoph = 30; $stopw = 30; } for ($i = 1; $i <= $stoph; $i++) { imageline($gs_im, 1, $i, $stopw, $i, imagecolorallocatealpha($gs_im, 0, 0, 0, 127 - $i)); } if (!$notail) { for ($i = 0; $i < 5; $i++) { imageline($gs_im, 11 + $i, 31 + $i, 20 - $i, 31 + $i, imagecolorallocatealpha($gs_im, 0, 0, 0, 127 - (31 + $i))); } } $border = imagecolorallocatealpha($gs_im, 0, 0, 0, 64); if (!$notail) { imageline($gs_im, 1, 0, 30, 0, $border); imageline($gs_im, 0, 1, 0, 30, $border); imageline($gs_im, 31, 1, 31, 30, $border); imageline($gs_im, 1, 31, 10, 31, $border); imageline($gs_im, 21, 31, 30, 31, $border); imageline($gs_im, 11, 32, 15, 36, $border); imageline($gs_im, 20, 32, 16, 36, $border); } else { imageline($gs_im, 1, 0, $w - 2, 0, $border); imageline($gs_im, 0, 1, 0, $h - 2, $border); imageline($gs_im, $w - 1, 1, $w - 1, $h - 2, $border); imageline($gs_im, 1, $h - 1, $w - 2, $h - 1, $border); } imagesavealpha($gs_im, true); if ($notail) { if ($wide) { imagepng($gs_im, $category . '/ntw.blank.png'); } else { imagepng($gs_im, $category . '/nt.blank.png'); } exit; } else { imagepng($gs_im, $category . '/blank.png'); } //print_r($sat); for ($y = 0; $y < 24; $y++) { for ($x = 0; $x < 24; $x++) { $level = max(0, min(127, round(127 * $sat[$x][$y] / $color, 0))); if (floor($level) <= 24 && floor($level) >= 16) { $level = 0; } if (floor($level) <= 44 && floor($level) >= 44 && ($x == 1 || $x == 22 || ($y == 1 || $y == 22))) { $level = 0; } if (floor($level) <= 73 && floor($level) >= 73 && (($x == 1 || $x == 22) && ($y == 1 || $y == 22))) { $level = 0; } imagesetpixel($gs_im, $x + 4, $y + 4, imagecolorallocatealpha($gs_im, 255, 255, 255, 127 - $level)); } } imagepng($gs_im, $category . '/' . $file); }
/** * Display the entry-type color key. This has up to 2 rows, up to 10 columns. * @param $area_id * * @return twig view rendered */ function show_colour_key($area_id) { global $twig; $tplArray = []; //echo '<table class="legende"><caption class="titre">Légendes des réservations</caption>'.PHP_EOL; $sql = 'SELECT DISTINCT t.id, t.type_name, t.type_letter FROM ' . TABLE_PREFIX . '_type_area t LEFT JOIN ' . TABLE_PREFIX . "_j_type_area j on j.id_type=t.id\n\tWHERE (j.id_area IS NULL or j.id_area != '" . $area_id . "')\n\tORDER BY t.order_display"; $res = grr_sql_query($sql); if ($res) { $countPrintableResult = 0; //$nct = -1; for ($i = 0; $row = grr_sql_row($res, $i); ++$i) { // La requête sql précédente laisse passer les cas où un type est non valide dans le domaine concerné ET au moins dans un autre domaine, d'où le test suivant $test = grr_sql_query1('SELECT id_type FROM ' . TABLE_PREFIX . "_j_type_area WHERE id_type = '" . $row[0] . "' and id_area='" . $area_id . "'"); if ($test == -1) { $tplArray['types'][$countPrintableResult]['name'] = $row[1]; //$type_name = $row[1]; //$type_letter = $row[2]; /*if ($nct == -1) { echo '<tr>'.PHP_EOL; } if (++$nct == 2) { $nct = 0; echo '</tr>'.PHP_EOL, '<tr>'.PHP_EOL; }*/ //tdcell($type_letter); $tplArray['types'][$countPrintableResult]['color'] = getColor($row[2]); /*echo $type_name, '</td>'.PHP_EOL;*/ /* incrénentation du nombre de résultats à afficher */ $countPrintableResult++; } } /*if ($i % 2 == 1) { echo '<td></td>',PHP_EOL,'</tr>'.PHP_EOL; } echo '</table>'.PHP_EOL;*/ return $twig->render('helpers/showColourKey.html.twig', $tplArray); } }
echo $title; ?> <?php echo SITE_NAME; ?> Twitese</title> <?php $headerBg = getColor("headerBg", "#DAD6C0"); $bodyBg = getColor("bodyBg", "#F5F3EC"); $sideBg = getColor("sideBg", "#F9F8F5"); $sideNavBg = getColor("sideNavBg", "#F4F4F4"); $linkColor = getColor("linkColor", "#3280AB"); $linkHColor = getColor("linkHColor", "#000000"); $wordColor = getColor("wordColor", "#000000"); $border = getColor("border", "#C7C5B8"); $line = getColor("line", "#FFFFFF"); ?> <style type="text/css"> #header{background-color:<?php echo $headerBg; ?> } #footer{background-color:<?php echo $headerBg; ?> } #sidebar{background-color:<?php echo $sideBg; ?> ;border-color:<?php echo $border;
function groupedGraph($chart, $item, $min, $max) { global $cmd; echo '<div class="col-xs-2"><select class="form-control" name="' . $item . '" id="' . $item . '">'; if (!isset($_POST[$item])) { $_POST[$item] = ''; echo '<option selected value="Select">Select</option>'; } else { echo '<option value="Select">Select</option>'; } $itemSelected = ''; $graphs = readGraphs(); foreach ($graphs as $graph) { if (isset($_POST) && $_POST[$item] == $graph['id_graph']) { echo '<option selected value="' . $graph['id_graph'] . '">' . $graph['name'] . '</option>'; $itemSelected = $graph['name']; } else { echo '<option value="' . $graph['id_graph'] . '">' . $graph['name'] . '</option>'; } } echo '</select></div>'; echo '<div class="col-xs-2"><select class="form-control" name="host" id="host">'; if (!isset($_POST['host'])) { $_POST['host'] = ''; echo '<option selected value="Select">Select</option>'; } else { echo '<option value="Select">Select</option>'; } $hostSelected = ''; $hosts = readHosts(0); foreach ($hosts as $host) { $thehost = $host['host']; if (isset($_POST['host']) && $_POST['host'] == $host['id_host']) { $hostSelected = $thehost; echo '<option selected value="' . $host['id_host'] . '">' . $thehost . '</option>'; } else { echo '<option value="' . $host['id_host'] . '">' . $thehost . '</option>'; } } echo '</select></div>'; $index = 0; $days = Days($_POST['date1'], $_POST['date2']); $divide = 1; $divide = getAverage($_POST['avg']); $divide = $divide[1]; if ($_POST['avg'] == "None") { $divideslot = 60 * 30; } else { $divideslot = $divide; } if (is_numeric($_POST['host'])) { $id_host = $_POST['host']; $col = 0; $monitors = readMonitorsForGraph($_POST[$item]); foreach ($monitors as $monitor) { $id_item = $monitor['id_item']; $rawData = loadRAWData($_POST['date1'], 0, $id_item, $_POST['date2'], $id_host); unset($data2); $prev = 0; $next = 0; $history = $rawData['historyList'][$id_host]; if (isset($history)) { $unit = $monitor['unit']; $div = 1; if ($unit == 'bps') { $div = 1024; //BGS011 $unit = 'Mbps'; } unset($finalData); foreach ($history as $ddata) { $tk = round($ddata['clock'] / $divide, 0) * $divide; if (!isset($finalData[$tk])) { $finalData[$tk] = array('clock' => $tk, 'sum' => 0, 'cnt' => 0); } $sum = $finalData[$tk]['sum']; $cnt = $finalData[$tk]['cnt']; $x = $sum + $ddata['value']; $y = $cnt + 1; $finalData[$tk] = array('clock' => $tk, 'sum' => $x, 'cnt' => $y); } foreach ($finalData as $row) { if (!isset($minClock)) { $minClock = $row['clock'] * 1000; $maxClock = $row['clock'] * 1000; } else { if ($minClock > $row['clock'] * 1000) { $minClock = $row['clock'] * 1000; } if ($maxClock < $row['clock'] * 1000) { $maxClock = $row['clock'] * 1000; } } $next = $row['clock']; if ($prev > 0 && $next > 0 && $next - $prev > $divideslot * 1.2) { $data2[] = array(($prev + 1000) * 1000, null); } $prev = $next; $v = null; if ($row['cnt'] != 0) { $v = round($row['sum'] / $row['cnt'] * 1 / $div, 2); } $data2[] = array($row['clock'] * 1000, $v * 1 / $div, 2); } $chart->series[]->name = $monitor['descriptionLong']; $chart->series[$index]->type = 'spline'; $chart->yAxis->title->text = $unit; $chart->series[$index]->color = getColor($col); $chart->series[$index]->data = $data2; $index++; $col++; } } } if (!isset($unit)) { $unit = ""; } $title = $hostSelected . ":" . $itemSelected; $subtitle = 'From ' . $_POST['date1'] . ' to ' . $_POST['date2']; $chart = chartHeader($chart, 'c_' . $item, $title, $subtitle, $unit, null); $chart->xAxis->type = 'datetime'; $chart->plotOptions->series->animation->complete = new HighchartJsExpr(" function () {redraw();}"); if (!isset($minClock)) { $minClock = 0; $maxClock = 0; } if (!isset($unit)) { $unit = ""; } $chart->tooltip->formatter = new HighchartJsExpr("\r\n function() {\r\n var s = '<b>'+ Highcharts.dateFormat('%e. %b %H:%M',this.x) +'</b>'; \r\n \$.each(this.points, function(i, point) {\r\n s += '<br/><span style=\"color:'+point.series.color+'\">'+ point.series.name +': '+ point.y +' " . $unit . "</span><b>';\r\n });\r\n return s;\r\n }"); //return array( 0 => $chart, 1 => $minClock , 2 => $maxClock); echo "\n" . '<script> function redraw() { chart1.xAxis[0].setExtremes(' . ($minClock - 60000) . ', ' . ($maxClock + 60000 * 5) . ');} </script>'; return $chart; }
<?php /* getColorTable(getColor($style)); */ ?> </select>--> </div> <div class="col-sm-offset-4 col-sm-3"> <div class="alert alert-info" style="width: auto;"> <label class="control-label"> <?php echo getUebersetzung("vorheriger Wert", $sprache, $link); ?> : </label> <?php echo getColor($style); ?> </div> </div> </div> <div class="row"> <hr> </div> <?php } ?> <?php if ($border == "1") { ?> <div class="row"> <div class="col-sm-2">
//echo '<img src="img_grr/scourrier.png" alt="courrier">'.PHP_EOL; $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['courrier'] = 'courrier'; } else { //echo '<br /><img src="img_grr/hourglass.png" alt="buzy">'.PHP_EOL; $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['courrier'] = 'buzy'; } } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['courrier'] = false; } //echo '</span>'.PHP_EOL; } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['accessFicheResa'] = false; //echo PHP_EOL.'<table class="table-header"><tr>'; //tdcell($d[$cday]['color'][$i]); $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['color'] = getColor($d[$cday]['color'][$i]); $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['color'] = getColor($d[$cday]['color'][$i]); /** * todo refacto duplicate entre les deux choix du if */ if ($d[$cday]['res'][$i] != '-') { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['empruntee'] = true; //echo '<img src="img_grr/buzy.png" alt="'.get_vocab('ressource actuellement empruntee').'" title="'.get_vocab('ressource actuellement empruntee').'" width="20" height="20" class="image" />'.PHP_EOL; } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['empruntee'] = false; } if (isset($d[$cday]['option_reser'][$i]) && $d[$cday]['option_reser'][$i] != -1) { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = utf8_strftime($dformat, $d[$cday]['option_reser'][$i]); //echo '<img src="img_grr/small_flag.png" alt="',get_vocab('reservation_a_confirmer_au_plus_tard_le'),'" title="',get_vocab('reservation_a_confirmer_au_plus_tard_le'),' ',time_date_string_jma($d[$cday]['option_reser'][$i], $dformat),'" width="20" height="20" class="image" />',PHP_EOL; } else { $tplArray['rooms'][$incrementRoomAccessible]['jours'][$k]['reservations'][$i]['aConfirmerAuPlusTard'] = false; }
</div> <form id="showTasks" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> <input type="hidden" name="u" id="u"> </form> <table class="hoursBarsChart hours" id="barChart1" style="display:none;"> <?php if (mysqli_num_rows($result5) > 0) { for ($i = 0; $i < count($user_name_temp); $i++) { $percent = getPercent($sum_tangible_hours[$i], $user_week_hrs_temp[$i]); $color = getColor($sum_tangible_hours[$i], $user_week_hrs_temp[$i]); $user_id_encode = $user_id_temp[$i]; if ($sum_tangible_hours[$i] > $user_week_hrs_temp[$i]) { $percent = getPercent($user_week_hrs_temp[$i] + 0.01, $user_week_hrs_temp[$i]); echo "<tr onclick='showTasksID({$user_id_encode})' style='cursor: hand;'><td>" . $user_name_temp[$i] . "</td>"; echo "<td style='text-align: right;'>" . $sum_tangible_hours[$i] . " tan" . "</td>"; echo "<td style='width: 40%;'>" . "<div style='border-radius: 10px; border: 1px solid; background: #FFF; height: 8px;'><div style='width: " . $percent . "%; background-color: " . $color . "; border-radius: 10px; height: 8px;'></div></div>" . "</td>"; echo "<td>" . $time_task[$i] . " tot" . "</td></tr>"; } else { echo "<tr onclick='showTasksID({$user_id_encode})' style='cursor: hand;'><td>" . $user_name_temp[$i] . "</td>"; echo "<td style='text-align: right;'>" . $sum_tangible_hours[$i] . " tan" . "</td>"; echo "<td style='width: 40%;'>" . "<div style='border-radius: 10px; border: 1px solid; background: #FFF; height: 8px;'><div style='width: " . $percent . "%; background-color: " . $color . "; border-radius: 10px; height: 8px;'></div></div>" . "</td>"; echo "<td>" . $time_task[$i] . " tot" . "</td></tr>"; } } }
//timeline-label } else { $interval = $date->diff($antFecha); $dif = $interval->format('%R%a'); if ($dif > 0) { $antFecha = $date; // timeline-label echo '<li class="time-label">'; echo '<span class="bg-light-blue">' . $dias[date_format($antFecha, 'w')] . " " . date_format($antFecha, 'd') . " de " . $meses[date_format($antFecha, 'n') - 1] . " del " . date_format($antFecha, 'Y') . '</span>'; echo '</li>'; //timeline-label } } echo '<li>'; $randNum = rand(2, 4); $randColor = getColor($randNum); echo '<i class="fa fa-user ' . $randColor . '"></i>'; echo '<div class="timeline-item">'; echo '<span class="time"> ' . date_format($date, "g:ia") . ' <i class="fa fa-clock-o"></i></span>'; echo '<h3 class="timeline-header no-border"><a href="#"> Estado del seguimiento: </a> ' . $row["DescripcionEstadoSeguimiento"] . ' </h3>'; echo '<div class="timeline-body">' . $row["Notas"] . '</div>'; echo '<div class="timeline-footer">'; echo '<span class="label label-primary">' . $row["DescripcionPrioridad"] . '</span>'; echo '</div>'; echo '</div>'; echo '</li>'; } ?> <!-- END timeline item --> </ul> </div><!-- /.col -->
$style = $language_data['STYLES']['NUMBERS'][0]; if ($style != null) { $styles['number'] = computeStyle($style); } // Get the escaped style $style = $language_data['STYLES']['ESCAPE_CHAR'][0]; if ($style != null) { $styles['escaped'] = computeStyle($style); } // Compute the styles element $xml .= "<l:styles>" . getLF($optimize); foreach ($styles as $id => $style) { $attributes = ""; $color = $style['color']; if (!is_null($color)) { $color = getColor($color); $attributes .= " color=\"{$color}\""; } $bold = $style['bold']; if (!is_null($bold)) { $attributes .= " bold=\"true\""; } $italic = $style['italic']; if (!is_null($italic)) { $attributes .= " italic=\"true\""; } $xml .= "<l:style element=\"{$id}\"{$attributes}/>" . getLF($optimize); } $xml .= "</l:styles>" . getLF($optimize); $xml .= "</l:language>" . getLF($optimize); // Write the XML file