SProjectController.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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. /**
  15. * MainController
  16. * Feel free to delete the methods and replace them with your own code.
  17. *
  18. * @author darkredz
  19. */
  20. class SProjectController extends DooController
  21. {
  22. private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $measureauditact, $itemmeasurenum, $itemfle, $att;
  23. public function beforeRun($resource, $action)
  24. {
  25. // $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  26. // $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  27. // if (!$falg)
  28. // return Doo::acl()->defaultFailedRoute;
  29. if ($this->auth->getUid()) {
  30. $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  31. $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  32. if (!$falg)
  33. return Doo::acl()->defaultFailedRoute;
  34. } else {
  35. return Doo::acl()->defaultFailedRoute;
  36. }
  37. }
  38. public function __construct()
  39. {
  40. $this->auth = new Auth();
  41. $this->attfile = new attFile();
  42. $this->profile = new Profile();
  43. $this->project = new Project();
  44. $this->contractact = new Contractact();
  45. $this->actmeasure = new actMeasure();
  46. $this->numofperact = new NumofperAct();
  47. $this->measureauditact = new MeasureauditAct();
  48. $this->itemmeasurenum = new ItemMeasureNumpofper();
  49. $this->itemfle = new ItemFile();
  50. $this->att = new attachment();
  51. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  52. $this->data['currChannle'] = 's';
  53. $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
  54. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  55. if (isset($mpidArray[0]['pid'])) {
  56. foreach ($mpidArray as $key => $value) {
  57. // 审批操作按照时间排序多标段
  58. $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
  59. }
  60. }
  61. if ($this->data['numofchecking'] == 0) {
  62. $this->data['numofchecking'] = null;
  63. }
  64. }
  65. public function index()
  66. {
  67. $this->data['conArray'] = NULL;
  68. $conArray = $this->actmeasure->getGroupProject($this->auth->getUid());
  69. if (isset($conArray)) {
  70. foreach ($conArray as $k => $v) {
  71. $proArray = $this->project->getRowByPid($v['pid']);
  72. $this->data['conArray'][] = $proArray;
  73. $profileArray = $this->profile->getProWithUid($proArray['uid']);
  74. $this->data['conArray'][$k]['company'] = $profileArray['company'];
  75. $countMeasureInt = $this->actmeasure->getCountMeasure($v['stid']);
  76. $countTotalMeasureInt = $this->actmeasure->getMearsureCount($v['pid']);
  77. $this->data['conArray'][$k]['countmeasure'] = $countMeasureInt;
  78. $this->data['conArray'][$k]['countTotalMeasureInt'] = $countTotalMeasureInt;
  79. $this->data['conArray'][$k]['changTotal'] = $this->numofperact->getChangTotal($v['pid']);
  80. $this->data['conArray'][$k]['currdone'] = $this->numofperact->getCurrDoneNow($v['pid']);
  81. $this->data['conArray'][$k]['contracttotal'] = $this->actmeasure->getTotalWithPid($v['pid']);
  82. if ($this->data['conArray'][$k]['contracttotal']) {
  83. $this->data['conArray'][$k]['pcurrdone'] = round(($this->data['conArray'][$k]['currdone'] / $this->data['conArray'][$k]['contracttotal']) * 100) . '%';
  84. } else {
  85. $this->data['conArray'][$k]['pcurrdone'] = '0%';
  86. }
  87. $this->data['conArray'][$k]['bcontracttotal'] = number_format($this->data['conArray'][$k]['contracttotal'], 2, '.', ',');
  88. $this->data['conArray'][$k]['bchangTotal'] = number_format($this->data['conArray'][$k]['changTotal'], 2, '.', ',');
  89. }
  90. }
  91. $this->render('s-project', $this->data, TRUE);
  92. }
  93. public function proOverview()
  94. {
  95. // $this->data['pros'] = $this->project->getAll();
  96. // if (isset($_POST['pname']) && $_POST['pname']) {
  97. // $this->project->insertProject($_POST['pname']);
  98. // return Doo::conf()->APP_URL . 'project/index';
  99. // }
  100. $this->data['pid'] = $this->params['pid'];
  101. $this->render('w-project-detail', $this->data);
  102. }
  103. public function proSection()
  104. {
  105. $proArray = $this->actmeasure->getGroupProject($this->auth->getUid());
  106. foreach ($proArray as $v) {
  107. $pidArray[] = $v['pid'];
  108. }
  109. $pidstr = implode(',', $pidArray);
  110. // 项目名称
  111. $this->data['allproArray'] = $this->project->getFewRow($pidstr);
  112. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  113. // 标段按月进度
  114. for ($i = 1; $i <= 7; $i++) {
  115. $monthz[] = date('n月', strtotime('+' . $i . ' months', $this->data['currproArray']['intime']));
  116. if ($i == 1) {
  117. $ii = date('Y年', $this->data['currproArray']['intime']) . date('n月', strtotime('+' . $i . ' months', $this->data['currproArray']['intime']));
  118. } else {
  119. $ii = date('n月', strtotime('+' . $i . ' months', $this->data['currproArray']['intime']));
  120. }
  121. $this->data['months'][$i]['month'] = $ii;
  122. }
  123. // 标段
  124. // 搜索有没有相应的月份,有就把实际赋值,没有就为零
  125. $this->data['MeasureArray'] = $this->actmeasure->getRowsByPid($this->params['pid']);
  126. foreach ($this->data['MeasureArray'] as $key => $value) {
  127. $this->data['MeasureArray'][$key]['pmid'] = $value['pmid'];
  128. $this->data['MeasureArray'][$key]['type'] = $this->contractact->getRowByStid($value['stid'])['stname'];
  129. $numArray = $this->numofperact->getRowByPmid2($value['pmid']);
  130. $num = $num1 = 0;
  131. $this->data['MeasureArray'][$key]['num'] = $this->data['MeasureArray'][$key]['num1'] = NULL;
  132. foreach ($numArray as $k => $v) {
  133. if ($v['currstatus'] == 'checked') {
  134. $monthInt = date('n月', $v['audittime']);
  135. $retval = in_array($monthInt, $monthz);
  136. if ($retval) {
  137. $num = round(($v['currdone'] / $value['contracttotal']) * 100);
  138. $num1 = round(($v['curralltotal'] / $value['contracttotal']) * 100);
  139. }
  140. }
  141. $this->data['MeasureArray'][$key]['num'] .= $num . ',';
  142. $this->data['MeasureArray'][$key]['num1'] .= $num1 . ',';
  143. }
  144. $this->data['MeasureArray'][$key]['totalnum'] = $this->numofperact->getCountTotalnum($value['pmid']);
  145. $this->data['MeasureArray'][$key]['totalplus'] = number_format($this->actmeasure->getRowByPmid($value['pmid'])['contracttotal'], 2, '.', ',');
  146. $this->data['MeasureArray'][$key]['stopnow'] = $this->numofperact->getStopNowTotal($value['pmid'])['sntotal'];
  147. $this->data['MeasureArray'][$key]['nstopnow'] = number_format($this->numofperact->getStopNowTotal($value['pmid'])['sntotal'], 2, '.', ',');
  148. $this->data['MeasureArray'][$key]['currdone'] = $this->numofperact->getCurrdoneNew($value['pmid'])['currtotal'];
  149. $this->data['MeasureArray'][$key]['ncurrdone'] = number_format($this->data['MeasureArray'][$key]['currdone'], 2, '.', ',');
  150. $this->data['MeasureArray'][$key]['pstopnow'] = '0%';
  151. $this->data['MeasureArray'][$key]['pcurrdone'] = '0%';
  152. $this->data['MeasureArray'][$key]['pless'] = '0%';
  153. if ($value['contracttotal'] > 0) {
  154. $this->data['MeasureArray'][$key]['pstopnow'] = round(($this->data['MeasureArray'][$key]['stopnow'] / $value['contracttotal']) * 100);
  155. $this->data['MeasureArray'][$key]['dispstopnow'] = $this->data['MeasureArray'][$key]['pstopnow'] . '%';
  156. $this->data['MeasureArray'][$key]['pcurrdone'] = round(($this->data['MeasureArray'][$key]['currdone'] / $value['contracttotal']) * 100);
  157. $this->data['MeasureArray'][$key]['dispcurrdone'] = $this->data['MeasureArray'][$key]['pcurrdone'] . '%';
  158. $this->data['MeasureArray'][$key]['pless'] = (100 - $this->data['MeasureArray'][$key]['pstopnow'] - $this->data['MeasureArray'][$key]['pcurrdone']) . '%';
  159. }
  160. $this->data['MeasureArray'][$key]['nless'] = number_format($value['contracttotal'] - $this->data['MeasureArray'][$key]['stopnow'] - $this->data['MeasureArray'][$key]['currdone'], 2, '.', ',');
  161. $tenderArray = $this->numofperact->getRowTender2($value['pmid']);
  162. $this->data['MeasureArray'][$key]['ownstatus'] = '审批中';
  163. $ownerStatusArray = $this->measureauditact->getStatusTen($tenderArray['pmid'], $tenderArray['numpname']);
  164. if (isset($ownerStatusArray[0]['last']) && isset($ownerStatusArray[0]['mastatus']))
  165. if (($ownerStatusArray[0]['last'] == 1) && ($ownerStatusArray[0]['mastatus'] == 'checked')) {
  166. $this->data['MeasureArray'][$key]['ownstatus'] = '已审批';
  167. } else {
  168. $this->data['MeasureArray'][$key]['ownstatus'] = '审批中';
  169. }
  170. }
  171. $this->render('s-project-section', $this->data, TRUE);
  172. }
  173. public function proDetail()
  174. {
  175. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  176. $proArray = $this->actmeasure->getGroupProject($this->auth->getUid());
  177. foreach ($proArray as $v) {
  178. $pidArray[] = $v['pid'];
  179. }
  180. $pidstr = implode(',', $pidArray);
  181. // 项目名称
  182. $allproArray = $this->project->getFewRow($pidstr);
  183. // 面包屑导航项目
  184. foreach ($allproArray as $kk => $vv) {
  185. if ($vv['pid'] == $this->params['pid']) {
  186. $this->data['currproArray'] = $vv;
  187. } else {
  188. $this->data['allproArray'][] = $vv;
  189. }
  190. }
  191. // 面包屑导航合同
  192. $conArray = $this->contractact->getAll();
  193. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  194. if (isset($measureArray['stid'])) {
  195. foreach ($conArray as $kkk => $vvv) {
  196. if ($vvv['stid'] == $measureArray['stid']) {
  197. $this->data['currconArray'] = $vvv;
  198. } else {
  199. if ($vvv['pid'] == $this->params['pid'])
  200. $this->data['allconArray'][] = $vvv;
  201. }
  202. }
  203. } else {
  204. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  205. }
  206. // 面包屑导航标段
  207. $this->data['curractmeasureArray'] = NULL;
  208. $this->data['allactmeasureArray'] = [];
  209. $actmeasureArray = $this->actmeasure->getAll();
  210. foreach ($actmeasureArray as $kkkk => $vvvv) {
  211. if ($vvvv['stid'] == $measureArray['stid']) {
  212. if (($vvvv['pmid'] == $this->params['pmid'])) {
  213. $this->data['curractmeasureArray'] = $vvvv;
  214. } else {
  215. $this->data['allactmeasureArray'][] = $vvvv;
  216. }
  217. }
  218. }
  219. // 图标
  220. $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']);
  221. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  222. foreach ($this->data['MeasureArray'] as $key => $value) {
  223. if ($measureArray['contracttotal'] > ($value['currdone'] > 0)) {
  224. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  225. } else {
  226. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  227. }
  228. }
  229. $this->data['pid'] = $this->params['pid'];
  230. $this->data['pmid'] = $this->params['pmid'];
  231. // 获取当前合同段的期数
  232. // $this->data['allNumArray'] = $this->numofperact->getNumByStid(1);
  233. $this->render('s-project-section-detail', $this->data, TRUE);
  234. }
  235. public function proMeasure()
  236. {
  237. $MpidArray = $this->measureauditact->getRowByMpid(1);
  238. foreach ($MpidArray as $key => $value) {
  239. $uidArray = $value['uid'];
  240. }
  241. $this->data['pid'] = $this->params['pid'];
  242. $this->render('s-project-section-measure', $this->data);
  243. }
  244. Function fNumber($number)
  245. {
  246. if ($number == '')
  247. Return "-";
  248. $nlen = strlen($number);
  249. while ($nlen > 3) {
  250. $fNumber = "," . substr($number, $nlen - 3, 3);
  251. $number = substr($number, 0, -3);
  252. $nlen = strlen($number);
  253. }
  254. if ($nlen <= 3) {
  255. $fNumber = $number . $fNumber;
  256. }
  257. Return $fNumber;
  258. }
  259. public function welcome()
  260. {
  261. // if (!$this->auth->isLoggedIn())
  262. // return Doo::conf()->APP_URL;
  263. if ($this->profile->getProWithUid($_SESSION['uid'])['userid'])
  264. return Doo::conf()->APP_URL . 'project/list';
  265. if (isset($_POST['welform'])) {
  266. $profileUserArray = $_POST;
  267. $profileUserArray['userid'] = $_SESSION['uid'];
  268. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  269. return Doo::conf()->APP_URL . 'project/list';
  270. }
  271. $this->render('welcome', $this->data);
  272. }
  273. public function prolist()
  274. {
  275. // if (!$this->auth->isLoggedIn())
  276. // return Doo::conf()->APP_URL;
  277. // $proArray = new stdClass();
  278. // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  279. // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  280. // if ($handle = opendir($extPathdir)) {
  281. // while (false !== ($file = readdir($handle))) {
  282. // $filename = pathinfo($file);
  283. // if ($filename['extension'] == 'json')
  284. // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
  285. // }
  286. // closedir($handle);
  287. // }
  288. // $this->data['proArray'] = null;
  289. $this->render('s-project', $this->data);
  290. }
  291. function proSectionFiles()
  292. {
  293. if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
  294. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  295. if ($imnidArray['iaid'] > 0) {
  296. $fileArray = $this->upItemFile('file')[0];
  297. if (isset($fileArray['filepath'])) {
  298. $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  299. if (isset($itemArray)) {
  300. if ($itemArray['oldiaid'] > 0) {
  301. $oldiaid = $itemArray['oldiaid'];
  302. } else {
  303. $oldiaid = $imnidArray['iaid'];
  304. }
  305. $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);
  306. $iaid = $this->itemfle->insertItemFileRecord($postArray);
  307. if ($iaid > 1) {
  308. $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
  309. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  310. die();
  311. }
  312. }
  313. }
  314. }
  315. }
  316. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  317. ini_set('display_errors', 1);
  318. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  319. if ($imnidArray['iaid'] > 0) {
  320. $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
  321. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  322. die();
  323. }
  324. }
  325. if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
  326. $filename = $_POST['filename'];
  327. $filedesc = $_POST['filedesc'];
  328. $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
  329. if ($imnidArray['iaid'] > 0) {
  330. if (isset($filedesc))
  331. $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc, 0);
  332. if (isset($filename))
  333. $this->itemfle->updateItemFields($imnidArray['iaid'], $filename, 0);
  334. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  335. die();
  336. }
  337. }
  338. // 面包屑导航项目
  339. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  340. $this->data['pmid'] = $this->params['pmid'];
  341. $allproArray = $this->project->getAll();
  342. foreach ($allproArray as $kk => $vv) {
  343. if ($vv['pid'] == $this->params['pid']) {
  344. $this->data['currproArray'] = $vv;
  345. } else {
  346. $this->data['allproArray'][] = $vv;
  347. }
  348. }
  349. // 面包屑导航合同
  350. $conArray = $this->contractact->getAll();
  351. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  352. if (isset($measureArray['stid'])) {
  353. foreach ($conArray as $kkk => $vvv) {
  354. if ($vvv['stid'] == $measureArray['stid']) {
  355. $this->data['currconArray'] = $vvv;
  356. } else {
  357. if ($vvv['pid'] == $this->params['pid'])
  358. $this->data['allconArray'][] = $vvv;
  359. }
  360. }
  361. } else {
  362. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  363. }
  364. // 面包屑导航标段
  365. $this->data['curractmeasureArray'] = NULL;
  366. $this->data['allactmeasureArray'] = [];
  367. $actmeasureArray = $this->actmeasure->getAll();
  368. foreach ($actmeasureArray as $kkkk => $vvvv) {
  369. if ($vvvv['stid'] == $measureArray['stid']) {
  370. if (($vvvv['pmid'] == $this->params['pmid'])) {
  371. $this->data['curractmeasureArray'] = $vvvv;
  372. } else {
  373. $this->data['allactmeasureArray'][] = $vvvv;
  374. }
  375. }
  376. }
  377. // 选取查询
  378. $groupArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
  379. $this->data['groupArray'] = $groupArray;
  380. $owneridArray = $this->itemfle->getGroupOwnerid($this->params['pmid']);
  381. foreach ($owneridArray as $k => $v) {
  382. $this->data['owneridArray'][$k]['name'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  383. $this->data['owneridArray'][$k]['iaid'] = $v['iaid'];
  384. $this->data['owneridArray'][$k]['ownerid'] = $v['ownerid'];
  385. }
  386. // 分页
  387. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid'], 0, $this->params['numpname'], $this->params['userid']);
  388. if ($totalArchive) {
  389. if ($this->params['numpname'] && $this->params['userid']) {
  390. $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);
  391. } elseif ($this->params['numpname']) {
  392. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/page', $totalArchive, 20, 100);
  393. } elseif ($this->params['userid']) {
  394. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  395. } else {
  396. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/page', $totalArchive, 20, 100);
  397. }
  398. $pager->setCss('', 'disabled', 'active');
  399. if (isset($this->params['pindex']))
  400. $pager->paginate(intval($this->params['pindex']));
  401. else
  402. $pager->paginate(1);
  403. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid'], $pager->limit, $this->params['numpname'], $this->params['userid']);
  404. }
  405. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  406. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  407. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  408. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  409. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  410. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  411. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  412. }
  413. $this->data['pid'] = $this->params['pid'];
  414. $this->data['pmid'] = $this->params['pmid'];
  415. $this->data['mpid'] = $this->params['mpid'];
  416. $this->data['userid'] = $this->params['userid'];
  417. $this->data['num'] = $this->params['numpname'];
  418. $this->data['pager'] = $pager->output;
  419. $this->render('s-project-section-files', $this->data, TRUE);
  420. }
  421. function proSectionFilesRecover()
  422. {
  423. if (isset($_POST['optype']) && ($_POST['optype'] == 'reconvery') && isset($_POST['imnid'])) {
  424. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  425. if ($imnidArray['iaid'] > 0) {
  426. $this->itemmeasurenum->recoveryDel($_POST['imnid']);
  427. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  428. die();
  429. }
  430. }
  431. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  432. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  433. if ($imnidArray['iaid'] > 0) {
  434. $iaidArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  435. if ($iaidArray['ownerid'] == $this->auth->getUid()) {
  436. $this->itemfle->delItem($imnidArray['iaid']);
  437. $this->itemmeasurenum->delItemIAID($imnidArray['iaid']);
  438. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  439. die();
  440. } else {
  441. echo json_encode(array('status' => 2), JSON_UNESCAPED_UNICODE);
  442. die();
  443. }
  444. }
  445. }
  446. // 面包屑导航项目
  447. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  448. $this->data['pmid'] = $this->params['pmid'];
  449. $allproArray = $this->project->getAll();
  450. foreach ($allproArray as $kk => $vv) {
  451. if ($vv['pid'] == $this->params['pid']) {
  452. $this->data['currproArray'] = $vv;
  453. } else {
  454. $this->data['allproArray'][] = $vv;
  455. }
  456. }
  457. // 面包屑导航合同
  458. $conArray = $this->contractact->getAll();
  459. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  460. if (isset($measureArray['stid'])) {
  461. foreach ($conArray as $kkk => $vvv) {
  462. if ($vvv['stid'] == $measureArray['stid']) {
  463. $this->data['currconArray'] = $vvv;
  464. } else {
  465. if ($vvv['pid'] == $this->params['pid'])
  466. $this->data['allconArray'][] = $vvv;
  467. }
  468. }
  469. } else {
  470. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  471. }
  472. // 面包屑导航标段
  473. $this->data['curractmeasureArray'] = NULL;
  474. $this->data['allactmeasureArray'] = [];
  475. $actmeasureArray = $this->actmeasure->getAll();
  476. foreach ($actmeasureArray as $kkkk => $vvvv) {
  477. if ($vvvv['stid'] == $measureArray['stid']) {
  478. if (($vvvv['pmid'] == $this->params['pmid'])) {
  479. $this->data['curractmeasureArray'] = $vvvv;
  480. } else {
  481. $this->data['allactmeasureArray'][] = $vvvv;
  482. }
  483. }
  484. }
  485. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
  486. if ($totalArchive) {
  487. $pager = new DooPager(Doo::conf()->APP_URL . 'sproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/recover/page', $totalArchive, 20, 100);
  488. $pager->setCss('', 'disabled', 'active');
  489. if (isset($this->params['pindex']))
  490. $pager->paginate(intval($this->params['pindex']));
  491. else
  492. $pager->paginate(1);
  493. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNumDel($pager->limit, $this->params['pmid']);
  494. }
  495. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  496. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  497. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  498. $this->data['itemMeasureArray'][$k]['delname'] = $this->profile->getProWithUid($v['deluid'])['name'];
  499. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  500. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  501. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  502. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  503. $this->data['itemMeasureArray'][$k]['filepath'] = $fileArray['filepath'];
  504. }
  505. $this->data['pid'] = $this->params['pid'];
  506. $this->data['pmid'] = $this->params['pmid'];
  507. $this->data['mpid'] = $this->params['mpid'];
  508. $this->data['pager'] = $pager->output;
  509. $this->render('s-project-section-files-recover', $this->data, TRUE);
  510. }
  511. }
  512. ?>