batchcreate.bizext.html.hook.php 914 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php if(!empty($properties['user'])):?>
  2. <?php
  3. $userMaxCount = $properties['user']['value'];
  4. $userCount = $this->dao->select("COUNT('*') as count")->from(TABLE_USER)
  5. ->where('deleted')->eq(0)
  6. ->fetch('count');
  7. js::set('userCount', $userCount);
  8. js::set('userMaxCount', $userMaxCount);
  9. js::set('noticeUserCreate', str_replace('%maxcount%', $userMaxCount, $lang->user->noticeUserCreate));
  10. ?>
  11. <script>
  12. $(function()
  13. {
  14. $('#submit').click(function()
  15. {
  16. if(userMaxCount > 0)
  17. {
  18. var allUserCount = parseInt(userCount);
  19. $('[id^="account"]').each(function()
  20. {
  21. if($(this).val()) allUserCount += 1;
  22. });
  23. if(allUserCount > userMaxCount)
  24. {
  25. alert(noticeUserCreate.replace('%usercount%', allUserCount));
  26. return false;
  27. }
  28. }
  29. })
  30. })
  31. </script>
  32. <?php endif;?>