1. 程式人生 > >PHPCMS V9後臺表單嚮導中讓“資訊列表"頁面直接顯示使用者留言的資訊列表

PHPCMS V9後臺表單嚮導中讓“資訊列表"頁面直接顯示使用者留言的資訊列表

一、找到後臺表單資訊列表對應的控制器phpcms\modules\formguide\formguide_info.php檔案,新增如圖所示程式碼:


二、修改檢視模板phpcms\modules\formguide\templates\formguide_info_list.tpl.php檔案:

注:考慮到資訊列表顯示的時候可能有圖片,這裡做了判斷,如果不需要可以去除。

<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header', 'admin');
?>
<div class="pad-lr-10">
<form name="myform" action="?m=formguide&c=formguide_info&a=delete" method="post">
<div class="table-list">
    <table width="100%" cellspacing="0">
        <thead>
            <tr>
            <th width="35" align="center"><input type="checkbox" value="" id="check_box" onclick="selectall('did[]');"></th>
<!-- <th align="center"><?php echo L('username')?></th>
            <th width='250' align="center"><?php echo L('userip')?></th> -->
<th width='250' align="center"><?php echo L('times')?></th>
            <?php
            foreach ($fields as $k=>$v) {
            ?>
            <th><?php echo $v['name']; ?></th>
            <?php
            }
            ?>
<th width="250" align="center"><?php echo L('operation')?></th>


            </tr>
        </thead>
    <tbody>
 <?php
if(is_array($forminfos_data)){
    foreach($forminfos_data as $key => $form){
?>
<tr>
<td align="center">
<input type="checkbox" name="did[]" value="<?php echo $datas[$key]['dataid']?>">
</td>
    <td align="center">
    <?php echo date('Y-m-d', $datas[$key]['datetime'])?>
    </td>
<?php
foreach($form as $kr=>$r){
    if($kr=="ypics" && $r<>""){
        echo "<td align='center'><img src='".$r."'></td>";
    }else{
        echo "<td align='center'>".$r."</td>";
    }
}
?>
<!-- <td><?php echo $d['username']?> </td>
<td align="center"><?php echo $d['ip']?></td>
<td align="center"><?php echo date('Y-m-d', $d['datetime'])?></td> -->
<td align="center"><a href="javascript:check('<?php echo $formid?>', '<?php echo $datas[$key]['dataid']?>', '<?php echo safe_replace($datas[$key]['username'])?>');void(0);"><?php echo L('check')?></a> | <a href="?m=formguide&c=formguide_info&a=public_delete&formid=<?php echo $formid?>&did=<?php echo $datas[$key]['dataid']?>" onClick="return confirm('<?php echo L('confirm', array('message' => L('delete')))?>')"><?php echo L('del')?></a></td>
</tr>
<?php
}
}
?>
</tbody>
    </table>


    <div class="btn"><label for="check_box"><?php echo L('selected_all')?>/<?php echo L('cancel')?></label>
<input name="submit" type="submit" class="button" value="<?php echo L('remove_all_selected')?>" onClick="document.myform.action='?m=formguide&c=formguide_info&a=public_delete&formid=<?php echo $formid?>';return confirm('<?php echo L('affirm_delete')?>')">&nbsp;&nbsp;</div>  </div>
 <div id="pages"><?php echo $pages;?></div>
</form>
</div>
</body>
</html>
<script type="text/javascript">
function check(id, did, title) {
window.top.art.dialog({id:'check'}).close();
window.top.art.dialog({title:'<?php echo L('check')?>--'+title+'<?php echo L('submit_info')?>', id:'edit', iframe:'?m=formguide&c=formguide_info&a=public_view&formid='+id+'&did='+did ,width:'700px',height:'500px'}, function(){window.top.art.dialog({id:'check'}).close()});
}
</script>