modules.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * The modules entry point of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Chunsheng Wang <chunsheng@cnezsoft.com>
  8. * @package entries
  9. * @version 1
  10. * @link https://www.zentao.net
  11. */
  12. class modulesEntry extends entry
  13. {
  14. /**
  15. * Get method.
  16. *
  17. * @access public
  18. * @return string
  19. */
  20. public function get()
  21. {
  22. $objectType = $this->param('type', '');
  23. $objectID = $this->param('id', '');
  24. if(!$objectType or !$objectID) return $this->sendError(400, 'Need id and type.');
  25. if(!in_array($objectType, array('story', 'task', 'bug', 'case', 'feedback', 'product'))) return $this->sendError(400, 'Type is not allowed');
  26. if($objectType == 'task')
  27. {
  28. $control = $this->loadController('tree', 'browsetask');
  29. $control->browseTask($objectID);
  30. }
  31. else
  32. {
  33. $control = $this->loadController('tree', 'browse');
  34. $control->browse($objectID, $objectType);
  35. }
  36. $data = $this->getData();
  37. if(isset($data->status) and $data->status == 'success') return $this->send(200, array('modules' => $data->data->tree));
  38. return $this->send400(isset($data->message) ? $data->message: 'error');
  39. }
  40. }