深圳全飞鸿

标题: beacon的页面模板module的使用技巧 [打印本页]

作者: zhgc    时间: 2020-4-18 18:59
标题: beacon的页面模板module的使用技巧
基本框架:

index.php

  1. <?php

  2. class L1 extends tapp{
  3.        
  4.         /*
  5.          * 构造函数
  6.          */
  7.         function L1() {
  8.                 parent::__construct();        //一定要添加这一句
  9.         }

  10.         function AuthorizeUser($reportid,$url)
  11.         {
  12.                 return true;
  13.         }
  14. }
  15. ?>
复制代码



mod.l1_01.php

  1. <?php

  2. class L1_01  extends tpage{
  3.                
  4.         function L1_01($app) {
  5.                 parent::__construct($app);
  6.         }       
  7.        
  8.         /*
  9.          * 用于修改TD的栏位格式,特别是可以按条件变颜色;
  10.          * 应该在子类中被重构
  11.          */
  12.         function column_format($colname,$row,$column){
  13.                 $html="<td nowrap=\"nowrap\">".$row[$colname]."</td>";
  14.                 if($colname=="REAL_QTY"){
  15.                         if($row["STD_QTY"]>$row["REAL_QTY"]){
  16.                                 $html="<td nowrap=\"nowrap\" bgcolor=\"#FFB6C1\">".$row[$colname]."</td>";
  17.                         }
  18.                 }
  19.                 return $html;
  20.         }
  21. }
  22. ?>
复制代码

作者: zhgc    时间: 2020-4-18 19:12
后台可以按条件控制前台变色mod.jjjz_04.php
  1. <?php

  2. //include_once("activity.S.inc.php");

  3. class JJJZ_04  extends tpage{
  4.                
  5.         function JJJZ_04($app) {
  6.                 parent::__construct($app);
  7.         }       
  8.        
  9.         /*
  10.          * 用于修改TD的栏位格式,特别是可以按条件变颜色;
  11.          * 应该在子类中被重构
  12.          */
  13.         function column_format($colname,$row,$column){
  14.                 $html="<td nowrap=\"nowrap\">".$row[$colname]."</td>";
  15.                 //$html="<td nowrap=\"nowrap\" bgcolor=\"#FFB6C1\">".$row[$colname]."</td>";
  16.                 if($row["FLAG"]!=0){
  17.                                 $html="<td nowrap=\"nowrap\" bgcolor=\"#FFB6C1\">".$row[$colname]."</td>";
  18.                 }
  19.                 return $html;
  20.         }
  21. }
  22. ?>
复制代码




xml需要对列加上class属性
  <column no="DATA2" title="名称" class="app" />


作者: zhgc    时间: 2020-4-20 16:06
添加了一次整行变色的方法:

  1.         function column_format_ex($colname,$row,$column,$oldtd,&$trclass){
  2.                 $JD="";
  3.                 if($row["FLAG"]!=0){
  4.                         $trclass=" style=\"background: green\" ";
  5.                 }
  6.                 return $oldtd;
  7.         }
复制代码




注意最后一个参数,一定是&$trclass, 是引用传参





欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2