<?php
|
class Smarty_Internal_Compile_Msglist extends Smarty_Internal_CompileBase{
|
public $required_attributes = array('item');
|
public $optional_attributes = array('name', 'key');
|
public $shorttag_order = array('from', 'item', 'key', 'name');
|
public function compile($args, $compiler, $parameter){
|
$_attr = $this->getAttributes($compiler, $args);
|
|
$from = $_attr['from'];
|
$item = $_attr['item'];
|
$name = $_attr['item'];
|
$name=str_replace('\'','',$name);
|
$name=$name?$name:'list';$name='$'.$name;
|
if (!strncmp("\$_smarty_tpl->tpl_vars[$item]", $from, strlen($item) + 24)) {
|
$compiler->trigger_template_error("item variable {$item} may not be the same variable as at 'from'", $compiler->lex->taglineno);
|
}
|
|
//自定义标签 START
|
$OutputStr='global $db,$db_config,$config;$paramer='.ArrayToString($_attr,true).';'.$name.'=array();
|
$time=time();
|
$ParamerArr = GetSmarty($paramer,$_GET,$_smarty_tpl);
|
$paramer = $ParamerArr[arr];
|
$Purl = $ParamerArr[purl];
|
global $ModuleName;
|
if(!$Purl["m"]){
|
$Purl["m"]=$ModuleName;
|
}
|
$where = "`reply`<>\'\' and `del_status`=\'0\'";
|
if($paramer[id]){
|
$where.=" and `jobid`=\'$paramer[id]\'";
|
}
|
|
if($paramer[limit]){
|
$limit=" LIMIT ".$paramer[limit];
|
}else{
|
$limit=" LIMIT 20";
|
}
|
if($paramer[ispage]){
|
$limit = PageNav($paramer,$_GET,"msg",$where,$Purl,\'\',\'0\',$_smarty_tpl);
|
}
|
//排序字段
|
if($paramer[order]){
|
$where.=" ORDER BY `".$paramer[order]."`";
|
}else{
|
$where.=" ORDER BY `datetime`";
|
}
|
//排序方式默认倒序
|
if($paramer[sort]){
|
$where.=" ".$paramer[sort];
|
}else{
|
$where.=" DESC";
|
}
|
'.$name.'=$db->select_all("msg",$where.$limit);
|
$user=$db->select_all("resume","","uid,def_job");
|
if(is_array('.$name.')){
|
foreach('.$name.' as $key=>$value){
|
foreach($user as $v){
|
if($value[uid]==$v[uid]){
|
'.$name.'[$key][user_url] = Url("resume",array("id"=>$v[def_job]),"1");
|
}
|
}
|
'.$name.'[$key][datetime]=date("Y-m-d",$value[datetime]);
|
'.$name.'[$key][reply_time]=date("Y-m-d",$value[reply_time]);
|
}
|
}';
|
//自定义标签 END
|
//global $DiyTagOutputStr;
|
//$DiyTagOutputStr[]=$OutputStr;
|
return SmartyOutputStr($this,$compiler,$_attr,'msglist',$name,$OutputStr,$name);
|
}
|
}
|
class Smarty_Internal_Compile_Msglistelse extends Smarty_Internal_CompileBase{
|
public function compile($args, $compiler, $parameter){
|
$_attr = $this->getAttributes($compiler, $args);
|
|
list($openTag, $nocache, $item, $key) = $this->closeTag($compiler, array('msglist'));
|
$this->openTag($compiler, 'msglistelse', array('msglistelse', $nocache, $item, $key));
|
|
return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
|
}
|
}
|
class Smarty_Internal_Compile_Msglistclose extends Smarty_Internal_CompileBase{
|
public function compile($args, $compiler, $parameter){
|
$_attr = $this->getAttributes($compiler, $args);
|
if ($compiler->nocache) {
|
$compiler->tag_nocache = true;
|
}
|
|
list($openTag, $compiler->nocache, $item, $key) = $this->closeTag($compiler, array('msglist', 'msglistelse'));
|
|
return "<?php } ?>";
|
}
|
}
|