zen.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * The zen file of index 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 Yidong Wang <yidong@easycorp.ltd>
  8. * @package index
  9. * @link https://www.zentao.net
  10. */
  11. class indexZen extends index
  12. {
  13. /**
  14. * 检查是否显示新功能。
  15. * Check fhow new features or not.
  16. *
  17. * @access protected
  18. * @return bool
  19. */
  20. protected function checkShowFeatures()
  21. {
  22. if($this->config->edition == 'ipd') return false;
  23. foreach($this->config->newFeatures as $feature)
  24. {
  25. $accounts = zget($this->config->global, 'skip' . ucfirst($feature), '');
  26. if(strpos(",$accounts,", ",{$this->app->user->account},") === false) return true;
  27. }
  28. return false;
  29. }
  30. /**
  31. * 根据对象类型,获取资产库中的该对象的详情页面方法。
  32. * Get view method for asset lib by object type.
  33. *
  34. * @param int $objectID
  35. * @param string $objectType
  36. * @access protected
  37. * @return string
  38. */
  39. protected function getViewMethodForAssetLib($objectID, $objectType)
  40. {
  41. if(!isset($this->config->maxVersion)) return '';
  42. $table = zget($this->config->objectTables, $objectType, '');
  43. if(empty($table)) return '';
  44. $field = $objectType == 'doc' ? 'assetLibType' : 'lib';
  45. $objectLib = $this->dao->select($field)->from($table)->where('id')->eq($objectID)->fetch($field);
  46. if(empty($objectLib)) return '';
  47. if($objectType == 'doc') return $objectLib == 'practice' ? 'practiceView' : 'componentView';
  48. $this->app->loadConfig('action');
  49. return zget($this->config->action->assetViewMethod, $objectType, '');
  50. }
  51. }