tao.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * The tao file of custom module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Shujie Tian <tianshujie@easycorp.ltd>
  8. * @package custom
  9. * @link https://www.zentao.net
  10. */
  11. class customTao extends customModel
  12. {
  13. /**
  14. * 获取更新项目权限的数据。
  15. * Get data for update project acl.
  16. *
  17. * @access protected
  18. * @return array
  19. */
  20. protected function getDataForUpdateProjectAcl()
  21. {
  22. $projectGroup = $this->dao->select('id,parent,whitelist,acl')->from(TABLE_PROJECT)
  23. ->where('parent')->ne('0')
  24. ->andwhere('type')->eq('project')
  25. ->andWhere('acl')->eq('program')
  26. ->fetchGroup('parent', 'id');
  27. $programPM = $this->dao->select("id,PM")->from(TABLE_PROGRAM)
  28. ->where('id')->in(array_keys($projectGroup))
  29. ->andWhere('type')->eq('program')
  30. ->fetchPairs();
  31. $stakeholders = $this->dao->select('*')->from(TABLE_STAKEHOLDER)
  32. ->where('objectType')->eq('program')
  33. ->andWhere('objectID')->in(array_keys($projectGroup))
  34. ->fetchGroup('objectID', 'user');
  35. return array($projectGroup, $programPM, $stakeholders);
  36. }
  37. /**
  38. * 获取自定义语言项。
  39. * Get custom lang.
  40. *
  41. * @access protected
  42. * @return array|false
  43. */
  44. protected function getCustomLang()
  45. {
  46. $currentLang = $this->app->getClientLang();
  47. $allCustomLang = array();
  48. try
  49. {
  50. $sql = $this->dao->select('*')->from(TABLE_LANG)->where('`lang`')->in("$currentLang,all")->andWhere('vision')->in("{$this->config->vision},all")->orderBy('lang,id')->get();
  51. $stmt = $this->app->dbQuery($sql);
  52. $allCustomLang = array();
  53. while($row = $stmt->fetch())
  54. {
  55. /* Replace common lang for menu. */
  56. if(strpos($row->module, 'Menu') !== false || strpos($row->section, 'featureBar-') !== false || $row->section == 'mainNav' || strpos($row->section, 'moreSelects-') !== false)
  57. {
  58. $row->value = strtr($row->value, $this->config->custom->commonLang);
  59. }
  60. $allCustomLang[$row->id] = $row;
  61. }
  62. }
  63. catch(PDOException $e)
  64. {
  65. return false;
  66. }
  67. return $allCustomLang;
  68. }
  69. }