doclibs.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * The doclibs 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 doclibsEntry extends entry
  13. {
  14. /**
  15. * GET method.
  16. *
  17. * @access public
  18. * @return string
  19. */
  20. public function get()
  21. {
  22. $type = $this->param('type', 0);
  23. $objectID = $this->param('objectID', 0);
  24. $libs = $this->loadModel('doc')->getLibs($type, $this->param('extra', ''), $this->param('appendLibs', ''), $objectID);
  25. $result = array();
  26. foreach($libs as $libID => $libName)
  27. {
  28. $lib = new stdclass();
  29. $lib->id = $libID;
  30. $lib->name = $libName;
  31. $result[] = $lib;
  32. }
  33. krsort($result);
  34. return $this->send(200, array('libs' => array_values($result)));
  35. }
  36. }