chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
class Smarty_Internal_Compile_Xjh extends Smarty_Internal_CompileBase{
    public $required_attributes = array('item');
    public $optional_attributes = array('name', 'key', 'limit', 'order','t_len', 'hyclass', 'jobone', 'jobtwo','adtime', 'provinceid', 'cityid', 'three_cityid', 'keyword', 'uid', 'order', 'jobtwo', 'rec','hyid','jobid','ispage','tp','comlen','level','sid','islt');
    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();
        //处理传入参数,并且构造分页参数
        $ParamerArr = GetSmarty($paramer,$_GET,$_smarty_tpl);
        $paramer = $ParamerArr[arr];
        $Purl =  $ParamerArr[purl];
        global $ModuleName;
        if(!$Purl["m"]){
            $Purl["m"]=$ModuleName;
        }
        $where = "`status`=1";
        //是否属于分站下
        if($config[sy_web_site]=="1"){
            if($config[province]>0 && $config[province]!=""){
                $paramer[provinceid] = $config[province];
            }
            if($config[cityid]>0 && $config[cityid]!=""){
                $paramer[cityid]=$config[cityid];
            }
        }
        //关键字
        if($paramer["keyword"]){
            $com=$db->select_all("company","`name` like \'%".$paramer["keyword"]."%\'","uid");
            foreach($com as $v){
                $cuids[]=$v[uid];
            }
            $where.=" AND `uid` in (".@implode(",",$cuids).")";
        }
        //城市
        if($paramer["provinceid"]){
            $where.=" AND `provinceid`=\'".$paramer["provinceid"]."\'";
        }
        if($paramer["cityid"]){
            $where.=" AND `cityid`=\'".$paramer["cityid"]."\'";
        }
        if($paramer["three_cityid"]){
            $where.=" AND `three_cityid`=\'".$paramer["three_cityid"]."\'";
        }
        //所属行业:
        if($paramer["level"]){
            $sch=$db->select_all("school_academy","`school_level`=\'".$paramer["level"]."\'","id");
            foreach($sch as $v){
                $sids[]=$v[id];
            }
            $where.=" AND `schoolid` in (".@implode(",",$sids).")";
        }
        //用户uid
        if($paramer["uid"]){
            $where.=" AND `uid`=\'".$paramer["uid"]."\'";
        }
        //院校uid
        if($paramer["sid"]){
            $where.=" AND `schoolid`=\'".$paramer["sid"]."\'";
        }
        //近期,往期
        if($paramer["tp"]){
            $where.=" AND `etime`<\'".time()."\'";
        }else{
            $where.=" AND `etime`>\'".time()."\'";
        }
        if($paramer[adtime]){
            if($paramer[adtime]==1){
                $beginToday=mktime(0,0,0,date(\'m\'),date(\'d\'),date(\'Y\'));
                if($paramer["tp"]){
                    $where.=" AND stime>$beginToday";
                }else{
                    $where.=" AND stime<$beginToday";
                }
            }else{
                $time=time();
                if($paramer["tp"]){
                    $adtime = $time-($paramer[adtime]*86400);
                    $where.=" AND stime>$adtime";
                }else{
                    $adtime = $time+($paramer[adtime]*86400);
                    $where.=" AND stime<$adtime";
                }
            }
        }
        if($paramer["limit"]){
            $limit= " limit $paramer[limit]";
        }
        if($paramer[ispage]){
            $limit = PageNav($paramer,$_GET,"school_xjh",$where,$Purl,"",$paramer[islt]?$paramer[islt]:"0",$_smarty_tpl);
         
        }
        //排序字段(默认按照uid排序)
        if($paramer[order]){
            $where .= " ORDER BY $paramer[order]";
        }else{
            $where .= " ORDER BY  `ctime`  ";
        }
        //排序规则(默认按照开始时间排序倒序)
        if($paramer["sort"]){
            $where .= " $paramer[sort]";
        }else{
            $where .= " DESC ";
        }
        '.$name.'=$db->select_all("school_xjh",$where.$limit);
        if(is_array('.$name.')){
            $cache_array = $db->cacheget();
            foreach('.$name.' as $v){
                $xjhid[]=$v[\'id\'];
                $comuid[]=$v[\'uid\'];
                $suid[]=$v[\'schoolid\'];
            }
            $atnlist=$db->select_all("atn","`xjhid` IN (".pylode(\',\',$xjhid).") and `uid`=\'".$_COOKIE[\'uid\']."\'");
            $comlist=$db->select_all("company","`uid` IN (".pylode(\',\',$comuid).")","`uid`,`name`,`logo`");
            $academy=$db->select_all("school_academy","`id` IN (".pylode(\',\',$suid).")","`id`,`schoolname`");
            $week=array("周日","周一","周二","周三","周四","周五","周六");
            foreach('.$name.' as $k=>$v){
                '.$name.'[$k]["city_two"] = $cache_array[\'city_name\'][$v["cityid"]];
                '.$name.'[$k]["xjh_url"] = Url("school",array("c"=>"xjhshow","id"=>$v[\'id\']));
                '.$name.'[$k]["com_url"] = Url("company",array("c"=>"show","id"=>$v[\'uid\']));
                '.$name.'[$k]["sch_url"] = Url("school",array("c"=>"academyshow","id"=>$v[\'schoolid\']));
                '.$name.'[$k]["ctime"] = date("Y-m-d",$v["ctime"]);
                '.$name.'[$k]["xjh_date"] = date("Y-m-d",$v["stime"]);
                '.$name.'[$k]["xjh_shour"] = date("H:i",$v["stime"]);
                '.$name.'[$k]["xjh_ehour"] = date("H:i",$v["etime"]);
                '.$name.'[$k]["xjh_week"] = $week[date("w",$v["stime"])];
                foreach($comlist as $val){
                    if($v[\'uid\']==$val[\'uid\']&&$val[\'name\']){
                        if($paramer[comlen]){
                            '.$name.'[$k]["com_name"]=mb_substr($val[\'name\'],0,$paramer[comlen],"utf-8");
                        }else{
                            '.$name.'[$k]["com_name"]=$val[\'name\'];
                        }
                        '.$name.'[$k][\'pic\'] =    checkpic($val[\'logo\'],$config[\'sy_unit_icon\']);
                    }
                }
                foreach($academy as $val){
                    if($v[\'schoolid\']==$val[\'id\']&&$val[\'schoolname\']){
                        '.$name.'[$k]["sch_name"]=$val[\'schoolname\'];
                    }
                }
                foreach($atnlist as $val){
                    if($v[\'id\']==$val[\'xjhid\']){
                        '.$name.'[$k]["atnid"]=$val[\'id\'];
                    }
                }
            }
        }';
        //自定义标签 END
       // global $DiyTagOutputStr;
      //  $DiyTagOutputStr[]=$OutputStr;
        return SmartyOutputStr($this,$compiler,$_attr,'xjh',$name,$OutputStr,$name);
    }
}
class Smarty_Internal_Compile_Xjhelse extends Smarty_Internal_CompileBase{
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
 
        list($openTag, $nocache, $item, $key) = $this->closeTag($compiler, array('xjh'));
        $this->openTag($compiler, 'xjhelse', array('xjhelse', $nocache, $item, $key));
 
        return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
    }
}
class Smarty_Internal_Compile_Xjhclose 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('xjh', 'xjhelse'));
 
        return "<?php } ?>";
    }
}