create.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * The create control file of client module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Gang Liu <liugang@easycorp.ltd>
  7. * @package client
  8. * @link https://www.zentao.net
  9. */
  10. class client extends control
  11. {
  12. /**
  13. * 添加一个客户端版本。
  14. * Create a client version.
  15. *
  16. * @access public
  17. * @return void
  18. */
  19. public function create()
  20. {
  21. $this->checkSafeFile();
  22. if($_POST)
  23. {
  24. $this->post->set('desc', mb_substr($this->post->desc, 0, 100));
  25. $this->client->create();
  26. if(dao::isError())
  27. {
  28. $error = dao::getError();
  29. while(is_array($error)) $error = current($error);
  30. return $this->send(array('result' => 'fail', 'callback' => "zui.Modal.alert({message: {html: \"$error\"}, size: 'sm'})"));
  31. }
  32. return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'load' => true));
  33. }
  34. $this->view->title = $this->lang->client->create;
  35. $this->display();
  36. }
  37. }