SProjectController.php 47 KB

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