php模块流程图,画出一个简单的流程图

画出一个简单的流程图<?php

$shuZhu=array(array("经理1","经理2"),array("主管1","主管2","经理3"),array("组长","老大"));

$fontPosition='simhei.ttf';

class process

{

var $arr;//流程确定的数组

var $promoters;//流程发起人

var $black;//所画节点颜色

var $imgWidth;//图片宽度

var $imgHeight;//图片长度

var $font;//字体存放位置

var $fontSize;

function __construct($shuZhu,$fontP,$width=400,$height=300,$fontSize=10,$promoters="")

{

$this->arr=$shuZhu;

$this->promoters=$promoters;

$this->font = $fontP;

$this->imgWidth=$width;

$this->imgHeight=$height;

$this->fontSize=$fontSize;

}

//point(x1,x2)是画图的起始点,w是横线的长,h是竖线的长,r是节点圆点的半径

function show( $x,$y,$w,$h,$r)

{

//创建画布

$image=imagecreatetruecolor($this->imgWidth,$this->imgHeight);

//设置图像中所需的颜色

$gray=imagecolorallocate($image,0xc0,0xC0,0xC0);

$red=imagecolorallocate($image,0xFF,0x00,0x00);

$black=imagecolorallocate($image,0x00,0x00,0x00);

imagefill($image,0,0,$gray);

imageline($image,$x,$y,$x+$w,$y,$red);//画第一条横线线

imagefilledellipse($image, $x,$y, $r,$r, $black);//画出发起人的节点

imagettftext($image,$this->fontSize, 0, $x-$w/4,$y+$w/2, $black, $this->font,$this->promoters);

for($i=0;$iarr);$i++)

{

$num=count($this->arr[$i]);//该级接点上有多少人

if($num>1)//节点上的人数多于一人,则先画一条竖线

{

imageline($image,$x+$w*($i+1),$y-$h/2,$x+$w*($i+1),$y+$h/2,$red);

}

for($j=0;$jarr[$i]);$j++)

{

if($num>1)

{

$m=$h/($num-1);//一个节点上有count[$arr[i]]个人,则$m代表截取竖线的长度

imageline($image,$x+$w*($i+1),$y-$h/2+$m*$j,$x+$w*($i+2),$y,$red);

imagefilledellipse($image, $x+$w*($i+1),$y-$h/2+$m*$j, $r,$r, $black);

//imagestring($image,2,$x+$w*($i+1)-10,$y-$h/2+$m*$j+5,$this->arr[$i][$j],$black);//直接输出接点上的人员名称

imagettftext($image, $this->fontSize, 0, $x+$w*($i+1)-$w/4,$y-$h/2+$m*$j+$w/2, $black, $this->font, $this->arr[$i][$j]);

}

else

{

imageline($image,$x+$w*($i+1),$y,$x+$w*($i+2),$y,$red);//画一条横线

imagefilledellipse($image, $x+$w*($i+1),$y, $r,$r, $black);

//imagestring($image,2,$x+$w*($i+1),$y,$this->arr[$i][0],$black);//直接输出接点上的人员名称

imagettftext($image,$this->fontSize, 0, $x+$w*($i+1)-$w/4,$y+$w/2, $black, $this->font,$this->arr[$i][0]);

}

}

}

header('Content-type:image/png');

imagepng($image);

imagedestroy($image);

}

}

$img=new process($shuZhu,$fontPosition,600,300,10,"董事长");

$img->show(10,150,50,200,8);

?>

以上就是画出一个简单的流程图的内容,更多相关内容请关注PHP中文网(www.php.cn)!

相关标签:流程图

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值