深圳全飞鸿
标题:
beacon的页面模板module的使用技巧
[打印本页]
作者:
zhgc
时间:
2020-4-18 18:59
标题:
beacon的页面模板module的使用技巧
基本框架:
index.php
<?php
class L1 extends tapp{
/*
* 构造函数
*/
function L1() {
parent::__construct(); //一定要添加这一句
}
function AuthorizeUser($reportid,$url)
{
return true;
}
}
?>
复制代码
mod.l1_01.php
<?php
class L1_01 extends tpage{
function L1_01($app) {
parent::__construct($app);
}
/*
* 用于修改TD的栏位格式,特别是可以按条件变颜色;
* 应该在子类中被重构
*/
function column_format($colname,$row,$column){
$html="<td nowrap=\"nowrap\">".$row[$colname]."</td>";
if($colname=="REAL_QTY"){
if($row["STD_QTY"]>$row["REAL_QTY"]){
$html="<td nowrap=\"nowrap\" bgcolor=\"#FFB6C1\">".$row[$colname]."</td>";
}
}
return $html;
}
}
?>
复制代码
作者:
zhgc
时间:
2020-4-18 19:12
后台可以按条件控制前台变色
mod.jjjz_04.php
<?php
//include_once("activity.S.inc.php");
class JJJZ_04 extends tpage{
function JJJZ_04($app) {
parent::__construct($app);
}
/*
* 用于修改TD的栏位格式,特别是可以按条件变颜色;
* 应该在子类中被重构
*/
function column_format($colname,$row,$column){
$html="<td nowrap=\"nowrap\">".$row[$colname]."</td>";
//$html="<td nowrap=\"nowrap\" bgcolor=\"#FFB6C1\">".$row[$colname]."</td>";
if($row["FLAG"]!=0){
$html="<td nowrap=\"nowrap\" bgcolor=\"#FFB6C1\">".$row[$colname]."</td>";
}
return $html;
}
}
?>
复制代码
xml需要对列加上class属性
<column no="DATA2" title="名称" class="app" />
作者:
zhgc
时间:
2020-4-20 16:06
添加了一次整行变色的方法:
function column_format_ex($colname,$row,$column,$oldtd,&$trclass){
$JD="";
if($row["FLAG"]!=0){
$trclass=" style=\"background: green\" ";
}
return $oldtd;
}
复制代码
注意最后一个参数,一定是&$trclass, 是引用传参
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/)
Powered by Discuz! X3.2