v1.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * The taskAssignedTo widget class file of zin module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(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 zin
  9. * @link http://www.zentao.net
  10. */
  11. namespace zin;
  12. class taskAssignedTo extends wg
  13. {
  14. /**
  15. * @var mixed[]
  16. */
  17. protected static $defineProps = array(
  18. 'id?: string', // 控件 ID。
  19. 'name?: string="assignedTo"', // 控件名称。
  20. 'value?: string', // 控件默认值。
  21. 'required?: bool=false', // 是否必填。
  22. 'items?: array', // picker 列表项或列表项获取方法。
  23. 'manageLink?: string' // 维护团队成员链接
  24. );
  25. public static function getPageCSS()
  26. {
  27. return file_get_contents(__DIR__ . DS . 'css' . DS . 'v1.css');
  28. }
  29. public static function getPageJS()
  30. {
  31. return file_get_contents(__DIR__ . DS . 'js' . DS . 'v1.js');
  32. }
  33. protected function build()
  34. {
  35. global $app, $lang;
  36. $app->loadLang('execution');
  37. $manageLink = $this->prop('manageLink');
  38. if($this->prop('multiple') || $manageLink)
  39. {
  40. $pickerToolbar = array();
  41. if($this->prop('multiple'))
  42. {
  43. $pickerToolbar[] = array('key' => 'selectAll', 'text' => $lang->selectAll);
  44. $pickerToolbar[] = array('key' => 'cancelSelect', 'text' => $lang->cancelSelect);
  45. $this->setProp('menu', array('checkbox' => true));
  46. }
  47. if($manageLink) $pickerToolbar[] = array('className' => 'text-primary manageTeamBtn', 'key' => 'manageTeam', 'text' => $lang->execution->manageTeamMember, 'icon' => 'plus-solid-circle', 'url' => $manageLink, 'data-toggle' => 'modal', 'data-size' => 'lg', 'data-dismiss' => 'pick');
  48. $this->setProp('toolbar', $pickerToolbar);
  49. }
  50. return picker
  51. (
  52. setClass('taskAssignedToBox'),
  53. set($this->props->pick(array('id', 'name', 'class', 'value', 'required', 'items', 'toolbar', 'menu', 'multiple', 'disabled')))
  54. );
  55. }
  56. }