Skip to content

Commit 1f8806d

Browse files
committed
2017/10/20
1 parent 7662185 commit 1f8806d

17 files changed

+306
-288
lines changed

manage/module/extendclassMod.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public function teacher_add(){
257257
public function teacher_add_save(){
258258

259259
$_POST['uid']= $this->user['id'];
260+
$_POST['cid']= $this->user['cid'];
260261
model('extendclass')->teacher_add_save($_POST);
261262

262263
$this->msg('添加成功!',1);

manage/template/index/nav_wechat.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
<img src="__PUBLICURL__/manage/img/nav_sjx3.png"/>
2727
</a>
2828

29-
<a class="nav4" href="__APP__/extendclass/school">
29+
<!--<a class="nav4" href="__APP__/extendclass/school">
3030
<div class="nav_WeChat5">
3131
3232
</div>
3333
<p>
3434
学校管理
3535
</p>
3636
<img src="__PUBLICURL__/manage/img/nav_sjx4.png"/>
37-
</a>
37+
</a>-->
3838
<a class="nav1" href="__APP__/extendclass/classes">
3939
<div class="nav_selectclass2">
4040

model/contentModel.class.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,20 @@ public function views_content($aid,$views){
169169
$condition['aid'] = $aid;
170170
$this->model->table('content')->data($data)->where($condition)->update();
171171
}
172+
173+
public function views_teacher($id=0){
174+
$info="
175+
update {$this->model->pre}teacher set views=views+1
176+
WHERE id=".$id;
177+
$info=$this->model->query($info);
178+
}
179+
180+
public function views_school($id=0){
181+
$info="
182+
update {$this->model->pre}school set views=views+1
183+
WHERE id=".$id;
184+
$info=$this->model->query($info);
185+
}
172186

173187
//URL路径
174188
public function url_format($dir,$cid,$cname,$info){

model/schoolModel.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public function count($where=null) {
2929
}
3030

3131
//获取科室树形列表
32-
public function school_list() {
32+
public function school_list($where=null) {
3333

34-
$data= $this->model->table('school')->select();
34+
$data= $this->model->table('school')->where($where)->select();
3535
$temp=array();
3636
if($data){
3737
foreach($data as $k=>$v){

module/commonMod.class.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function __construct(){
7474
$this->config['sitename']=$webconfig['name'];
7575
$this->config['erweima']=$webconfig['erweima']?$this->config['imageurl'].$webconfig['erweima']:'/public/erweima.jpg';
7676
$this->config['gid']=$this->adminuser['gid'];
77+
$this->config['TPL_TEMPLATE_PATH']='themes/'.$webconfig['template'].'/';
7778
if($this->adminuser['gid']==6){
7879

7980
$temp;$tempcid[]=1;
@@ -318,6 +319,8 @@ public function __set($name, $value){
318319

319320
//获取模板对象
320321
public function view(){
322+
323+
321324
static $view = NULL;
322325
if( empty($view) ){
323326
$view = new cpTemplate( $this->config );
@@ -346,13 +349,14 @@ protected function display($tpl = '', $return = false, $is_tpl = true,$is_dir=tr
346349

347350
}
348351

352+
349353
if($this->webconfig){
350354
$tpl_add=$this->webconfig['template'].'/';
351355
}
352-
356+
353357
if($this->webconfig){
354358
$tpl_add=$this->webconfig['template'].'/';
355-
$this->config['TPL_TEMPLATE_PATH']='themes/'.$tpl_add;
359+
356360
$tpl=__ROOTDIR__.'/themes/'.$tpl_add.$lang.$mobile_tpl.$tpl;
357361
if( $is_tpl && $this->layout ){
358362
$this->__template_file = $tpl;
@@ -374,17 +378,9 @@ protected function display($tpl = '', $return = false, $is_tpl = true,$is_dir=tr
374378

375379
$school=model('school')->school_list();
376380

377-
//foreach($school as $k=>$v){
378-
// if($v['coordinate']){
379-
// $temp=explode(",", $v['coordinate']);
380-
//
381-
// $data[]=array('lat'=>$temp[1],'lng'=>$temp[0],'value'=>1,'type'=>2);
382-
// }
383-
// }
384-
// echo json_encode($data);die;
385-
// var_dump($data);die;
386-
$subject=model('diyfield')->field_list_data(2);
387-
$grade=model('diyfield')->field_list_data(1);
381+
382+
// $subject=model('diyfield')->field_list_data(2);
383+
// $grade=model('diyfield')->field_list_data(1);
388384
$teacher=model('teacher')->model_list();
389385
$this->assign('school', $school);
390386
$this->assign('subject', $subject);

module/contentMod.class.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,13 @@ public function index()
293293

294294
//更新访问计数
295295
model('content')->views_content($info['aid'],$info['views']);
296-
296+
if($info['tid']){
297+
model('content')->views_teacher($info['tid']);
298+
}
299+
if($info['csid']){
300+
model('content')->views_school($info['csid']);
301+
302+
}
297303

298304
//$zidingyi=unserialize($info_content['zidingyi']);
299305
// $this->zidingyi=$zidingyi;

module/fieldMod.class.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function index() {
128128

129129

130130
public function school() {
131-
$title = trim($_GET['v']);
131+
$title = trim($_GET['s']);
132132
$fieldlist;
133133
$fieldlist['sid']=model('field')->field_array(2);
134134
$fieldlist['gid']=model('field')->field_array(1);
@@ -144,6 +144,11 @@ public function school() {
144144
$wheretemp.=" AND csid=".$csid."";
145145
$url_.="&csid=".$csid;
146146
}
147+
if($title){
148+
$where.=" AND title like '%".$title."%'";
149+
$wheretemp.=" AND title like '%".$title."%'";
150+
}
151+
147152
$this->allurl=sprintf($urltmp,$data['sid'],$data['gid']);
148153
$this->fieldurl=sprintf($urltmp,$data['sid'],$data['gid'])."&cid=13";
149154
$this->liveurl=sprintf($urltmp,$data['sid'],$data['gid'])."&cid=16";
@@ -245,7 +250,7 @@ public function school() {
245250
$this->display('school.html');
246251
}
247252
public function teacher() {
248-
$title = trim($_GET['v']);
253+
$title = trim($_GET['s']);
249254

250255
$this->tid=$tid=intval($_GET['tid']);
251256
$urltmp='?sid=%s&gid=%s';
@@ -265,7 +270,11 @@ public function teacher() {
265270
$url_.="&cid=".$cid;
266271
}
267272

268-
273+
if($title){
274+
$where.=" AND title like '%".$title."%'";
275+
$wheretemp.=" AND title like '%".$title."%'";
276+
}
277+
269278

270279
$listrows=6;
271280
//分页处理

module/indexMod.class.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ public function teacher(){
5555
//分页处理
5656
$url=__INDEX__.'/index/teacher/pages-{page}.html';
5757
$limit=$this->pagelimit($url,$listrows);
58-
$where=' image<>""';
58+
59+
$where['image']=array('<>','""');
60+
//$where['uid']=array('in',$this->config['uids']);
61+
$title = trim($_GET['s']);
62+
if($title){
63+
$where['name']=array('like',"'%".$title."%'");
64+
}
5965
$this->loop=model('teacher')->teacherlist($where,$limit);
6066
//统计总内容数量
6167
$count=model('teacher')->teachercount($where);
@@ -72,8 +78,12 @@ public function school(){
7278
//分页处理
7379
$url=__INDEX__.'/index/school/pages-{page}.html';
7480
$limit=$this->pagelimit($url,$listrows);
75-
$where=' image<>""';
76-
81+
$where['image']=array('<>','""');
82+
$where['id']=array('in',$this->config['cids']);
83+
$title = trim($_GET['s']);
84+
if($title){
85+
$where['name']=array('like',"'%".$title."%'");
86+
}
7787
$this->loop=model('school')->model_list($where,$limit);
7888
//统计总内容数量
7989
$count=model('school')->count($where);

system/core/cpTemplate.class.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public function assign($name, $value = '') {
3737

3838
//执行模板解析输出
3939
public function display($tpl = '', $return = false, $is_tpl = true ,$diy_tpl=false) {
40+
41+
4042
//如果没有设置模板,则调用当前模块的当前操作模板
4143
if ( $is_tpl && ($tpl == "") && (!empty($_GET['_module'])) && (!empty($_GET['_action'])) ) {
4244
$tpl = $_GET['_module'] . "/" . $_GET['_action'];
@@ -67,6 +69,7 @@ public function display($tpl = '', $return = false, $is_tpl = true ,$diy_tpl=fal
6769
if ( (!file_exists($cacheFile)) || (filemtime($tplFile) > filemtime($cacheFile)) ) {
6870
file_put_contents($cacheFile, "<?php if (!defined('CANPHP')) exit;?>" . $this->compile($tpl,true,$diy_tpl));//写入缓存
6971
}
72+
7073
include( $cacheFile );//加载编译后的模板缓存
7174

7275
} else {
@@ -84,6 +87,8 @@ public function display($tpl = '', $return = false, $is_tpl = true ,$diy_tpl=fal
8487
eval('?>' . $compile_content);
8588
}
8689
} else {
90+
91+
8792
eval('?>' . $this->compile( $tpl, $is_tpl,$diy_tpl));//直接执行编译后的模板
8893
}
8994

@@ -109,7 +114,8 @@ protected function compile( $tpl, $is_tpl = true,$diy_tpl=false) {
109114
if($diy_tpl){
110115
$tplFile = $tpl;
111116
}else{
112-
$tplFile = $this->config['TPL_TEMPLATE_PATH'] . $tpl . $this->config['TPL_TEMPLATE_SUFFIX'];
117+
$this->config['TPL_TEMPLATE_PATH'] ;
118+
$tplFile = $this->config['TPL_TEMPLATE_PATH'] . $tpl . $this->config['TPL_TEMPLATE_SUFFIX'];
113119
}
114120

115121
if ( !file_exists($tplFile) ) {

0 commit comments

Comments
 (0)