profile.html.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. /**
  3. * The profile view file of user 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 Wang Yidong <yidong@easycorp.ltd>
  7. * @package user
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('avatar', $this->app->user->avatar);
  12. jsVar('userID', $this->app->user->id);
  13. $groupName = '';
  14. foreach($groups as $group) $groupName .= $group->name . ' ';
  15. $deptName = '/';
  16. if($deptPath)
  17. {
  18. $deptName = array();
  19. foreach($deptPath as $key => $dept) $deptName[] = $dept->name;
  20. $deptName = implode($lang->arrow, $deptName);
  21. };
  22. $getItems = function($datas)
  23. {
  24. $cells = array();
  25. foreach($datas as $field => $data)
  26. {
  27. $cells[] = cell
  28. (
  29. set::width('50%'),
  30. set::className('flex py-2 ' . $field),
  31. cell
  32. (
  33. set::width('70px'),
  34. set::className('text-right'),
  35. span(set::className('text-gray'), $data['label'])
  36. ),
  37. cell
  38. (
  39. set::flex('1'),
  40. set::className('ml-2'),
  41. $data['value']
  42. )
  43. );
  44. }
  45. return $cells;
  46. };
  47. div
  48. (
  49. div
  50. (
  51. set::className('center'),
  52. div
  53. (
  54. userAvatar(set::user($user), set::size('lg')),
  55. formbase(set::id('avatarForm'), set::className('hidden'), set::url(createLink('my', 'uploadAvatar')), upload())
  56. ),
  57. div
  58. (
  59. span(setClass('text-md text-black'), $user->realname),
  60. zget($lang->user->roleList, $user->role, '') == '' ? null : span
  61. (
  62. setClass('text-base text-gray ml-1'),
  63. '(' . zget($lang->user->roleList, $user->role) . ')'
  64. )
  65. )
  66. ),
  67. formRowGroup(set::title($lang->my->form->lblBasic)),
  68. div
  69. (
  70. set::className('py-2 flex flex-wrap basic-info'),
  71. $getItems(array('realname' => array('label' => $lang->user->realname, 'value' => $user->realname))),
  72. $getItems(array('gender' => array('label' => $lang->user->gender, 'value' => zget($lang->user->genderList, $user->gender)))),
  73. $getItems(array('account' => array('label' => $lang->user->account, 'value' => $user->account))),
  74. $getItems(array('email' => array('label' => $lang->user->email, 'value' => $user->email ? a(set::href("mailto:{$user->email}"), $user->email, set::target('_self')) : ''))),
  75. $getItems(array('dept' => array('label' => $lang->user->dept, 'value' => html($deptName)))),
  76. $getItems(array('role' => array('label' => $lang->user->role, 'value' => zget($lang->user->roleList, $user->role, '')))),
  77. $getItems(array('join' => array('label' => $lang->user->abbr->join, 'value' => formatTime($user->join)))),
  78. $getItems(array('priv' => array('label' => $lang->user->priv, 'value' => trim($groupName))))
  79. ),
  80. formRowGroup(set::title($lang->my->form->lblContact)),
  81. div
  82. (
  83. set::className('py-2 flex flex-wrap contact-info'),
  84. $getItems(array('mobile' => array('label' => $lang->user->mobile, 'value' => $user->mobile))),
  85. $getItems(array('weixin' => array('label' => $lang->user->weixin, 'value' => $user->weixin))),
  86. $getItems(array('phone' => array('label' => $lang->user->phone, 'value' => $user->phone))),
  87. $getItems(array('qq' => array('label' => $lang->user->qq, 'value' => $user->qq))),
  88. $getItems(array('zipcode' => array('label' => $lang->user->zipcode, 'value' => $user->zipcode))),
  89. $getItems(array('address' => array('label' => $lang->user->abbr->address, 'value' => $user->address)))
  90. ),
  91. formRowGroup(set::title($lang->my->form->lblAccount)),
  92. div
  93. (
  94. set::className('py-2 flex flex-wrap account-info'),
  95. $getItems(array('commiter' => array('label' => $lang->user->commiter, 'value' => $user->commiter))),
  96. $getItems(array('skype' => array('label' => $lang->user->skype, 'value' => $user->skype ? a(set::href("callto://{$user->skype}"), $user->skype) : ''))),
  97. $getItems(array('visits' => array('label' => $lang->user->visits, 'value' => $user->visits))),
  98. $getItems(array('whatsapp' => array('label' => $lang->user->whatsapp, 'value' => $user->whatsapp))),
  99. $getItems(array('last' => array('label' => $lang->user->last, 'value' => $user->last))),
  100. $getItems(array('slack' => array('label' => $lang->user->slack, 'value' => $user->slack))),
  101. $getItems(array('ip' => array('label' => $lang->user->ip, 'value' => $user->ip))),
  102. $getItems(array('dingding' => array('label' => $lang->user->dingding, 'value' => $user->dingding)))
  103. ),
  104. center
  105. (
  106. setClass('w-full actions-menu my-profile'),
  107. floatToolbar
  108. (
  109. set::object($user),
  110. set::main(array(
  111. common::hasPriv('my', 'changepassword') ? array('text' => $lang->changePassword, 'data-toggle' => 'modal', 'url' => createLink('my', 'changepassword')) : null,
  112. common::hasPriv('my', 'editprofile') ? array('text' => $lang->user->editProfile, 'data-toggle' => 'modal', 'url' => createLink('my', 'editprofile')) : null,
  113. common::hasPriv('my', 'uploadAvatar') ? array('text' => $lang->my->uploadAvatar, 'data-on' => 'click', 'data-call' => 'uploadAvatar') : null
  114. ))
  115. )
  116. )
  117. );
  118. render();