{imp:"tools/a-lay"}<!--继承父模板-->

{block:extop}{:parent}<?php
$title = 'PHP印章制作DIY';
$indep = req('indep');
$ufix = surl()."?".$this->mkv;
$vfix = "<input name='mkv' type='hidden' value='$this->mkv'>";

$text = req('text','某某单位通用章','Title',15);
$dept = req('dept','_comm'); 
$name = req('name','无名人士','Title',8);
$spos = req('spos','cseal_tr');

$mcfg = read('indep'); 
$deps = "\n<select name='dept' class='w80'>".comTypes::getOpt($mcfg['i'],$dept)."<option value='c105' >分校(中心小学)</option></select>";
$posa = array('cseal_tl'=>'左上','cseal_tr'=>'右上','cseal_bl'=>'左下','cseal_br'=>'右下',);
$poso = "\n<select name='spos' class='w60'>".basElm::setOption($posa,$spos)."</select>";

$pclass = DIR_IMCAT.'/core/uext/exaCSeal.php';
$pfont = exaCSeal::$fpath;
if(!is_file(DIR_STATIC.$pfont)){
    $_dowurl = 'https://github.com/peacexie/imcat/raw/patches/excode/imp_files.rar';
    die("Please down the file `$pfont` <br>\nfrom `$_dowurl`<br>\n");
}

if($act=='CreatSeal'){
    $seal = new exaCSeal($text,75,18,16,40);
    $seal->doImg();    
}elseif(strstr($act,'down')){
    $path = strpos($act,'Class') ? $pclass : DIR_STATIC.$pfont;
    comHttp::downLoad($path, basename($path)); 
}
?>{/block:extop}

{block:eximp}
<?php
eimp('/views/umc/assets/cseal.css');
eimp('/views/umc/assets/cseal.js');
?>
{/block:eximp}

{block:exbody}
<div class="tools_outer">

<h3 class="tc"><?php echo $title;?></h3>
<?php 
if(in_array($spos,array('cseal_tl','cseal_tr'))){
    echo exaCSeal::show($dept,$name,$spos);
}
if(!file_exists(DIR_STATIC.$pfont.'')){
    echo "<div class='tools_cont'>字体文件：{static}".$pfont."不存在，<br>请见下方[代码/字体:下载]把字体文件下载放置站点相应位置。</div>";
} 
?>

<h4 class="tl">### PHP印章说明：</h4>
<p>PHP印章在线制作，用于在线办公，电子签名等场合。</p>
<p>为您电子办公又向前迈进小小的一步！</p>

<form action="<?php echo surl(); ?>" method="get"><?php echo $vfix; ?>
<h4 class="tl">### 系统印章展示：</h4>
<p>部门：<?php echo $deps; ?> &nbsp;
  姓名：<input name="name" type="text" class="w80" value="<?php echo $name; ?>"> <br>
  位置：<?php echo $poso; ?>
  <input name="act" type="submit" value="ShowSeal"></p>
<p>提示：如果挡住了文字，点一点，印章移开了……</p>
</form>

<form action="<?php echo surl(); ?>" method="get" target="_blank"><?php echo $vfix; ?>
<h4 class="tl">### 制作印章DIY：</h4>
<p>1.生成图片：文字：
    <input name="text" type="text" class="w12" value="<?php echo $text; ?>">
  <input name="act" type="submit" value="CreatSeal"></p>
<p>2. HTML代码：如下代码，
<textarea cols="60" rows="2" style="width:100%;">&lt;p class='cseal_out'><i class='cseal_in {pos}' style='background-image:url({img})'><b class='cseal_text'>{name}</b></i>;&lt;/p&gt;</textarea>
把{pos}，{img}，{name}分别替换为样式类名，图片地址，签名文字即可
</p>
<p>3. CSS代码：见本文html源码的相关cseal.css文件</p>
<p>4. 生成的印章图片，按[{static}/icons/indep/seal-{depid}.png]方式命名保存，其中{depid}代表部门id，即扩充集成到了本系统“<?php echo $_cbase['sys_name']; ?>”。</p>
</form>

<h4 class="tl">### 印章演示连接：</h4>
<p><a href='{=$ufix}'>默认印章</a>
* <a href='{=$ufix}&dept=inadm&name=张冠李戴&spos=cseal_tr'>右上印章</a>
* <a href='{=$ufix}&dept=intech&name=技术总监&spos=cseal_bl'>左下印章</a>
* <a href='{=$ufix}&dept=inpro&name=王课长&spos=cseal_tl'>左上印章</a>

<h4 class="tl">### 代码/字体:下载：</h4>
<p>类库：<a href="{=$ufix}&act=downClass">downClass : exaCSeal.php</a></p>
<p>字体：<a href="{=$ufix}&act=downFonts">downFonts : simkai.ttf</a></p>

<h4 class="tl">### 原作者信息/鸣谢：</h4>
<p>
 * 中文圆形印章类<br>
 * @author lkk/lianq.net<br>
 * @create on 10:03 2012-5-29<br>
 * @整理/整合 by Peace（QQ:8089-3510 , E-mail:xpigeon#163.com）<br>
</p>

<?php 
if(in_array($spos,array('cseal_bl','cseal_br'))){
    echo exaCSeal::show($dept,$name,$spos);
}
$_cbase['tpl']['tplpend'] = "//\n";
?>
    
</div>
{/block:exbody}

