SProjectController.php 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. <?php
  2. Doo::loadClass('auth');
  3. Doo::loadClass('attfile');
  4. Doo::loadClass('profile');
  5. Doo::loadClass('project');
  6. Doo::loadClass('contractact');
  7. Doo::loadClass('actmeasure');
  8. Doo::loadClass('numofperact');
  9. Doo::loadClass('measureauditact');
  10. Doo::loadClass('itemmeasurenum');
  11. Doo::loadClass('itemfile');
  12. Doo::loadClass('attachment');
  13. Doo::loadHelper('DooPager');
  14. Doo::loadClass('sign');
  15. Doo::loadModelAt('aconfig', 'admin');
  16. /**
  17. * MainController
  18. * Feel free to delete the methods and replace them with your own code.
  19. *
  20. * @author darkredz
  21. */
  22. class SProjectController extends DooController
  23. {
  24. private $aconfig,$data, $sign, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $measureauditact, $itemmeasurenum, $itemfle, $att;
  25. public function beforeRun($resource, $action)
  26. {
  27. // $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  28. // $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  29. // if (!$falg)
  30. // return Doo::acl()->defaultFailedRoute;
  31. if ($this->auth->getUid()) {
  32. $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  33. $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  34. if (!$falg)
  35. return Doo::acl()->defaultFailedRoute;
  36. } else {
  37. return Doo::acl()->defaultFailedRoute;
  38. }
  39. }
  40. public function __construct()
  41. {
  42. $this->aconfig = new AConfig();
  43. $this->auth = new Auth();
  44. $this->attfile = new attFile();
  45. $this->profile = new Profile();
  46. $this->project = new Project();
  47. $this->contractact = new Contractact();
  48. $this->actmeasure = new actMeasure();
  49. $this->numofperact = new NumofperAct();
  50. $this->measureauditact = new MeasureauditAct();
  51. $this->itemmeasurenum = new ItemMeasureNumpofper();
  52. $this->itemfle = new ItemFile();
  53. $this->att = new attachment();
  54. $this->sign = new Signn();
  55. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  56. $this->data['currChannle'] = 's';
  57. $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
  58. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  59. if (isset($mpidArray[0]['pid'])) {
  60. $this->data['numofchecking'] = 0;
  61. foreach ($mpidArray as $key => $value) {
  62. // 审批操作按照时间排序多标段
  63. $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
  64. }
  65. }
  66. if (!isset($this->data['numofchecking']) || $this->data['numofchecking'] == 0) {
  67. $this->data['numofchecking'] = null;
  68. }
  69. $this->data['signSwitch'] = $this->aconfig->getOne(array('select' => 'signswitch', 'asArray' => TRUE))['signswitch'];
  70. //获取需要您签署的数目
  71. if($this->data['signSwitch'] > 0)
  72. $this->data['needSignNum'] = $this->sign->getNeedSignNumbyUid($this->auth->getUid()) != 0 ? $this->sign->getNeedSignNumbyUid($this->auth->getUid()) : '';
  73. //获取桌面版本
  74. $this->getsoftware();
  75. //草图入口
  76. $this->data['imediateSwitch'] = $this->aconfig->getOne(array('select' => 'imediateswitch', 'asArray' => TRUE))['imediateswitch'];
  77. }
  78. function getsoftware(){
  79. $StrJson = ($this->aconfig->getOne(array('select' => 'upgradeinfo', 'asArray' => TRUE))['upgradeinfo']);
  80. $upgradeinfo = json_decode($StrJson, true);
  81. if ($upgradeinfo) {
  82. $this->data['version'] = $upgradeinfo['version'];
  83. $this->data['download'] = $upgradeinfo['download'];
  84. }
  85. }
  86. public function index()
  87. {
  88. $this->data['conArray'] = NULL;
  89. $conArray = $this->actmeasure->getGroupProject($this->auth->getUid());
  90. if (isset($conArray)) {
  91. foreach ($conArray as $k => $v) {
  92. $proArray = $this->project->getRowByPid($v['pid']);
  93. $this->data['conArray'][] = $proArray;
  94. $profileArray = $this->profile->getProWithUid($proArray['uid']);
  95. $this->data['conArray'][$k]['company'] = $profileArray['company'];
  96. $countMeasureInt = $this->actmeasure->getCountMeasure($v['stid']);
  97. $countTotalMeasureInt = $this->actmeasure->getMearsureCount($v['pid']);
  98. $this->data['conArray'][$k]['countmeasure'] = $countMeasureInt;
  99. $this->data['conArray'][$k]['countTotalMeasureInt'] = $countTotalMeasureInt;
  100. $this->data['conArray'][$k]['changTotal'] = $this->numofperact->getChangTotal($v['pid']);
  101. $this->data['conArray'][$k]['currdone'] = $this->numofperact->getCurrDoneNow($v['pid']);
  102. $this->data['conArray'][$k]['contracttotal'] = $this->actmeasure->getTotalWithPid($v['pid']);
  103. if ($this->data['conArray'][$k]['contracttotal']) {
  104. $this->data['conArray'][$k]['pcurrdone'] = round(($this->data['conArray'][$k]['currdone'] / $this->data['conArray'][$k]['contracttotal']) * 100) . '%';
  105. } else {
  106. $this->data['conArray'][$k]['pcurrdone'] = '0%';
  107. }
  108. $this->data['conArray'][$k]['bcontracttotal'] = number_format($this->data['conArray'][$k]['contracttotal'], 2, '.', ',');
  109. $this->data['conArray'][$k]['bchangTotal'] = number_format($this->data['conArray'][$k]['changTotal'], 2, '.', ',');
  110. $this->data['conArray'][$k]['index'] = $k%8+1;
  111. }
  112. }
  113. $this->render('s-project', $this->data, TRUE);
  114. }
  115. public function proOverview()
  116. {
  117. // $this->data['pros'] = $this->project->getAll();
  118. // if (isset($_POST['pname']) && $_POST['pname']) {
  119. // $this->project->insertProject($_POST['pname']);
  120. // return Doo::conf()->APP_URL . 'project/index';
  121. // }
  122. $this->data['pid'] = $this->params['pid'];
  123. $this->render('w-project-detail', $this->data);
  124. }
  125. public function proSection()
  126. {
  127. $proArray = $this->actmeasure->getGroupProject($this->auth->getUid());
  128. foreach ($proArray as $v) {
  129. $pidArray[] = $v['pid'];
  130. }
  131. $pidstr = implode(',', $pidArray);
  132. // 项目名称
  133. $this->data['allproArray'] = $this->project->getFewRow($pidstr);
  134. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  135. // 标段按月进度
  136. // for ($i = 1; $i <= 7; $i++) {
  137. // $monthz[] = date('n月', strtotime('+' . $i . ' months', $this->data['currproArray']['intime']));
  138. // if ($i == 1) {
  139. // $ii = date('Y年', $this->data['currproArray']['intime']) . date('n月', strtotime('+' . $i . ' months', $this->data['currproArray']['intime']));
  140. // } else {
  141. // $ii = date('n月', strtotime('+' . $i . ' months', $this->data['currproArray']['intime']));
  142. // }
  143. // $this->data['months'][$i]['month'] = $ii;
  144. // }
  145. // 标段
  146. // 搜索有没有相应的月份,有就把实际赋值,没有就为零
  147. $this->data['MeasureArray'] = $this->actmeasure->getRowsByPid($this->params['pid']);
  148. $totalstid = 0;
  149. $monthArray = [];
  150. foreach ($this->data['MeasureArray'] as $key => $value) {
  151. $this->data['MeasureArray'][$key]['pmid'] = $value['pmid'];
  152. $this->data['MeasureArray'][$key]['type'] = $this->contractact->getRowByStid($value['stid'])['stname'];
  153. $totalstid += $this->actmeasure->getTotal($value['stid'])['total'];
  154. // $numArray = $this->numofperact->getRowByPmid2($value['pmid']);
  155. // $num = $num1 = 0;
  156. // $this->data['MeasureArray'][$key]['num'] = $this->data['MeasureArray'][$key]['num1'] = NULL;
  157. // foreach ($numArray as $k => $v) {
  158. // if ($v['currstatus'] == 'checked') {
  159. // $monthInt = date('n月', $v['audittime']);
  160. // $retval = in_array($monthInt, $monthz);
  161. // if ($retval) {
  162. // $num = round(($v['currdone'] / $value['contracttotal']) * 100);
  163. // $num1 = round(($v['curralltotal'] / $value['contracttotal']) * 100);
  164. // }
  165. // }
  166. // $this->data['MeasureArray'][$key]['num'] .= $num . ',';
  167. // $this->data['MeasureArray'][$key]['num1'] .= $num1 . ',';
  168. // }
  169. $this->data['MeasureArray'][$key]['totalnum'] = $this->numofperact->getCountTotalnum($value['pmid']);
  170. $this->data['MeasureArray'][$key]['totalplus'] = number_format($this->actmeasure->getRowByPmid($value['pmid'])['contracttotal'], 2, '.', ',');
  171. $this->data['MeasureArray'][$key]['stopnow'] = $this->numofperact->getStopNowTotal($value['pmid'])['sntotal'];
  172. $this->data['MeasureArray'][$key]['nstopnow'] = number_format($this->numofperact->getStopNowTotal($value['pmid'])['sntotal'], 2, '.', ',');
  173. $this->data['MeasureArray'][$key]['currdone'] = $this->numofperact->getCurrdoneNew($value['pmid'])['currtotal'];
  174. $this->data['MeasureArray'][$key]['ncurrdone'] = number_format($this->data['MeasureArray'][$key]['currdone'], 2, '.', ',');
  175. $this->data['MeasureArray'][$key]['pstopnow'] = '0%';
  176. $this->data['MeasureArray'][$key]['pcurrdone'] = '0%';
  177. $this->data['MeasureArray'][$key]['pless'] = '0%';
  178. if ($value['contracttotal'] > 0) {
  179. $this->data['MeasureArray'][$key]['pstopnow'] = round(($this->data['MeasureArray'][$key]['stopnow'] / $value['contracttotal']) * 100);
  180. $this->data['MeasureArray'][$key]['dispstopnow'] = $this->data['MeasureArray'][$key]['pstopnow'] . '%';
  181. $this->data['MeasureArray'][$key]['pcurrdone'] = round(($this->data['MeasureArray'][$key]['currdone'] / $value['contracttotal']) * 100);
  182. $this->data['MeasureArray'][$key]['dispcurrdone'] = $this->data['MeasureArray'][$key]['pcurrdone'] . '%';
  183. $this->data['MeasureArray'][$key]['pless'] = (100 - $this->data['MeasureArray'][$key]['pstopnow'] - $this->data['MeasureArray'][$key]['pcurrdone']) . '%';
  184. }
  185. $this->data['MeasureArray'][$key]['nless'] = number_format($value['contracttotal'] - $this->data['MeasureArray'][$key]['stopnow'] - $this->data['MeasureArray'][$key]['currdone'], 2, '.', ',');
  186. $tenderArray = $this->numofperact->getRowTender2($value['pmid']);
  187. $this->data['MeasureArray'][$key]['ownstatus'] = '审批中';
  188. $ownerStatusArray = $this->measureauditact->getStatusTen($tenderArray['pmid'], $tenderArray['numpname']);
  189. if (isset($ownerStatusArray[0]['last']) && isset($ownerStatusArray[0]['mastatus']))
  190. if (($ownerStatusArray[0]['last'] == 1) && ($ownerStatusArray[0]['mastatus'] == 'checked')) {
  191. $this->data['MeasureArray'][$key]['ownstatus'] = '已审批';
  192. } else {
  193. $this->data['MeasureArray'][$key]['ownstatus'] = '审批中';
  194. }
  195. // 分组出年月 每个月份的独立相加 累计完成总量
  196. $month = $this->numofperact->getCurrTotalStMonthNoCheckno($value['stid']);
  197. foreach ($month as $k => $v) {
  198. $allmonth[] = $v;
  199. if (!in_array($v['month'], $monthArray))
  200. $monthArray[] = $v['month'];
  201. }
  202. // 分组出年月 每个月份的独立相加 本月完成总量
  203. $month1 = $this->numofperact->getCurrDoneStMonthNoCheckno($value['stid']);
  204. foreach ($month1 as $k => $v) {
  205. $allmonth1[] = $v;
  206. }
  207. }
  208. // 中文表述年月
  209. $total = $total1 = array();
  210. $startyear = $cnymArray = array();
  211. foreach ($monthArray as $kk => $vv) {
  212. $ymarray = explode('-', $vv);
  213. if (!in_array($ymarray[0], $startyear))
  214. $startyear[] = $ymarray[0];
  215. }
  216. $thismonth = 0;
  217. foreach($startyear as $sk => $sv){
  218. for($i = 1; $i <= 12; $i++){
  219. $j = $i < 10 ? '0'.$i : $i;
  220. $month = $sv.'-'.$j;
  221. $thismonth1 = 0;
  222. foreach ($allmonth1 as $k1 => $v1) {
  223. if ($v1['month'] == $month)
  224. $thismonth1 += $v1['currdone'];
  225. }
  226. $total1[] = $thismonth1 != 0 ? $thismonth1 : 0;
  227. foreach ($allmonth as $keyk => $valuev) {
  228. if ($valuev['month'] == $month)
  229. $thismonth += $valuev['currtotal'];
  230. }
  231. $total[] = ($thismonth != 0 && $thismonth1 != 0) ? $thismonth : 0;
  232. $cnymArray[] = $i == 1 ? '\'' .$sv.'年'.$i.'月'. '\'' : '\'' .$i.'月'. '\'';
  233. }
  234. }
  235. foreach ($total as $value2) {
  236. $total3[] = round(($value2 / $totalstid) * 100);
  237. }
  238. foreach ($total1 as $value11) {
  239. $total4[] = round(($value11 / $totalstid) * 100);
  240. }
  241. $this->data['projectDate'] = implode(',', $cnymArray);
  242. $this->data['t1'] = implode(',', $total3);
  243. $this->data['t2'] = implode(',', $total4);
  244. $this->render('s-project-section', $this->data, TRUE);
  245. }
  246. public function proDetail()
  247. {
  248. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  249. $proArray = $this->actmeasure->getGroupProject($this->auth->getUid());
  250. foreach ($proArray as $v) {
  251. $pidArray[] = $v['pid'];
  252. }
  253. $pidstr = implode(',', $pidArray);
  254. // 项目名称
  255. $allproArray = $this->project->getFewRow($pidstr);
  256. // 面包屑导航项目
  257. foreach ($allproArray as $kk => $vv) {
  258. if ($vv['pid'] == $this->params['pid']) {
  259. $this->data['currproArray'] = $vv;
  260. } else {
  261. $this->data['allproArray'][] = $vv;
  262. }
  263. }
  264. // 面包屑导航合同
  265. $conArray = $this->contractact->getAll();
  266. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  267. if (isset($measureArray['stid'])) {
  268. foreach ($conArray as $kkk => $vvv) {
  269. if ($vvv['stid'] == $measureArray['stid']) {
  270. $this->data['currconArray'] = $vvv;
  271. } else {
  272. if ($vvv['pid'] == $this->params['pid'])
  273. $this->data['allconArray'][] = $vvv;
  274. }
  275. }
  276. } else {
  277. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  278. }
  279. // 面包屑导航标段
  280. $this->data['curractmeasureArray'] = NULL;
  281. $this->data['allactmeasureArray'] = [];
  282. $actmeasureArray = $this->actmeasure->getAll();
  283. foreach ($actmeasureArray as $kkkk => $vvvv) {
  284. if ($vvvv['stid'] == $measureArray['stid']) {
  285. if (($vvvv['pmid'] == $this->params['pmid'])) {
  286. $this->data['curractmeasureArray'] = $vvvv;
  287. } else {
  288. $this->data['allactmeasureArray'][] = $vvvv;
  289. }
  290. }
  291. }
  292. // 图标
  293. $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']);
  294. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  295. foreach ($this->data['MeasureArray'] as $key => $value) {
  296. if ($value['currdone'] > 0 && $measureArray['contracttotal'] > $value['currdone']) {
  297. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  298. } else {
  299. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  300. }
  301. }
  302. $this->data['pid'] = $this->params['pid'];
  303. $this->data['pmid'] = $this->params['pmid'];
  304. // 获取当前合同段的期数
  305. // $this->data['allNumArray'] = $this->numofperact->getNumByStid(1);
  306. $this->render('s-project-section-detail', $this->data, TRUE);
  307. }
  308. public function proMeasure()
  309. {
  310. $MpidArray = $this->measureauditact->getRowByMpid(1);
  311. foreach ($MpidArray as $key => $value) {
  312. $uidArray = $value['uid'];
  313. }
  314. $this->data['pid'] = $this->params['pid'];
  315. $this->render('s-project-section-measure', $this->data);
  316. }
  317. Function fNumber($number)
  318. {
  319. if ($number == '')
  320. Return "-";
  321. $nlen = strlen($number);
  322. while ($nlen > 3) {
  323. $fNumber = "," . substr($number, $nlen - 3, 3);
  324. $number = substr($number, 0, -3);
  325. $nlen = strlen($number);
  326. }
  327. if ($nlen <= 3) {
  328. $fNumber = $number . $fNumber;
  329. }
  330. Return $fNumber;
  331. }
  332. public function welcome()
  333. {
  334. // if (!$this->auth->isLoggedIn())
  335. // return Doo::conf()->APP_URL;
  336. if ($this->profile->getProWithUid($_SESSION['uid'])['userid'])
  337. return Doo::conf()->APP_URL . 'project/list';
  338. if (isset($_POST['welform'])) {
  339. $profileUserArray = $_POST;
  340. $profileUserArray['userid'] = $_SESSION['uid'];
  341. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  342. return Doo::conf()->APP_URL . 'project/list';
  343. }
  344. $this->render('welcome', $this->data);
  345. }
  346. public function prolist()
  347. {
  348. // if (!$this->auth->isLoggedIn())
  349. // return Doo::conf()->APP_URL;
  350. // $proArray = new stdClass();
  351. // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  352. // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  353. // if ($handle = opendir($extPathdir)) {
  354. // while (false !== ($file = readdir($handle))) {
  355. // $filename = pathinfo($file);
  356. // if ($filename['extension'] == 'json')
  357. // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
  358. // }
  359. // closedir($handle);
  360. // }
  361. // $this->data['proArray'] = null;
  362. $this->render('s-project', $this->data);
  363. }
  364. function proSectionFiles()
  365. {
  366. if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
  367. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  368. if ($imnidArray['iaid'] > 0) {
  369. $fileArray = $this->upItemFile('file')[0];
  370. if (isset($fileArray['filepath'])) {
  371. $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  372. if (isset($itemArray)) {
  373. if ($itemArray['oldiaid'] > 0) {
  374. $oldiaid = $itemArray['oldiaid'];
  375. } else {
  376. $oldiaid = $imnidArray['iaid'];
  377. }
  378. $postArray = array('ownerid' => $this->auth->getUid(), 'pid' => $itemArray['pid'], 'pmid' => $itemArray['pmid'], 'filename' => $fileArray['filename'], 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'oldiaid' => $oldiaid);
  379. $iaid = $this->itemfle->insertItemFileRecord($postArray);
  380. if ($iaid > 1) {
  381. $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
  382. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  383. die();
  384. }
  385. }
  386. }
  387. }
  388. }
  389. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  390. ini_set('display_errors', 1);
  391. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  392. if ($imnidArray['iaid'] > 0) {
  393. $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
  394. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  395. die();
  396. }
  397. }
  398. if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
  399. $filename = $_POST['filename'];
  400. $filedesc = $_POST['filedesc'];
  401. $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
  402. if ($imnidArray['iaid'] > 0) {
  403. if (isset($filedesc))
  404. $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc, 0);
  405. if (isset($filename))
  406. $this->itemfle->updateItemFields($imnidArray['iaid'], $filename, 0);
  407. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  408. die();
  409. }
  410. }
  411. // 面包屑导航项目
  412. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  413. $this->data['pmid'] = $this->params['pmid'];
  414. $allproArray = $this->project->getAll();
  415. foreach ($allproArray as $kk => $vv) {
  416. if ($vv['pid'] == $this->params['pid']) {
  417. $this->data['currproArray'] = $vv;
  418. } else {
  419. $this->data['allproArray'][] = $vv;
  420. }
  421. }
  422. // 面包屑导航合同
  423. $conArray = $this->contractact->getAll();
  424. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  425. if (isset($measureArray['stid'])) {
  426. foreach ($conArray as $kkk => $vvv) {
  427. if ($vvv['stid'] == $measureArray['stid']) {
  428. $this->data['currconArray'] = $vvv;
  429. } else {
  430. if ($vvv['pid'] == $this->params['pid'])
  431. $this->data['allconArray'][] = $vvv;
  432. }
  433. }
  434. } else {
  435. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  436. }
  437. // 面包屑导航标段
  438. $this->data['curractmeasureArray'] = NULL;
  439. $this->data['allactmeasureArray'] = [];
  440. $actmeasureArray = $this->actmeasure->getAll();
  441. foreach ($actmeasureArray as $kkkk => $vvvv) {
  442. if ($vvvv['stid'] == $measureArray['stid']) {
  443. if (($vvvv['pmid'] == $this->params['pmid'])) {
  444. $this->data['curractmeasureArray'] = $vvvv;
  445. } else {
  446. $this->data['allactmeasureArray'][] = $vvvv;
  447. }
  448. }
  449. }
  450. // 选取查询
  451. $groupArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
  452. $this->data['groupArray'] = $groupArray;
  453. $owneridArray = $this->itemfle->getGroupOwnerid($this->params['pmid']);
  454. foreach ($owneridArray as $k => $v) {
  455. $this->data['owneridArray'][$k]['name'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  456. $this->data['owneridArray'][$k]['iaid'] = $v['iaid'];
  457. $this->data['owneridArray'][$k]['ownerid'] = $v['ownerid'];
  458. }
  459. // 分页
  460. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid'], 0, $this->params['numpname'], $this->params['userid']);
  461. if ($totalArchive) {
  462. if ($this->params['numpname'] && $this->params['userid']) {
  463. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  464. } elseif ($this->params['numpname']) {
  465. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/page', $totalArchive, 20, 100);
  466. } elseif ($this->params['userid']) {
  467. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  468. } else {
  469. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/page', $totalArchive, 20, 100);
  470. }
  471. $pager->setCss('', 'disabled', 'active');
  472. if (isset($this->params['pindex']))
  473. $pager->paginate(intval($this->params['pindex']));
  474. else
  475. $pager->paginate(1);
  476. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid'], $pager->limit, $this->params['numpname'], $this->params['userid']);
  477. }
  478. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  479. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  480. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  481. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  482. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  483. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  484. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  485. }
  486. $this->data['pid'] = $this->params['pid'];
  487. $this->data['pmid'] = $this->params['pmid'];
  488. $this->data['mpid'] = $this->params['mpid'];
  489. $this->data['userid'] = $this->params['userid'];
  490. $this->data['num'] = $this->params['numpname'];
  491. $this->data['pager'] = $pager->output;
  492. $this->render('s-project-section-files', $this->data, TRUE);
  493. }
  494. function proSectionFilesRecover()
  495. {
  496. if (isset($_POST['optype']) && ($_POST['optype'] == 'reconvery') && isset($_POST['imnid'])) {
  497. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  498. if ($imnidArray['iaid'] > 0) {
  499. $this->itemmeasurenum->recoveryDel($_POST['imnid']);
  500. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  501. die();
  502. }
  503. }
  504. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  505. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  506. if ($imnidArray['iaid'] > 0) {
  507. $iaidArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  508. if ($iaidArray['ownerid'] == $this->auth->getUid()) {
  509. $this->itemfle->delItem($imnidArray['iaid']);
  510. $this->itemmeasurenum->delItemIAID($imnidArray['iaid']);
  511. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  512. die();
  513. } else {
  514. echo json_encode(array('status' => 2), JSON_UNESCAPED_UNICODE);
  515. die();
  516. }
  517. }
  518. }
  519. // 面包屑导航项目
  520. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  521. $this->data['pmid'] = $this->params['pmid'];
  522. $allproArray = $this->project->getAll();
  523. foreach ($allproArray as $kk => $vv) {
  524. if ($vv['pid'] == $this->params['pid']) {
  525. $this->data['currproArray'] = $vv;
  526. } else {
  527. $this->data['allproArray'][] = $vv;
  528. }
  529. }
  530. // 面包屑导航合同
  531. $conArray = $this->contractact->getAll();
  532. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  533. if (isset($measureArray['stid'])) {
  534. foreach ($conArray as $kkk => $vvv) {
  535. if ($vvv['stid'] == $measureArray['stid']) {
  536. $this->data['currconArray'] = $vvv;
  537. } else {
  538. if ($vvv['pid'] == $this->params['pid'])
  539. $this->data['allconArray'][] = $vvv;
  540. }
  541. }
  542. } else {
  543. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  544. }
  545. // 面包屑导航标段
  546. $this->data['curractmeasureArray'] = NULL;
  547. $this->data['allactmeasureArray'] = [];
  548. $actmeasureArray = $this->actmeasure->getAll();
  549. foreach ($actmeasureArray as $kkkk => $vvvv) {
  550. if ($vvvv['stid'] == $measureArray['stid']) {
  551. if (($vvvv['pmid'] == $this->params['pmid'])) {
  552. $this->data['curractmeasureArray'] = $vvvv;
  553. } else {
  554. $this->data['allactmeasureArray'][] = $vvvv;
  555. }
  556. }
  557. }
  558. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
  559. if ($totalArchive) {
  560. $pager = new DooPager(Doo::conf()->APP_URL . 'sproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/recover/page', $totalArchive, 20, 100);
  561. $pager->setCss('', 'disabled', 'active');
  562. if (isset($this->params['pindex']))
  563. $pager->paginate(intval($this->params['pindex']));
  564. else
  565. $pager->paginate(1);
  566. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNumDel($pager->limit, $this->params['pmid']);
  567. }
  568. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  569. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  570. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  571. $this->data['itemMeasureArray'][$k]['delname'] = $this->profile->getProWithUid($v['deluid'])['name'];
  572. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  573. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  574. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  575. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  576. $this->data['itemMeasureArray'][$k]['filepath'] = $fileArray['filepath'];
  577. }
  578. $this->data['pid'] = $this->params['pid'];
  579. $this->data['pmid'] = $this->params['pmid'];
  580. $this->data['mpid'] = $this->params['mpid'];
  581. $this->data['pager'] = $pager->output;
  582. $this->render('s-project-section-files-recover', $this->data, TRUE);
  583. }
  584. /**
  585. * @return actMeasure
  586. */
  587. public function proSectionGetFiles()
  588. {
  589. $attaArray = $this->itemfile->getItemFile($this->params['iaid']);
  590. $this->file_down($attaArray['filepath'], $attaArray['filesize'], $attaArray['filename'] . '.' . $attaArray['fileext']);
  591. return;
  592. }
  593. public function proSectionInterMediate(){
  594. //草图功能开关控制
  595. if($this->data['imediateSwitch'] == 0){
  596. exit('中间计量表草图添加功能未启用...');
  597. }
  598. if(isset($_POST['delid']) && is_numeric($_POST['delid'])){
  599. //删除未签署报表数据和文件
  600. $signmsg = $this->sign->getOneSignbysid($_POST['delid']);
  601. if(empty($signmsg) && $signmsg['status'] == "checked" && $signmsg['ownuid'] != $this->auth->getUid()){
  602. exit(json_encode(array('code' => 400),JSON_UNESCAPED_UNICODE));
  603. }
  604. $this->sign->delSignbysid($_POST['delid'],$signmsg['status']);
  605. include (DOO::conf()->SITE_PATH . 'protected/plugin/io.han.php');
  606. $this->IoHandler = new IoHandler();
  607. $path = DOO::conf()->SITE_PATH."signs/".$_POST['delid'];
  608. $this->IoHandler->RemoveDir($path);
  609. exit(json_encode(array('code' => 200),JSON_UNESCAPED_UNICODE));
  610. }
  611. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  612. $proArray = $this->actmeasure->getGroupProject($this->auth->getUid());
  613. foreach ($proArray as $v) {
  614. $pidArray[] = $v['pid'];
  615. }
  616. $pidstr = implode(',', $pidArray);
  617. // 项目名称
  618. $allproArray = $this->project->getFewRow($pidstr);
  619. // 面包屑导航项目
  620. foreach ($allproArray as $kk => $vv) {
  621. if ($vv['pid'] == $this->params['pid']) {
  622. $this->data['currproArray'] = $vv;
  623. } else {
  624. $this->data['allproArray'][] = $vv;
  625. }
  626. }
  627. // 面包屑导航合同
  628. $conArray = $this->contractact->getAll();
  629. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  630. if (isset($measureArray['stid'])) {
  631. foreach ($conArray as $kkk => $vvv) {
  632. if ($vvv['stid'] == $measureArray['stid']) {
  633. $this->data['currconArray'] = $vvv;
  634. } else {
  635. if ($vvv['pid'] == $this->params['pid'])
  636. $this->data['allconArray'][] = $vvv;
  637. }
  638. }
  639. } else {
  640. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  641. }
  642. // 面包屑导航标段
  643. $this->data['curractmeasureArray'] = NULL;
  644. $this->data['allactmeasureArray'] = [];
  645. // $actmeasureArray = $this->actmeasure->getAll();
  646. $actmeasureArray = $this->actmeasure->getRowUser($this->auth->getUid());
  647. foreach ($actmeasureArray as $kkkk => $vvvv) {
  648. if ($vvvv['stid'] == $measureArray['stid']) {
  649. if (($vvvv['pmid'] == $this->params['pmid'])) {
  650. $this->data['curractmeasureArray'] = $vvvv;
  651. } else {
  652. $this->data['allactmeasureArray'][] = $vvvv;
  653. }
  654. }
  655. }
  656. Doo::loadHelper('DooPager');
  657. $pagestr = '';
  658. $sqlstr = ' 1';
  659. // $this->data['project'] = '';
  660. // $this->data['tender'] = '';
  661. $this->data['phaseno'] = '';
  662. $this->data['nosign'] = '';
  663. //获取项目信息
  664. $searchsql = 'isinter!=0 and (`ownuid`='.$this->auth->getUid().' OR `audituid`='.$this->auth->getUid().' OR sid IN (SELECT sid FROM jl_sign_audit WHERE jl_sign_audit.audituid='.$this->auth->getUid().'))';
  665. // $itemlist = $this->sign->getSignGroupByProject($searchsql);
  666. // if(!empty($itemlist)){
  667. // foreach($itemlist as $ik => $iv){
  668. // $itemmsg = $this->project->getRowByPid($iv['project']);
  669. // $itemlist[$ik]['pname'] = $itemmsg['pname'];
  670. // }
  671. // }
  672. if(isset($this->params['pid']) && is_numeric($this->params['pid'])){
  673. $pagestr .= '/'.$this->params['pid'];
  674. $sqlstr .= ' and project='.$this->params['pid'];
  675. //获取标段信息
  676. // $tenderlist = $this->sign->getSignGroupByTender($this->params['pid'],$searchsql);
  677. // if(!empty($tenderlist)){
  678. // foreach($tenderlist as $tk => $tv){
  679. // $tendermsg = $this->actmeasure->getRowByPmid($tv['tender']);
  680. // $tenderlist[$tk]['pmname'] = $tendermsg['pmname'];
  681. // }
  682. // }
  683. if(isset($this->params['pmid']) && is_numeric($this->params['pmid'])){
  684. $pagestr .= '/section/'.$this->params['pmid'];
  685. $sqlstr .= ' and tender='.$this->params['pmid'];
  686. //获取期数信息
  687. $phasenolist = $this->sign->getSignGroupByPhaseno($this->params['pmid'],$searchsql);
  688. if(!empty($phasenolist)){
  689. foreach($phasenolist as $pk => $pv){
  690. $phasenolist[$pk]['numpname'] = $pv['phaseno'];
  691. }
  692. }
  693. if(isset($this->params['mpid']) && is_numeric($this->params['mpid'])){
  694. $this->data['phaseno'] = $this->params['mpid'];
  695. $pagestr .= '/phaseno/'.$this->params['mpid'];
  696. $sqlstr .= ' and phaseno='.$this->params['mpid'];
  697. }
  698. }
  699. }
  700. $totalArchive = $this->sign->getSignNum($sqlstr.' and '.$searchsql);
  701. $pager = new DooPager(Doo::conf()->APP_URL . 'sproject'.$pagestr.'/intermediate/page', $totalArchive, 10, 100);
  702. $pager->setCss('', 'disabled', 'active');
  703. if (isset($this->params['pindex']))
  704. $pager->paginate(intval($this->params['pindex']));
  705. else
  706. $pager->paginate(1);
  707. if ($pager->limit != ' -10,10')
  708. $list = $this->sign->getSignList($sqlstr.' and '.$searchsql,$pager->limit);
  709. if(isset($list) && !empty($list)){
  710. foreach($list as $k => $v){
  711. //获取项目名,标段名,标段期数
  712. $project = $this->project->getRowByPid($v['project']);
  713. $tender = $this->actmeasure->getRowByPmid($v['tender']);
  714. // $phaseno = $this->numofperact->getCurrStatus($v['phaseno']);
  715. $list[$k]['project'] = $project['pname'];
  716. $list[$k]['tender'] = $tender['pmname'];
  717. // $list[$k]['phaseno'] = $phaseno['numpname'];
  718. $list[$k]['ownname'] = $this->auth->getName($v['ownuid']);
  719. $list[$k]['auditname'] = $this->auth->getName($v['audituid']);
  720. $list[$k]['delstatus'] = $this->auth->getUid() == $v['ownuid'] && $v['status'] != 'checked' ? 1 : 0;
  721. }
  722. }
  723. $this->data['list'] = isset($list) ? $list : '';
  724. // $this->data['itemlist'] = $itemlist;
  725. // $this->data['tenderlist'] = isset($tenderlist) ? $tenderlist : '';
  726. $this->data['phasenolist'] = isset($phasenolist) ? $phasenolist : '';
  727. $this->data['pager'] = $pager->output;
  728. $this->data['pid'] = $this->params['pid'];
  729. $this->data['pmid'] = $this->params['pmid'];
  730. $this->render('s-project-section-intermediate', $this->data, TRUE);
  731. }
  732. public function interMediateMake(){
  733. //草图功能开关控制
  734. if($this->data['imediateSwitch'] == 0){
  735. exit('中间计量表草图添加功能未启用...');die;
  736. }
  737. if(isset($this->params['sid']) && is_numeric($this->params['sid'])){
  738. //获取报表信息
  739. $signmsg = $this->sign->getOneSignbysid($this->params['sid']);
  740. if(!empty($signmsg) && ($signmsg['isinter'] == 1 || $signmsg['isinter'] == 2)){
  741. if($signmsg['pagenum'] == 0){
  742. exit('当前中间计量表还没上传图片~');die;
  743. }
  744. $this->data['sid'] = $signmsg['sid'];
  745. $this->data['pid'] = $signmsg['project'];
  746. $this->data['pmid'] = $signmsg['tender'];
  747. $this->data['name'] = $signmsg['name'];
  748. $this->data['totalnum'] = $signmsg['pagenum'];
  749. if(isset($this->params['page']) && is_numeric($this->params['page'])){
  750. $this->data['currnum'] = $this->params['page'];
  751. $this->data['lastnum'] = $this->params['page'] - 1 > 0 ? ($this->params['page'] - 1) : '';
  752. $this->data['nextnum'] = $this->params['page'] + 1 > $signmsg['pagenum'] ? '' : ($this->params['page'] + 1);
  753. $signattmsg = $this->sign->getOneSignAtt($this->params['sid'],$this->params['page']);
  754. }else{
  755. $this->data['currnum'] = 1;
  756. $this->data['lastnum'] = '';
  757. $this->data['nextnum'] = 1 + 1 > $signmsg['pagenum'] ? '' : 2;
  758. $signattmsg = $this->sign->getOneSignAtt($this->params['sid'],1);
  759. }
  760. //获取报表图片
  761. $maxwidth = 794; //默认图片最大宽度 a4
  762. $maxheight = 1123; //默认图片最大高度 a4
  763. $imgmsg = getimagesize(Doo::conf()->APP_URL.$signattmsg['filepath']);
  764. $maxwidth = $imgmsg[0];
  765. $maxheight = $imgmsg[1];
  766. $this->data['maxwidth'] = $maxwidth;
  767. $this->data['maxheight'] = $maxheight;
  768. if($this->is_pjax()){
  769. echo '<div class="page" style="width:'.$maxwidth.'px" id="intermediatePage'.$this->data['currnum'].'"><input type="hidden" value="'.$this->data['currnum'].'" id="pagecurrnum"><img src="'.Doo::conf()->APP_URL.$signattmsg['filepath'].'"></div>';exit;
  770. }
  771. $this->data['attmsg'] = $signattmsg;
  772. $this->render('s-project-section-intermediate-detail', $this->data, TRUE);die;
  773. }
  774. }
  775. exit('没有中间计量表参数');
  776. }
  777. public function interMediateUpload(){
  778. if(isset($this->params['sid']) && is_numeric($this->params['sid']) && isset($_POST['num']) && isset($_POST['data'])){
  779. $signmsg = $this->sign->getOneSignbysid($this->params['sid']);
  780. if(!empty($signmsg) && ($signmsg['isinter'] == 1 || $signmsg['isinter'] == 2)){
  781. if(empty($_POST['data']) && $_POST['num'] == $signmsg['pagenum']){
  782. $this->sign->updateInterMediateStatus($this->params['sid'],3);
  783. $status = array('code' => 202, 'msg' => '最后一张已上传完毕');
  784. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  785. die();
  786. }
  787. preg_match('/^(data:\s*image\/(\w+);base64,)/', $_POST['data'], $result);
  788. $img = base64_decode(str_replace($result[1], '', $_POST['data']));
  789. //path
  790. $dir = 'signs/'.$this->params['sid'].'/intermediate';
  791. if (!$this->dir_create2(Doo::conf()->SITE_PATH . $dir)) {
  792. $status = array('status' => 400, 'msg' => '文件夹创建失败');
  793. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  794. die();
  795. }
  796. $virtualPath = $dir.'/'.$_POST['num'].'.jpg';
  797. $a = file_put_contents(Doo::conf()->SITE_PATH .$virtualPath,$img);
  798. if($a){
  799. //更新signatt表信息
  800. $result = $this->sign->updateSignAtt($this->params['sid'],$_POST['num'],$virtualPath);
  801. if($result){
  802. if($_POST['num'] == $signmsg['pagenum']){
  803. $this->sign->updateInterMediateStatus($this->params['sid'],3);
  804. $status = array('code' => 202, 'msg' => '最后一张已上传完毕');
  805. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  806. die();
  807. }else{
  808. $status = array('code' => 200, 'msg' => '');
  809. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  810. die();
  811. }
  812. }
  813. }
  814. $status = array('code' => 400, 'msg' => '上传中间计量表失败');
  815. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  816. die();
  817. }
  818. }
  819. $status = array('code' => 400, 'msg' => '参数有误,不存在此中间计量表或此中间计量表已合成');
  820. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  821. die();
  822. }
  823. /**
  824. *
  825. * @return type
  826. */
  827. public function signView()
  828. {
  829. //草图功能开关控制
  830. if($this->data['imediateSwitch'] == 0){
  831. exit('中间计量表草图添加功能未启用...');die;
  832. }
  833. if(!isset($this->params['sid']) || !is_numeric($this->params['sid'])){
  834. exit('没有报表参数');
  835. }
  836. //获取报表信息
  837. $signmsg = $this->sign->getOneSignbysid($this->params['sid']);
  838. if(empty($signmsg) || $signmsg['isinter'] != 3){
  839. exit('不存在此中间计量表');
  840. }
  841. $backurl = '/sproject/'.$signmsg['project'].'/section/'.$signmsg['tender'].'/intermediate';
  842. //获取项目名,标段名,标段期数
  843. $project = $this->project->getRowByPid($signmsg['project']);
  844. $tender = $this->actmeasure->getRowByPmid($signmsg['tender']);
  845. // $phaseno = $this->numofperact->getCurrStatus($signmsg['phaseno']);
  846. $signmsg['project'] = $project['pname'];
  847. $signmsg['tender'] = $tender['pmname'];
  848. // $signmsg['phaseno'] = $phaseno['numpname'];
  849. //获取签署人列表
  850. $signauditlist = $this->sign->getSignAuditList($this->params['sid']);
  851. if(!empty($signauditlist)){
  852. foreach($signauditlist as $k => $v){
  853. //获取签署人头像
  854. $signauditlist[$k]['index'] = $k+1;
  855. $signauditlist[$k]['avatar'] = $this->auth->getAvatar($v['audituid']);
  856. }
  857. }
  858. //获取报表图片
  859. $maxwidth = 794; //默认图片最大宽度 a4
  860. $maxheight = 1123; //默认图片最大高度 a4
  861. if(!empty($signmsg['widhei'])){
  862. $widhei = explode('_', $signmsg['widhei']);
  863. $style = $widhei[0].'mm '.$widhei[1].'mm';
  864. }else{
  865. $style = '210mm 297mm';
  866. }
  867. $signattlist = $this->sign->getSignAttList($this->params['sid']);
  868. if(!empty($signattlist)){
  869. foreach($signattlist as $sak => $sav){
  870. $signattlist[$sak]['auditatt'] = $this->sign->getSignAuditAttList($sav['said']);
  871. if($sak == 0){
  872. $imgmsg = getimagesize(Doo::conf()->APP_URL.$sav['filepath']);
  873. $maxwidth = $imgmsg[0];
  874. $maxheight = $imgmsg[1];
  875. }
  876. }
  877. }
  878. $this->data['signmsg'] = $signmsg;
  879. $this->data['auditlist'] = $signauditlist;
  880. $this->data['attlist'] = $signattlist;
  881. $this->data['backurl'] = $backurl;
  882. $this->data['maxwidth'] = $maxwidth;
  883. $this->data['maxheight'] = $maxheight;
  884. $this->data['style'] = $style;
  885. $this->render('sign-view-page', $this->data, TRUE);
  886. }
  887. function is_pjax(){
  888. return array_key_exists('HTTP_X_PJAX', $_SERVER) && $_SERVER['HTTP_X_PJAX'] === 'true';
  889. }
  890. /**
  891. * 文件下载
  892. * @param $filepath 文件路径
  893. * @param $filename 文件名称
  894. */
  895. function file_down($filepath, $filesize, $filename = '')
  896. {
  897. if (!$filename)
  898. $filename = basename($filepath);
  899. if ($this->is_ie())
  900. $filename = rawurlencode($filename);
  901. $filetype = $this->fileext($filename);
  902. // $filesize = sprintf("%u", filesize($filepath));
  903. if (ob_get_length() !== false)
  904. @ob_end_clean();
  905. header('Pragma: public');
  906. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  907. header('Cache-Control: no-store, no-cache, must-revalidate');
  908. header('Cache-Control: pre-check=0, post-check=0, max-age=0');
  909. header('Content-Transfer-Encoding: binary');
  910. header('Content-Encoding: none');
  911. header('Content-type: ' . $filetype);
  912. header('Content-Disposition: attachment; filename="' . $filename . '"');
  913. header('Content-length: ' . $filesize);
  914. @readfile($filepath);
  915. exit;
  916. }
  917. /**
  918. * IE浏览器判断
  919. */
  920. function is_ie()
  921. {
  922. $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
  923. if ((strpos($useragent, 'opera') !== false) || (strpos($useragent, 'konqueror') !== false))
  924. return false;
  925. if (strpos($useragent, 'msie ') !== false)
  926. return true;
  927. return false;
  928. }
  929. /**
  930. * 取得文件扩展
  931. *
  932. * @param $filename 文件名
  933. * @return 扩展名
  934. */
  935. function fileext($filename)
  936. {
  937. return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
  938. }
  939. function dir_create2($path, $mode = 0777)
  940. {
  941. if (is_dir($path))
  942. return TRUE;
  943. $path = $this->dir_path($path);
  944. $parent = dirname($path);
  945. if (!is_dir($parent)){
  946. @mkdir($parent, 0777);
  947. @chmod($parent, 0777);
  948. }
  949. @mkdir($path, 0777);
  950. @chmod($path, 0777);
  951. return is_dir($path);
  952. }
  953. function dir_path($path)
  954. {
  955. $path = str_replace('\\', '/', $path);
  956. if (substr($path, -1) != '/')
  957. $path = $path . '/';
  958. return $path;
  959. }
  960. }
  961. ?>