ProjectController.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  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. /* * proDetail
  10. * MainController
  11. * Feel free to delete the methods and replace them with your own code.
  12. *
  13. * @author darkredz
  14. */
  15. class ProjectController extends DooController {
  16. private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审核</span>', 'checking' => '<span class = "colOrange">审核中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>');
  17. public function beforeRun($resource, $action) {
  18. if ($this->auth->getUid()) {
  19. $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  20. $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  21. if (!$falg)
  22. return Doo::acl()->defaultFailedRoute;
  23. }else {
  24. return Doo::acl()->defaultFailedRoute;
  25. }
  26. }
  27. public function __construct() {
  28. $this->auth = new Auth();
  29. $this->attfile = new attFile();
  30. $this->profile = new Profile();
  31. $this->project = new Project();
  32. $this->contractact = new Contractact();
  33. $this->actmeasure = new actMeasure();
  34. $this->numofperact = new NumofperAct();
  35. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  36. $this->data['currChannle'] = 'p';
  37. $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
  38. }
  39. /**
  40. *
  41. * @return type
  42. */
  43. public function index() {
  44. if (isset($_POST['pname']) && $_POST['pname']) {
  45. $this->project->insertProject($this->auth->getUid(), $_POST['pname']);
  46. return Doo::conf()->APP_URL . 'project/index';
  47. }
  48. if (isset($_POST['target_pname']) && $_POST['target_pname'] && isset($_POST['ppid']) && $_POST['ppid']) {
  49. $this->project->updateProName($_POST['ppid'], $_POST['target_pname']);
  50. return Doo::conf()->APP_URL . 'project/index';
  51. }
  52. $this->data['pros'] = $this->project->getAll($this->auth->getUid());
  53. if (isset($this->data['pros'][0]['pid'])) {
  54. foreach ($this->data['pros'] as $key => $value) {
  55. $this->data['pros'][$key]['numMeasure'] = $this->actmeasure->getMearsureCount($value['pid']);
  56. $this->data['pros'][$key]['contracttotal'] = $this->actmeasure->getTotalWithPid($value['pid']);
  57. $this->data['pros'][$key]['changTotal'] = $this->numofperact->getChangTotal($value['pid']);
  58. // $this->data['pros'][$key]['contracttotal'] += $this->data['pros'][$key]['changTotal'];
  59. $this->data['pros'][$key]['currdone'] = $this->numofperact->getCurrDoneNow($value['pid']);
  60. if ($this->data['pros'][$key]['contracttotal']) {
  61. $this->data['pros'][$key]['pcurrdone'] = round(($this->data['pros'][$key]['currdone'] / $this->data['pros'][$key]['contracttotal']) * 100) . '%';
  62. } else {
  63. $this->data['pros'][$key]['pcurrdone'] = '0%';
  64. }
  65. $this->data['pros'][$key]['bcontracttotal'] = number_format($this->data['pros'][$key]['contracttotal'], 2, '.', ',');
  66. $this->data['pros'][$key]['bchangTotal'] = number_format($this->data['pros'][$key]['changTotal'], 2, '.', ',');
  67. }
  68. } else {
  69. $this->data['pros'] = [];
  70. }
  71. $this->render('w-project', $this->data, TRUE);
  72. }
  73. public function proOverview() {
  74. $conArray = $this->contractact->getRowByPid($this->params['pid']);
  75. $this->data['projectDate'] = '';
  76. $this->data['conArray'][] = array();
  77. $this->getFav();
  78. // $this->data['measureArray'] = $this->actmeasure->getRowByPids($this->params['pid']);
  79. // foreach ($this->data['measureArray'] as $key => $value) {
  80. // $this->data['measureArray'][$key]['stopNow'] = $this->numofperact->getStopNow($value['pmid'])['sntotal'];
  81. // $this->data['measureArray'][$key]['pstopnow'] = round(($this->data['measureArray'][$key]['stopNow'] / $value['contracttotal']) * 100);
  82. // }
  83. $this->data['pid'] = $this->params['pid'];
  84. $this->data['conArray'] = $conArray;
  85. $contracttotal = 0;
  86. // 不同标段和值
  87. // $list = $this->numofperact->getStopNowStMonth($v['stid']); //print_r($list);
  88. // if (empty($list))
  89. // $startMonth = date("Y-m");
  90. // else
  91. // $startMonth = $list[0]['month'];
  92. // //$list=Array ( 0 => Array ( 'sntotal' => 20000 ,'month' => '2014-09' ),1 => Array ( 'sntotal' => 40000, 'month' => '2016-10' ) );
  93. // $d = 0;
  94. // $mDList = $mList = array();
  95. // $toMD = date("Y-m");
  96. // foreach ($list as $value) {
  97. // $flag = true;
  98. // do {
  99. // $MD = date("Y-m", strtotime($startMonth . " " . $d . " month")); //echo $MD."/".$value['month']."<br/>";
  100. // array_push($mDList, "'" . $MD . "'");
  101. // array_push($mList, $MD);
  102. //
  103. // if ($MD == $toMD)//if(strtotime($MD)>=strtotime($toMD))
  104. // $flag = false;
  105. // if ($d > 0 && ($MD == $value['month'] || $toMD == $value['month']))
  106. // $flag = false;
  107. // $d++;
  108. //// if ($d==10)
  109. //// $flag=false;
  110. // } while ($flag);
  111. // }
  112. // $this->data['projectDate'] = implode(',', $mDList);
  113. //
  114. // $dataList = array();
  115. // $sntotalTA = 0;
  116. // foreach ($mList as $va) {
  117. // $falg = true;
  118. // foreach ($list as $value) {
  119. // if ($va == $value['month']) {
  120. // $sntotalTA+=$value['sntotal'];
  121. // $PER = round($sntotalTA / $contracttotal, 3) * 100;
  122. // array_push($dataList, $PER);
  123. // $falg = false;
  124. // break;
  125. // }
  126. // }
  127. // if ($falg)
  128. // array_push($dataList, 0);
  129. // }
  130. // $this->data['conArray'][$k]['monthStopnow'] = $dataList;
  131. //
  132. // $list = $this->numofperact->getCurrDoneSMontht($v['stid']);
  133. // $dataList = array();
  134. // $currdoneTA = 0;
  135. // foreach ($mList as $va) {
  136. // $falg = true;
  137. // foreach ($list as $value) {
  138. // if ($va == $value['month']) {
  139. // $currdoneTA+=$value['currdone'];
  140. // $PER = round($currdoneTA / $contracttotal, 3) * 100;
  141. // array_push($dataList, $PER);
  142. // $falg = false;
  143. // break;
  144. // }
  145. // }
  146. // if ($falg)
  147. // array_push($dataList, 0);
  148. // }
  149. // $this->data['conArray'][$k]['monthCurrdone'] = $dataList;
  150. //
  151. $totalstid = 0;
  152. $monthArray = [];
  153. foreach ($this->data['conArray'] as $k => $v) {
  154. $this->data['conArray'][$k]['pstopnow'] = $this->data['conArray'][$k]['pscurrdone'] = 0;
  155. $retval = $this->actmeasure->getAllbyStidSum($v['stid']);
  156. $contracttotal+=$retval[0]['contracttotal'];
  157. $totalstid +=$this->actmeasure->getTotal($v['stid'])['total'];
  158. $total = $this->actmeasure->getTotal($v['stid'])['total'];
  159. if ($total) {
  160. $this->data['conArray'][$k]['total'] = round($total, 2);
  161. } else {
  162. $this->data['conArray'][$k]['total'] = 0;
  163. }
  164. $sntotal = $this->numofperact->getCountTotalSTID2($v['stid'])['totalplus'];
  165. if ($sntotal) {
  166. $this->data['conArray'][$k]['stopnow'] = round($sntotal, 2);
  167. } else {
  168. $this->data['conArray'][$k]['stopnow'] = 0;
  169. }
  170. $this->data['conArray'][$k]['currdone'] = $this->numofperact->getCurrDoneSt($v['stid'])['currdone'];
  171. if ($this->data['conArray'][$k]['total'] > 0) {
  172. $this->data['conArray'][$k]['pstopnow'] = round(($this->data['conArray'][$k]['stopnow'] / $this->data['conArray'][$k]['total']) * 100);
  173. $this->data['conArray'][$k]['pscurrdone'] = round(($this->data['conArray'][$k]['currdone'] / $this->data['conArray'][$k]['total']) * 100);
  174. }
  175. // 分组出年月 每个月份的独立相加
  176. $month = $this->numofperact->getStopNowStMonth($v['stid']);
  177. foreach ($month as $key => $value) {
  178. $allmonth[] = $value;
  179. if (!in_array($value['month'], $monthArray))
  180. $monthArray = $value['month'];
  181. }
  182. // 分组出年月 每个月份的独立相加
  183. $month1 = $this->numofperact->getCurrDoneSMontht($v['stid']);
  184. foreach ($month1 as $key => $value) {
  185. $allmonth1[] = $value;
  186. }
  187. }
  188. // 中文表述年月
  189. foreach ($monthArray as $kk => $vv) {
  190. foreach ($allmonth as $keyk => $valuev) {
  191. if ($valuev['month'] == $vv)
  192. $total[$kk] += $valuev['sntotal'];
  193. }
  194. foreach ($allmonth1 as $k1 => $v1) {
  195. if ($v1['month'] == $vv)
  196. $total1[$kk] += $v1['currdone'];
  197. }
  198. $ymarray = split('-', $vv);
  199. $cnym = '\'' . $ymarray[1] . '月' . '\'';
  200. if ($kk == 0)
  201. $cnym = '\'' . $ymarray[0] . '年' . $ymarray[1] . '月' . '\'';
  202. $cnymArray[] = $cnym;
  203. }
  204. foreach ($total as $value2) {
  205. $total3[] = round(($value2 / $totalstid) * 100);
  206. }
  207. foreach ($total1 as $value11) {
  208. $total4[] = round(($value11 / $totalstid) * 100);
  209. }
  210. $this->data['projectDate'] = implode(',', $cnymArray);
  211. $this->data['t1'] = implode(',', $total3);
  212. $this->data['t2'] = implode(',', $total4);
  213. $this->render('w-project-detail', $this->data, TRUE);
  214. }
  215. public function proSection() {
  216. if (isset($_POST['stid']) && isset($_POST['proname'])) {
  217. $this->contractact->updateStName($_POST['stid'], $_POST['proname']);
  218. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  219. }
  220. $this->getFav();
  221. $contractArray = $this->contractact->getRowByPid($this->params['pid']); // 获取合同段
  222. $htmlstr = NULL;
  223. foreach ($contractArray as $k => $v) {// 获取所有合同段
  224. $retval = $this->actmeasure->getAllbyStid($v['stid']); // 获取标段
  225. $bdhtmlstr = NULL;
  226. $bdhtmlstr = '<thead>
  227. <tr><th class="taC taCble header" width="225">标段名</th><th class="taC" width="140">计量期数</th><th width="115" class="taC">总价</th><th class="taC" width="">截止上期完成/本期完成/未完成</th></tr></thead>
  228. <tbody>';
  229. $biaoduantotalmoney = 0;
  230. $currTotal = 0;
  231. $progress = $otherprogress = '0%';
  232. $currTotal = $this->numofperact->getCountTotalSTID2($v['stid']);
  233. foreach ($retval as $key => $value) {
  234. $displayPercentSnTotalProgress = '0%';
  235. $displayPercentCurrTotalProgress = '0%';
  236. $displayPercentLessTotalProgress = '0%';
  237. $snTotalProgress = $currTotalProgress = $lessTotalProgress = '0%';
  238. $nTotalProgress = $ncurrTotalProgress = $nlessTotalProgress = number_format(0, 2, '.', ',');
  239. $numCount = $this->numofperact->getCountTotalnum2($value['pmid']); // 获取标段已有期数
  240. if (isset($numCount['numpname'])) {
  241. $lastStatusArray = $this->numofperact->getMaxStatusTimes($value['pmid'], $numCount['numpname']);
  242. } else {
  243. $lastStatusArray['currstatus'] = 'uncheck';
  244. $numCount['numpname'] = 0;
  245. }
  246. $totalplus = $this->numofperact->getCountTotalplus($value['pmid']);
  247. $snTotal = $this->numofperact->getStopNowTotal($value['pmid']); //根据标段ID获取最新一期(包括不通过)
  248. $currcomTotal = $this->numofperact->getCurrdoneNew($value['pmid']); //截止目前
  249. $numStatusArray = $this->numofperact->getLastStatus2($this->params['pid'], $value['pmid']);
  250. if ($numCount > 0) {
  251. $nTotalProgress = number_format($snTotal['sntotal'], 2, '.', ',');
  252. $ncurrTotalProgress = number_format($currcomTotal['currtotal'], 2, '.', ',');
  253. $nlessTotalProgress = number_format($value['contracttotal'] - $snTotal['sntotal'] - $currcomTotal['currtotal'], 2, '.', ',');
  254. if (isset($value['contracttotal']) && ($value['contracttotal'] > 0)) {
  255. $snTotalProgress = round(($snTotal['sntotal'] / $value['contracttotal']) * 100);
  256. $currTotalProgress = round(($currcomTotal['currtotal'] / $value['contracttotal']) * 100);
  257. // $lessTotalProgress = round((($value['contracttotal'] - ($currcomTotal['currtotal'] + $snTotal['sntotal'])) / $value['contracttotal']) * 100);
  258. $lessTotalProgress = 100 - $snTotalProgress - $currTotalProgress;
  259. $displayPercentSnTotalProgress = $snTotalProgress . '%';
  260. $displayPercentCurrTotalProgress = $currTotalProgress . '%';
  261. $displayPercentLessTotalProgress = $lessTotalProgress . '%';
  262. }
  263. }
  264. $biaoduantotalmoney += $value['contracttotal'];
  265. $totalmoney = number_format($value['contracttotal'], 2, '.', ',');
  266. if (isset($numStatusArray['currstatus'])) {
  267. $statusStr = '(' . $this->statusArray[$lastStatusArray['currstatus']] . ')';
  268. } else {
  269. $statusStr = '';
  270. }
  271. $bdhtmlstr .='
  272. <tr>
  273. <td><a href="/project/' . $this->params['pid'] . '/section/' . $value['pmid'] . '/detail">' . $value['pmname'] . '</a></td>
  274. <td class="">第 ' . $numCount['numpname'] . ' 期' . $statusStr . '</td>
  275. <td class="taR">¥' . $totalmoney . '</td>
  276. <td>
  277. <div class="progress">
  278. <div class="bar bar-success" style="width: ' . $displayPercentSnTotalProgress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="截止上期完成:¥' . $nTotalProgress . '">' . $displayPercentSnTotalProgress . '</div>
  279. <div class="bar" style="width:' . $displayPercentCurrTotalProgress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="本期完成:¥' . $ncurrTotalProgress . '">' . $displayPercentCurrTotalProgress . '</div>
  280. <div class="bar bar-gary" style="width:' . $displayPercentLessTotalProgress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $nlessTotalProgress . '">' . $displayPercentLessTotalProgress . '</div>
  281. </div>
  282. </td>
  283. </tr>';
  284. }
  285. $nprogress = $notherprogress = NULL;
  286. // $currTotal = $this->numofperact->getCurrdoneSTID($v['stid']);
  287. if ($biaoduantotalmoney > 0) {
  288. $nprogress = number_format($currTotal['totalplus'], 2, '.', ',');
  289. $notherprogress = number_format($biaoduantotalmoney - $currTotal['totalplus'], 2, '.', ',');
  290. $progress = round(($currTotal['totalplus'] / $biaoduantotalmoney) * 100) . '%'; // 累计完成计量 所有标段合计
  291. $otherprogress = round((($biaoduantotalmoney - $currTotal['totalplus']) / $biaoduantotalmoney) * 100) . '%';
  292. $biaoduantotalmoney = number_format($biaoduantotalmoney, 2, '.', ',');
  293. }
  294. $htmlstr .= '<div class="project">
  295. <div class="proSection">
  296. <table class="table">
  297. <thead>
  298. <tr>
  299. <td width="150"><span aria-hidden="true" data-icon="u"></span> ' . $v['stname'] . '<a id="idt_' . $v['stid'] . '" href="#secoption" data-toggle="modal" title="编辑/查看KEY" stid="' . $v['stid'] . '" proname="' . $v['stname'] . '" key="' . $v['stkey'] . '"><span data-icon="S" aria-hidden="true" class="closePanel" data-placement="bottom" data-toggle="tooltip" data-original-title="查看KEY" style="font-size:18px"></span></a></td>
  300. <td width="90">总价:</td><td width="165">¥<b style="font-size:16px">' . $biaoduantotalmoney . '</b></td>
  301. <td width="60">完成进度:</td><td><div class="progress">
  302. <div class="bar bar-success" style="width:' . $progress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="累计完成:¥' . $nprogress . '">' . $progress . '</div>
  303. <div class="bar bar-danger" style="width:' . $otherprogress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $notherprogress . '">' . $otherprogress . '</div>
  304. </div></td>
  305. </tr>
  306. </thead>
  307. </table>
  308. <table class="table table-striped table-hover tablelist">
  309. ' . $bdhtmlstr . '
  310. </tbody>
  311. </table>
  312. </div>
  313. </div>';
  314. }
  315. $this->data['htmlstr'] = $htmlstr;
  316. if (isset($_POST['secname']) && $_POST['secname']) {
  317. $this->contractact->insertContract($this->params['pid'], $this->auth->getUid(), $_POST['secname']);
  318. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  319. }
  320. $this->data['pid'] = $this->params['pid'];
  321. $this->render('w-project-section', $this->data, TRUE);
  322. }
  323. Function fNumber($number) {
  324. if ($number == '')
  325. Return "-";
  326. $nlen = strlen($number);
  327. while ($nlen > 3) {
  328. $fNumber = "," . substr($number, $nlen - 3, 3);
  329. $number = substr($number, 0, -3);
  330. $nlen = strlen($number);
  331. }
  332. if ($nlen <= 3) {
  333. $fNumber = $number . $fNumber;
  334. }
  335. Return $fNumber;
  336. }
  337. private function getFav() {
  338. $proArray = $this->project->getAll($this->auth->getUid());
  339. $this->data['othrPro'] = [];
  340. foreach ($proArray as $key => $value) {
  341. if ($value['pid'] == $this->params['pid']) {
  342. $this->data['currProName'] = $value['pname'];
  343. $this->data['currProID'] = $value['pid'];
  344. } else {
  345. $this->data['othrPro'][] = $proArray[$key];
  346. }
  347. }
  348. }
  349. public function proSectionMeasure() {
  350. //此处未做更改,JSON文件已经固定名称
  351. $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  352. if (isset($jsonpath['dirname'])) {
  353. $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  354. if ($handle = opendir($extPathdir)) {
  355. while (false !== ($file = readdir($handle))) {
  356. $filename = NULL;
  357. $filename = pathinfo($file);
  358. if ($filename['extension'] == 'json')
  359. $proArray = json_decode(file_get_contents($extPathdir . '/' . $file), TRUE, JSON_UNESCAPED_UNICODE);
  360. }
  361. closedir($handle);
  362. }
  363. $this->data['proArray'] = $proArray['Bills'];
  364. }else {
  365. $this->data['proArray'] = [];
  366. }
  367. $this->data['mpid'] = $this->params['mpid'];
  368. $this->data['pid'] = $this->params['pid'];
  369. $this->render('w-project-section-measure', $this->data, TRUE);
  370. }
  371. public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0) {
  372. $count = mb_strlen($string, 'UTF-8'); //此处传入编码,建议使用utf-8。此处编码要与下面mb_substr()所使用的一致
  373. if (!$count) {
  374. return $string;
  375. }
  376. if ($len == 0) {
  377. $end = $count; //传入0则替换到最后
  378. } else {
  379. $end = $start + $len; //传入指定长度则为开始长度+指定长度
  380. }
  381. $i = 0;
  382. $returnString = '';
  383. while ($i < $count) { //循环该字符串
  384. $tmpString = mb_substr($string, $i, 1, 'UTF-8'); // 与mb_strlen编码一致
  385. if ($start <= $i && $i < $end) {
  386. $returnString .= $repalce;
  387. } else {
  388. $returnString .= $tmpString;
  389. }
  390. $i ++;
  391. }
  392. return $returnString;
  393. }
  394. function unicode_encode($name) {//to Unicode
  395. $name = iconv('UTF-8', 'UCS-2', $name);
  396. $len = strlen($name);
  397. $str = '';
  398. for ($i = 0; $i < $len - 1; $i = $i + 2) {
  399. $c = $name[$i];
  400. $c2 = $name[$i + 1];
  401. if (ord($c) > 0) {// 两个字节的字
  402. $str .= '\\' . base_convert(ord($c), 10, 16) . base_convert(ord($c2), 10, 16);
  403. } else {
  404. $str .= $c2;
  405. }
  406. }
  407. $str = strtoupper($str);
  408. return $str;
  409. }
  410. function unicode_decode($name) {//Unicode to
  411. $pattern = '/([\w]+)|(\\\u([\w]{4}))/i';
  412. preg_match_all($pattern, $name, $matches);
  413. if (!empty($matches)) {
  414. $name = '';
  415. for ($j = 0; $j < count($matches[0]); $j++) {
  416. $str = $matches[0][$j];
  417. if (strpos($str, '\\u') === 0) {
  418. $code = base_convert(substr($str, 2, 2), 16, 10);
  419. $code2 = base_convert(substr($str, 4), 16, 10);
  420. $c = chr($code) . chr($code2);
  421. $c = iconv('UCS-2', 'UTF-8', $c);
  422. $name .= $c;
  423. } else {
  424. $name .= $str;
  425. }
  426. }
  427. }
  428. return $name;
  429. }
  430. public function proDetail() {
  431. // 面包屑导航项目
  432. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  433. $this->data['pmid'] = $this->params['pmid'];
  434. $allproArray = $this->project->getAll();
  435. foreach ($allproArray as $kk => $vv) {
  436. if ($vv['pid'] == $this->params['pid']) {
  437. $this->data['currproArray'] = $vv;
  438. } else {
  439. $this->data['allproArray'][] = $vv;
  440. }
  441. }
  442. // 面包屑导航合同
  443. $conArray = $this->contractact->getAll();
  444. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  445. if (isset($measureArray['stid'])) {
  446. foreach ($conArray as $kkk => $vvv) {
  447. if ($vvv['stid'] == $measureArray['stid']) {
  448. $this->data['currconArray'] = $vvv;
  449. } else {
  450. if ($vvv['pid'] == $this->params['pid'])
  451. $this->data['allconArray'][] = $vvv;
  452. }
  453. }
  454. } else {
  455. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  456. }
  457. // 面包屑导航标段
  458. $this->data['curractmeasureArray'] = NULL;
  459. $this->data['allactmeasureArray'] = [];
  460. $actmeasureArray = $this->actmeasure->getAll();
  461. foreach ($actmeasureArray as $kkkk => $vvvv) {
  462. if ($vvvv['stid'] == $measureArray['stid']) {
  463. if (($vvvv['pmid'] == $this->params['pmid'])) {
  464. $this->data['curractmeasureArray'] = $vvvv;
  465. } else {
  466. $this->data['allactmeasureArray'][] = $vvvv;
  467. }
  468. }
  469. }
  470. // 图表
  471. $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']);
  472. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  473. foreach ($this->data['MeasureArray'] as $key => $value) {
  474. if ($measureArray['contracttotal'] > $value['currdone'] && $value['currdone'] > 0) {
  475. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  476. } else {
  477. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  478. }
  479. }
  480. $this->data['pmid'] = $this->params['pmid'];
  481. $this->data['pid'] = $this->params['pid'];
  482. $this->render('w-project-section-detail', $this->data, TRUE);
  483. }
  484. public function welcome() {
  485. // if (!$this->auth->isLoggedIn())
  486. // return Doo::conf()->APP_URL;
  487. if ($this->profile->getProWithUid($this->auth->getUid())['userid'])
  488. return Doo::conf()->APP_URL . 'project/list';
  489. if (isset($_POST['welform'])) {
  490. $profileUserArray = $_POST;
  491. $profileUserArray['userid'] = $this->auth->getUid();
  492. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  493. return Doo::conf()->APP_URL . 'project/list';
  494. }
  495. $this->render('welcome', $this->data);
  496. }
  497. public function prolist() {
  498. // if (!$this->auth->isLoggedIn())
  499. // return Doo::conf()->APP_URL;
  500. // $proArray = new stdClass();
  501. // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  502. // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  503. // if ($handle = opendir($extPathdir)) {
  504. // while (false !== ($file = readdir($handle))) {
  505. // $filename = pathinfo($file);
  506. // if ($filename['extension'] == 'json')
  507. // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
  508. // }
  509. // closedir($handle);
  510. // }
  511. // $this->data['proArray'] = null;
  512. $this->render('s-project
  513. ', $this->data);
  514. }
  515. // ajax提取密码名称
  516. public function getAjaxSection() {
  517. if (!$this->isAjax())
  518. return;
  519. echo json_encode($_POST);
  520. }
  521. }
  522. ?>