public function index()
 {
     $formid = intval($_GET['id']);
     $thisForm = $this->weidiaoyan_model->where(array('id' => $formid))->find();
     $thisForm['successtip'] = $thisForm['successtip'] == '' ? '提交成功' : $thisForm['successtip'];
     $this->assign('thisForm', $thisForm);
     $where = array('formid' => $formid);
     $list = $this->weidiaoyan_input_model->where($where)->order('taxis ASC')->select();
     $listByKey = array();
     if ($list) {
         $i = 0;
         foreach ($list as $l) {
             if ($l['inputtype'] == 'select') {
                 $options = explode('|', $l['options']);
                 $optionStr = '<option value="" selected>请选择' . $l['displayname'] . '</option>';
                 if ($options) {
                     foreach ($options as $o) {
                         $optionStr .= '<option value="' . $o . '">' . $o . '</option>';
                     }
                 }
                 $list[$i]['optionStr'] = $optionStr;
             }
             if ($l['errortip'] == '') {
                 $list[$i]['errortip'] = '请输入' . $l['displayname'];
             }
             $listByKey[$l['fieldname']] = $l;
             $i++;
         }
     }
     if (IS_POST) {
         $row = array();
         $fields = array();
         if ($list) {
             foreach ($list as $l) {
                 $fields[$l['fieldname']] = $_POST[$l['fieldname']];
             }
         }
         $row['values'] = serialize($fields);
         $row['formid'] = $thisForm['id'];
         $row['wecha_id'] = $this->wecha_id;
         $row['time'] = time();
         $this->weidiaoyan_value_model->add($row);
         $this->redirect(U('Weidiaoyan/index', array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'id' => $thisForm['id'], 'success' => 1)));
     } else {
         //判断是否提交过信息了
         $submitInfo = $this->weidiaoyan_value_model->where(array('wecha_id' => $this->wecha_id, 'formid' => $thisForm['id']))->find();
         if ($submitInfo) {
             $info = unserialize($submitInfo['values']);
             if ($info) {
                 foreach ($info as $k => $v) {
                     $info[$k] = array('displayname' => $listByKey[$k]['displayname'], 'value' => $v);
                 }
             }
             $this->assign('submitInfo', $info);
             $submitted = 1;
             //二维码图片
             $imgSrc = generateQRfromGoogle(C('site_url') . '/index.php?g=Wap&m=Weidiaoyan&a=submitInfo&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&id=' . $thisForm['id']);
             $this->assign('imgSrc', $imgSrc);
         } else {
             $submitted = 0;
         }
         $this->assign('submitted', $submitted);
         $this->assign('list', $list);
         $this->display();
     }
 }
예제 #2
0
">加入时间</a></th>
	   <th width="80">是否签约</th>
	   <th width="150">操作</th>
	</tr>
	<?php 
$k = 10;
if (!empty($userlist)) {
    foreach ($userlist as $row) {
        ?>
	<tr>
	<td><input type="checkbox" name="quanxuan" value="<?php 
        echo $row['user_id'];
        ?>
" class="gids"/></td>
	<td><span style="float:left"><?php 
        generateQRfromGoogle($urlToEncode, 30);
        ?>
</span><div style="width:300px; height:30px; line-height:30px; float:left"><?php 
        echo $row['nickname'];
        ?>
</div></td>
	<td align="center"><?php 
        echo !empty($row['reg_time']) ? date('Y-m-d H:i:s', $row['reg_time']) : '无知';
        ?>
</td>
	<td><?php 
        echo $row['s_is_qianyue'] == 1 ? '<font color="#FF0000">已经签约</font>' : '<font color="#6600FF">暂无签约</font>';
        ?>
</td>
	<td align="center">
	<img style="float:left" src="<?php