wsq_join_test.inc.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: install.php 34718 2014-07-14 08:56:39Z nemohou $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if(!$_G['uid']) {
  12. showmessage('not_loggedin', NULL, array(), array('login' => 1));
  13. }
  14. $tid = intval($_GET['tid']);
  15. $items = DB::fetch_first("SELECT * FROM ".DB::table('xj_event')." WHERE tid = '$tid'");
  16. $thread = DB::fetch_first("SELECT subject FROM ".DB::table('forum_thread')." WHERE tid = '$tid'");
  17. $setting = unserialize($items['setting']);
  18. $userfield = unserialize($items['userfield']);
  19. $selectuserfield = unserialize($items['userfield']);
  20. if($selectuserfield) {
  21. if($selectuserfield) {
  22. $htmls = $settings = array();
  23. require_once libfile('function/profile');
  24. foreach($selectuserfield as $fieldid) {
  25. if(empty($ufielddata['userfield'])) {
  26. $memberprofile = C::t('common_member_profile')->fetch($_G['uid']);
  27. foreach($selectuserfield as $val) {
  28. $ufielddata['userfield'][$val] = $memberprofile[$val];
  29. }
  30. unset($memberprofile);
  31. }
  32. $html = profile_setting($fieldid, $ufielddata['userfield'], false, true);
  33. if($html) {
  34. $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
  35. $htmls[$fieldid] = $html;
  36. }
  37. }
  38. }
  39. } else {
  40. $selectuserfield = '';
  41. }
  42. $applynumber = array();
  43. for($i=1;$i<=$items['event_number_max'];$i++){
  44. $applynumber[] = $i;
  45. }
  46. ?>
  47. <script type="text/javascript" src="http://wsq.discuz.qq.com/cdn/discuz/js/openjs.js"></script>
  48. <script>
  49. var menu = new Array();
  50. WSQ.initBtmBar(menu);
  51. WSQ.showBtmBar();
  52. WSQ.initPlugin({name:'<?php echo $thread['subject'].lang('plugin/xj_event', 'baomin'); ?>'});
  53. var initWx = {
  54. 'img': '<?php echo $_G['siteurl']; ?>/static/image/common/logo.png',
  55. 'desc': '<?php echo $_G['bbsname'].lang('plugin/xj_event', 'huodzx'); ?>',
  56. 'title': '<?php echo $thread['subject']; ?>',
  57. 'pluginid':'xj_event:wsq_join_test',
  58. 'param': 'a=1&b=2'
  59. };
  60. WSQ.initShareWx(initWx);
  61. </script>
  62. <script type="text/javascript" src="source/plugin/xj_event/js/jquery.js"></script>
  63. <script type="text/javascript">
  64. $(function(){
  65. $("#testbtn").click(function(){
  66. $.ajax({
  67. type: 'POST',
  68. url: 'plugin.php?id=xj_event:wsq_join_test',
  69. //data: {level:'fff', roomnumber:'bbb'},
  70. data:$('#bmform').serialize(),
  71. dataType: 'json',
  72. cache: false,
  73. error: function(){
  74. alert('出错啦!');
  75. return false;
  76. },
  77. success:function(json){
  78. if(json.full == 2){
  79. alert('您已报名过,不可以重复报名!');
  80. window.location.href="qiangpiao.php?vid=<?php echo $vid; ?>&oid=<?php echo $openid; ?>";
  81. return false;
  82. }
  83. if(json.full == 1){
  84. alert('恭喜您报名成功!');
  85. window.location.href="qiangpiao.php?vid=<?php echo $vid; ?>&oid=<?php echo $openid; ?>";
  86. return true;
  87. }else{
  88. alert('出错啦!');
  89. return false;
  90. }
  91. }
  92. });
  93. });
  94. });
  95. </script>
  96. <style type="text/css">
  97. #container {margin:5px;}
  98. body {height:100%;}
  99. .input1{padding:14px; line-height:14px; width:100%;-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius:4px; border:1px solid #d8d8d8;}
  100. select{height:42px;-webkit-appearance:none;appearance:none;border:none;font-size:14px;padding:0px 10px;display:block;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color: #FFFFFF;color:#aaa;border-radius:4px;}
  101. .selectdiv{margin-top:0px;outline:none;-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius:4px; border:1px solid #d8d8d8;position:relative;}
  102. .checkbox {
  103. width: 19px;
  104. height: 25px;
  105. padding: 0 5px 0 0;
  106. background: url(checkbox.png) no-repeat;
  107. display: block;
  108. float: left;
  109. }
  110. label{float:left; font-size:14px; line-height:30px;}
  111. </style>
  112. </head>
  113. <body>
  114. <div>
  115. <div style="padding:20px; font-size:16px; font-weight:bold; color:#4095ce; text-align:center;">
  116. <?php echo $thread['subject']; ?>
  117. </div>
  118. <form name="bmform" id="bmform">
  119. <input type="hidden" name="formhash" value="<?php echo $_G['formhash'];?>" />
  120. <input type="hidden" name="eid" value="<?php echo $items['eid'];?>" />
  121. <div style="padding:10px 30px;">
  122. <div class="selectdiv">
  123. <select name="session">
  124. <option>活动场次</option>
  125. <?php foreach($setting['session'] as $key=>$value){ ?>
  126. <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
  127. <?php } ?>
  128. </select>
  129. </div>
  130. </div>
  131. <?php
  132. if(!empty($selectuserfield)){
  133. foreach($selectuserfield as $fieldid){
  134. if($settings[$fieldid]['available']){
  135. if($settings[$fieldid]['formtype'] != 'file'){
  136. $htmls[$fieldid] = str_replace('class="px"','class="input1" placeholder="'.$settings[$fieldid]['title'].'"',$htmls[$fieldid]);
  137. $htmls[$fieldid] = preg_replace("/<div.+<\/div>/is", "", $htmls[$fieldid]);
  138. if(strpos($htmls[$fieldid],'select')>0){
  139. $htmls[$fieldid] = str_replace('tabindex="1">','tabindex="1"><option>'.$settings[$fieldid]['title'].'</option>',$htmls[$fieldid]);
  140. echo '<div style="padding:10px 30px;">'.$htmls[$fieldid].'</div>';
  141. }elseif(strpos($htmls[$fieldid],'checkbox')>0){
  142. //$htmls[$fieldid] = str_replace('type="checkbox"','type="checkbox" class="checkbox"',$htmls[$fieldid]);
  143. echo '<div style="padding:10px 30px;">'.$htmls[$fieldid].'<div style="clear:both;"></div></div>';
  144. }else{
  145. echo '<div style="padding:10px 30px;">'.$htmls[$fieldid].'</div>';
  146. }
  147. }else{
  148. }
  149. }
  150. }
  151. }
  152. ?>
  153. <div style="padding:10px 30px;">
  154. <div class="selectdiv">
  155. <select name="applynumber">
  156. <option>报名人数</option>
  157. <?php foreach($applynumber as $key=>$value){ ?>
  158. <option value="<?php echo $value; ?>"><?php echo $value; ?></option>
  159. <?php } ?>
  160. </select>
  161. </div>
  162. </div>
  163. <div style="padding:10px 30px;">
  164. <input name="message" type="text" placeholder="留言" class="input1">
  165. </div>
  166. </form>
  167. <a href="javascript:" id="testbtn">测试</a>
  168. </div>
  169. </body>
  170. </html>