Библиотека для cis, online, cms1
This commit is contained in:
commit
3c2e614d87
269 changed files with 39854 additions and 0 deletions
52
core/formats/dot.php
Normal file
52
core/formats/dot.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Ãåíåðàöèÿ ôàéëîâ Grpahviz dot
|
||||
*/
|
||||
class Dot
|
||||
{
|
||||
static function getHeader ()
|
||||
{
|
||||
$header =
|
||||
"digraph G {\n"
|
||||
. "\toverlap=false; splines=true;\n"
|
||||
. "\tfontname = \"Verdana\"\n"
|
||||
. "\tfontsize = 8\n"
|
||||
. "\tnode [\n"
|
||||
. "\t\tfontname = \"Verdana\"\n"
|
||||
. "\t\tfontsize = 8\n"
|
||||
. "\t\tshape = \"record\"\n"
|
||||
. "\t]\n"
|
||||
. "\tedge [\n"
|
||||
. "\t\tfontname = \"Verdana\"\n"
|
||||
. "\t\tfontsize = 8\n"
|
||||
. "\t]\n";
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
static function getFooter ()
|
||||
{
|
||||
$footer = "}\n";
|
||||
return $footer;
|
||||
}
|
||||
|
||||
function assocToDot (array $array, array $label)
|
||||
{
|
||||
$result = array (self::getHeader());
|
||||
// Ìåòêè
|
||||
foreach ($label as $value) {
|
||||
$result [] = "\t\"{$value[0]}\" [ label = \"{$value[1]}\" ] \n";
|
||||
}
|
||||
// Àññîöèàöèè
|
||||
foreach ($array as $key => $value) {
|
||||
foreach ($value as $n) {
|
||||
$result [] = "\t\"$key\" -> \"$n\"\n";
|
||||
}
|
||||
}
|
||||
$result [] = self::getFooter();
|
||||
return implode("", $result);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue