manage.ctrl.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('webapp');
  8. $account_info = permission_user_account_num();
  9. $do = safe_gpc_belong($do, array('create', 'list', 'create_display'), 'list');
  10. if($do == 'create') {
  11. if(!checksubmit()) {
  12. echo '非法提交';
  13. return;
  14. }
  15. if (!webapp_can_create($_W['uid'])) {
  16. itoast('创建PC个数已满', url('webapp/manage/list'));
  17. }
  18. $data = array(
  19. 'name' => safe_gpc_string($_GPC['name']),
  20. 'description' => safe_gpc_string($_GPC['description'])
  21. );
  22. $webapp = table('webapp');
  23. $uniacid = $webapp->createWebappInfo($data, $_W['uid']);
  24. if($uniacid){
  25. itoast('创建成功', url('webapp/manage/list'));
  26. }
  27. }
  28. if($do == 'create_display') {
  29. if(!webapp_can_create($_W['uid'])) {
  30. itoast('', url('webapp/manage/list'));
  31. }
  32. template('webapp/create');
  33. }
  34. if($do == 'list') {
  35. $pindex = max(1, intval($_GPC['page']));
  36. $psize = 15;
  37. $account_table = table('webapp');
  38. $account_table->searchWithType(array(ACCOUNT_TYPE_WEBAPP_NORMAL));
  39. $keyword = trim($_GPC['keyword']);
  40. if (!empty($keyword)) {
  41. $account_table->searchWithKeyword($keyword);
  42. }
  43. $account_table->accountRankOrder();
  44. $account_table->searchWithPage($pindex, $psize);
  45. $list = $account_table->searchAccountList();
  46. $total = $account_table->getLastQueryTotal();
  47. $pager = pagination($total, $pindex, $psize);
  48. if (!empty($list)) {
  49. foreach ($list as &$account) {
  50. $account = uni_fetch($account['uniacid']);
  51. $account['switchurl'] = url('webapp/home/switch', array('uniacid' => $account['uniacid']));
  52. }
  53. }
  54. template('webapp/list');
  55. }