Files
OMS/app/base/lib/static/modifiers.php
2025-12-28 23:13:25 +08:00

110 lines
2.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
class modifiers{
static function tag(&$rows){
foreach($rows as $r){
$rows[$r] = null;
if(is_array($this->tags[$r])){
foreach($this->tags[$r] as $t){
$rows[$r] .= '<b class="tag">'.$t.'</b>';
}
}
}
unset($this->tags);
}
static function gender(&$rows){
$gender = array(
'0'=>app::get('base')->_('女'),
'1'=>app::get('base')->_('男') );
foreach($rows as $i => $v){
$rows[$i] = $gender[$v];
}
}
static function region(&$rows){
foreach($rows as $i=>$r){
list($pkg,$regions,$region_id) = explode(':',$r);
if(is_numeric($region_id)){
$rows[$i] = str_replace('/','-',$regions);
}
}
}
static function date(&$rows,$options=null){
foreach($rows as $i=>$date){
if($date){
$rows[$i] = ( is_numeric($date) ? date('Y-m-d',$date) : $date);
}
}
}
static function time(&$rows,$options=null){
foreach($rows as $i=>$date){
if($date){
$rows[$i] = ( is_numeric($date) ? date('Y-m-d H:i:s',$date) : $date);
}
}
}
static function last_modify(&$rows,$options=null)
{
foreach ($rows as $i=>$date)
{
if($date)
{
$rows[$i] = ($date ? date('Y-m-d H:i:s',$date) : '');
}
}
}
static function money(&$rows,$options=null){
$oCur = app::get('eccommon')->model('currency');
$oMath = kernel::single('eccommon_math');
foreach($rows as $i=>$money){
$rows[$i] = $oCur->changer($oMath->getOperationNumber($money));
}
}
static function intbool(&$rows,$options=null){
$aBool = array(
'0'=>app::get('base')->_('否'),
'1'=>app::get('base')->_('是') );
foreach($rows as $i => $v){
$rows[$i] = $aBool[$v];
}
}
static function tinybool(&$rows,$options=null){
$aBool = array(
'N'=>app::get('base')->_('否'),
'Y'=>app::get('base')->_('是') );
foreach($rows as $i => $v){
$rows[$i] = $aBool[$v];
}
}
static function bool(&$rows,$options=null){
$aBool = array(
'false'=>app::get('base')->_('否'),
'true'=>app::get('base')->_('是') );
foreach($rows as $i => $v){
$rows[$i] = $aBool[$v];
}
}
static function enum(&$rows,$options=null){
$options = $options['options'];
foreach($rows as $i => $v){
$rows[$i] = $options[$v];
}
}
}//End Class