<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="themes/jquery/css/themes/default/jquery.mobile-1.4.5.min.css">
	<link rel="stylesheet" href="themes/home/css/fonts/font-awesome.min.css">
    <link rel="stylesheet" href="themes/home/css/ui-box.css">
    <link rel="stylesheet" href="themes/home/css/ui-base.css">
    <link rel="stylesheet" href="themes/home/css/ui-color.css">
    <link rel="stylesheet" href="themes/home/css/icon.css">
    <link rel="stylesheet" href="themes/home/css/control.css">
    <link rel="stylesheet" href="themes/home/css/main.css">
	<script src="themes/jquery/js/jquery.js"></script>
	<script src="themes/jquery/js/jquery.mobile-1.4.5.min.js"></script>
</head>
<body class="um-vp c-wh " ontouchstart>
	<div data-role="page" data-quicklinks="true" class="ub ub-ver ">
      <div data-role="header" id="header" data-position="fixed" data-fullscreen="true" data-tap-toggle="false" >
	  <div class="uh bc-text-head ub bc-head">
                <div class="nav-btn" id="nav-left" onClick="javascript:window.location='index.php?ac=workclass&fileurl=plugin'">
                    <div class="fa fa-angle-left fa-2x"></div>
                </div>
                <h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0">流程发起</h1>
				
                <div class="nav-btn nav-bt" id="nav-right">
                    <!--<div class="ub-img icon-edit umw2 umh4"></div> --> 
                </div>
				
       </div>
	  
</div>
		<!-- /header -->
  <div data-role="content" id="content">
		<!--<div style="padding-left:5px; padding-right:5px;"> -->
			<div class="uinn-a7" style="margin-bottom:20px;">
            <div class="ub ub-ver">
				<?
				foreach ( $_CACHE['workclass_type'] as $row) {
				?>
                <div class="t-gra-9f ulev-4 uinn-na">
                    <?php echo $row["typename"]?>
                </div>
                <div class="ubt ubl ubr bc-border c-wh uc-a1">
					<ul>
						<?php 
						$query = $db->query("SELECT * FROM ".DB_TABLEPRE."workclass_template where  tplkey!='2'  and typeid='".$row["tid"]."' ORDER BY tplid Asc");
						while ($trow = $db->fetch_array($query)) {
						if($trow['tpluser']!='' && $trow['tpluser']!='0'){
							if($trow['tplusertype']=='2'){
								$html=',';
								$tpluser=explode(',',$trow['tpluser']);
								for($i=0;$i<sizeof($tpluser);$i++){
									$sqluser = "SELECT b.name FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b where a.id=b.uid and  a.positionid like '%,".trim($tpluser[$i]).",%'  ORDER BY b.uid desc";
									$rowuserresult = $db->fetch_all($sqluser);
									foreach ($rowuserresult as $rowuser1) {
										if($rowuser1['name']!=''){
											$html.=$rowuser1['name'].',';
										}
									}
								}
								$tpluser1=$html;
							}elseif($trow['tplusertype']=='3'){
								$html=',';
								$tpluser=explode(',',$trow['tpluser']);
								for($i=0;$i<sizeof($tpluser);$i++){
									$sqluser = "SELECT b.name FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b where a.id=b.uid and  a.departmentid like '%,".trim($tpluser[$i]).",%'  ORDER BY b.uid desc";
									$rowuserresult = $db->fetch_all($sqluser);
									foreach ($rowuserresult as $rowuser1) {
										if($rowuser1['name']!=''){
											$html.=$rowuser1['name'].',';
										}
									}
								}
								$tpluser1=$html;
							}else{
								$tpluser1=','.$trow['tpluser'].',';
							}
						}else{
							$tpluser1='0';
						}
						if(sizeof(explode(get_realname($_USER->id),$tpluser1))>1 || $tpluser1=='0'){
						?>
						<li class="ubb ub bc-border t-bla ub-ac lis" data-index="0" onClick="javascript:window.location='index.php?ac=workadd&fileurl=plugin&typeid=<?php echo $trow[typeid]?>&tplid=<?php echo $trow[tplid]?>'">
							<ul class="ub-f1 ub ub-pj ub-ac">
								<ul class="ub-f1 ub ub-ver marg-l">
									<li class="bc-text ub ub-ver ut-m line1"><?php echo $trow['title']?></li>
								</ul>
								<li class="fa fa-angle-right ulev2"></li>
							</ul>
						</li>
						<?php }
						}
						?>
					</ul>
                </div>
			 <?php }?>
            </div>
        </div>
		<!--</div> -->
  </div>
</div><!-- /page -->
 <script type="text/javascript"> 
    window.onload = function(){ 
        var heg=document.getElementById("header").offsetHeight;
		var content=document.getElementById("content"); 
		content.style.cssText="margin-top:"+heg+"px;";
    }
</script> 
</body>
</html>
