browse.html.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * The browse view file of webhook 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 Yidong Wang <yidong@easycorp.ltd>
  7. * @package webhook
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. featureBar();
  12. toolbar(item(set(array
  13. (
  14. 'id' => 'createBtn',
  15. 'text' => $lang->webhook->create,
  16. 'icon' => 'plus',
  17. 'class' => 'primary',
  18. 'url' => (common::hasPriv('webhook', 'create') and ($app->rawMethod == 'browse') or $app->rawMethod == 'log') ? createLink('webhook', 'create') : null
  19. ))));
  20. $cols = $config->webhook->dtable->fieldList;
  21. $data = array();
  22. foreach($webhooks as $webhook)
  23. {
  24. $webhook->actions = array();
  25. $canChooseDept = (($webhook->type == 'dinguser' or $webhook->type == 'feishuuser') and common::hasPriv('webhook', 'chooseDept'));
  26. $canBind = ($webhook->type == 'wechatuser' and common::hasPriv('webhook', 'bind'));
  27. $canSeeLog = common::hasPriv('webhook', 'log');
  28. $canEdit = common::hasPriv('webhook', 'edit');
  29. $canDelete = common::hasPriv('webhook', 'delete');
  30. if(!$canBind) $webhook->actions[] = array('name' => 'chooseDept', 'disabled' => !$canChooseDept, 'url' => createLink('webhook', 'chooseDept', "webhookID={$webhook->id}"), 'title' => $lang->webhook->chooseDept);
  31. if($canBind) $webhook->actions[] = array('name' => 'bind', 'url' => createLink('webhook', 'bind', "webhookID={$webhook->id}"), 'title' => $lang->webhook->bind);
  32. $webhook->actions[] = array('name' => 'log', 'disabled' => !$canSeeLog, 'url' => createLink('webhook', 'log', "webhookID={$webhook->id}"), 'title' => $lang->webhook->log);
  33. $webhook->actions[] = array('name' => 'edit', 'disabled' => !$canEdit, 'url' => createLink('webhook', 'edit', "webhookID={$webhook->id}"), 'title' => $lang->webhook->edit);
  34. $webhook->actions[] = array('name' => 'delete', 'disabled' => !$canDelete, 'url' => createLink('webhook', 'delete', "webhookID={$webhook->id}&confirm=yes"), 'title' => $lang->webhook->delete, 'className' => 'ajax-submit', 'data-confirm' => $lang->webhook->confirmDelete);
  35. $webhook->type = zget($lang->webhook->typeList, $webhook->type);
  36. $data[] = $webhook;
  37. }
  38. dtable
  39. (
  40. set::id('webhookList'),
  41. set::checkable(false),
  42. set::cols($cols),
  43. set::data($data),
  44. set::sortLink(createLink('webhook', 'browse', "orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  45. set::orderBy($orderBy),
  46. set::footPager(usePager())
  47. );
  48. render();