SProjectController.php 43 KB

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