/home/banprang/domains/plai.go.th/public_html/coremain/template/t03/center_block.php


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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<?php
if ($_SESSION['admin_web'] == "admin") {
  
$blog_width '120';
} else {
  
$blog_width '190';
}

$array_center1 = array();
$sql "SELECT * FROM cms_menu_top WHERE module_type IN ('boss_message', 'calendar') AND left_right = '3' ORDER BY position";
$que mysql_query($sql);
while(
$obj mysql_fetch_assoc($que)){
  
$obj['td_width'] = $obj['module_type'] == 'boss_message' '70%' '30%';
  
$array_center1[$obj['module_type']] = $obj;
}


// ############################## กิจกรรมทั่วไป ###############################
$status_module select_query("status_module""cms_status_module""id""7");
if (
$status_module[0] == 1) { // สถานะตาม PACKAGE 
  // update status
  
if ($_SESSION['admin_web'] == "admin" || (id_top_permission("data_other"))) {
    if (
$status_data_other == "1") {
      
$sq "UPDATE cms_status_module set status='1' WHERE id='7'";
      
$re mysql_query($sq);
    } else if (
$status_data_other == "0") {
      
$sq "UPDATE cms_status_module set status='0' WHERE id='7'";
      
$re mysql_query($sq);
    }
  }
  echo 
'<fieldset class="canvas-corner" style="margin: 5px;">';

  
# เช็คสถานะของ status
  
$x select_query("status""cms_status_module""id""7");
  if (
$_SESSION['admin_web'] == "admin" || (id_top_permission("data_other"))) {
    
?>
    <br/>
    <table align="center">
      <tr bgcolor='ffcc00' height='1'>
    <?php if ($x[0] == "0") { ?>
          <td colspan="2"><img src='coremain/images/hide.gif' border=0><a href="javascript:void(0);" class="update_status" id="data_other-1" title='แสดงข้อมูล'> แสดงข้อมูลกิจกรรมทั่วไป</a></td>
          <?php } else { ?>
          <td><img src='coremain/images/show.gif' border=0><a href="javascript:void(0);" class="update_status" id="data_other-0" title='ซ่อนข้อมูล'> ซ่อนกิจกรรมทั่วไป</a></td>
          <td><img src='coremain/images/edit.gif'> <a href='index.php?mod=page_others_update&path=page_others' title='แก้ไขข้อมูล'>แก้ไขข้อมูล</a></td>
    <?php ?>
      </tr>
    </table>
  <?php
  
}

  
# แสดงข้อมูล
  
if ($x[0] == 1) {
    if (
$_SESSION['id_tumbon'] == "dankhun2_n23") {
      
bar_header("แหล่งท่องเที่ยวภายในตำบลหนองจะบก");
    } else {
      
bar_header("กิจกรรมทั่วไป");
    }

    if (!(
$_SESSION['admin_web'] == "admin" || (id_top_permission("data_other")))) {
      echo 
"<br/>";
    }
    
?>
    <table width='100%' border='0' cellpadding='0' cellspacing='0'>
      <tr>
        <td>
    <?php include('coremain/module/page_others/page_others.php'); ?>
        </td>
      </tr>
    </table>
  <?php
  
}
  echo 
'</fieldset>';
}

# ภาพกิจกรรม 
?>
<table width='100%' border='0' cellpadding='5' cellspacing='0'>
  <tr>
    <td>
      <fieldset class="canvas-corner">
<?php include('coremain/module/freerss/freerss.php'); ?>
      </fieldset>
    </td>
  </tr>
</table>

<?php
//############## ข่าวอิสระ #############
if ($_SESSION['admin_web'] == "admin") {
  
?>
  <br/>
  <table align='center'>
    <tr bgcolor='ffcc00'>
      <td>
        <img src='coremain/images/add.gif'> <a href='index.php?mod=home_add_page&path=home' title='เพิ่มข้อมูล'>เพิ่มข้อมูลหน้าแรก</a>
      </td>
    </tr>
  </table>
<?php ?>

  <table width='100%' border='0' cellpadding='5' cellspacing='0'>
    <tr>
      <td>
<?php include('coremain/module/home/home.php'); ?>
      </td>
    </tr>
  </table>


<?php
$array_module 
= array();
$sel_module "select type_module from cms_main_module";
$que_module mysql_query($sel_module);
$obj_module mysql_fetch_assoc($que_module);
foreach(
$obj_module as $module){
  
$array_module[$module] = $module;
}

  
$array_center_bottom = array();
  
$where = ($_SESSION['admin_web']=="admin") ? "" " and status = '1'";
  
$sql "SELECT * FROM cms_menu_top WHERE left_right = '3' and module_type!='other' and `lock`='1' $where ORDER BY position";
  
$que mysql_query($sql);
  while(
$obj mysql_fetch_assoc($que)){
    
$obj['td_width'] = '25%';
    
$array_center_bottom[$obj['id_top']] = $obj;
  }
  
$count_module count($array_center_bottom);
?>
<table width='100%' align=center border='0' cellspacing='0' cellpadding='5' bgcolor='<?= $_SESSION['bg_menu'// สี่พื้นเมนู ซ้ายและขวา ?>'>
  <?php
    $num_col 
0;
    foreach(
$array_center_bottom as $id_top => $list){
      
$new_row $num_col 3;
      if(
$new_row == 0){
        echo 
'<tr>';
      }
      
$menu_name strpos($list['name'], '.gif') > -|| strpos($list['name'], '.jpg') > -|| strpos($list['name'], '.png') > -'' $list['name'];
      
$menu_bg $menu_name == '' $list['name'] : 'menu_bg.jpg';
  
?>
  <td width="<?= $list['td_width'?>" valign="top" align="center">
    <div style="background: url(coremain/images/menu/<?= $_SESSION['themes_'?>/1/<?= $menu_bg ?>) no-repeat; background-size: 100%;" class="<?= $_SESSION['themes_'?>" align="center" id="<?= $id_top ?>"><?= $menu_name ?></div>
  <?php
//    bar_header($list['name'], "style='background: #FFF;' class='title-corner'");
    
$module_type $list['module_type'];
    if(
$_SESSION['admin_web']=="admin"){
      
$status_module=select_query("status_module","cms_status_module","id","11");
      if(
$status_module[0]==1){
        
# Left
        
$left_slide $new_row == 'up' 'left';
        
$title_left $new_row == 'เลื่อนขึ้นแถวบน' 'เลื่อนไปทางซ้าย';
        echo 
$list['position'] > 
          
"<a href='index.php?id_=$id_top&tables=cms_menu_top&id_order=1&left_right=3'><img src='coremain/images/$left_slide.gif' border='0' title='$title_left'></a> "
           
'';
        
# Right
        
$right_slide $new_row == 'down' 'right';
        
$title_right $new_row == 'เลื่อนลงแถวล่าง' 'เลื่อนไปทางขวา';
        echo 
$list['position'] < $count_module 
          
"<a href='index.php?id_=$id_top&tables=cms_menu_top&id_order=2&left_right=3'><img src='coremain/images/$right_slide.gif' border='0' title='$title_right'></a> "
           
"";
        
# To Left Block
        
echo "<a href='index.php?id_=$id_top&tables=cms_menu_top&move_right=1'><img src='coremain/images/top2.gif' border='0' title='ย้ายไปเมนูด้านซ้าย'></a> ";
        
        
# show - hide
        
if($list['status']=="1"){
          echo 
"<a href='index.php?id_=$id_top&id_show=1&tables=cms_menu_top&fields=id_top' title='ซ่อนข้อมูล'><img src='coremain/images/show.gif' border='0'></a> ";
        }else{
          echo 
"<a href='index.php?id_=$id_top&id_show=2&tables=cms_menu_top&fields=id_top' title='แสดงข้อมูล'><img src='coremain/images/hide.gif' border='0'></a> ";
        }
      }
      
# Edit
//      if(in_array($module_type, $array_module)){
        
echo '<a href="javascript:void(0);" class="edit_manage_header" id="'.$id_top.'#@#'.$module_type.'"><img src="coremain/images/edit.gif" border="0" title="แก้ไขข้อมูล"></a>';
//      }

      # Del TOP_MENU 
      
if($id_top && $id_top != 98 && $id_top != 99){
        
$sql="SELECT id_top  FROM cms_menu_sub WHERE id_top='$id_top'";
        
$re=mysql_query($sql);
        
$data=mysql_num_rows($re);
        if(
$data==0){
          echo 
" <a href='index.php?id_del_top=$id_top&module=$module_type'><img src='coremain/images/del1.gif' border='0' title='ลบข้อมูล'  onclick='return goURLdel();'></a>";
        }
      }
    }
    
  
// ###################### Module ย่อย  ของ Link#################
  
if($module_type=="link" && $list['status'] == '1'){ ?>
    <div class="menu_center">
  <?php
    $sql_sub
="select id_sub,id_type,name,url from cms_menu_sub WHERE id_top='$id_top' and $list[status]='1' and status='1' order by position asc";
    
$result_sub=mysql_query($sql_sub);
    while(
$data_sub=mysql_fetch_array($result_sub)){ ?>
      <ul><li>
        <?php
        $len_msg 
mb_strlen($data_sub['name'], 'utf-8');
        
$name_link $data_sub['name'];//$len_msg > 30 ? mb_substr($data_sub['name'], 0, 30, 'utf-8').'...' : $data_sub['name'];
          
if($data_sub['id_type']=="1"){ // inside website
            
echo "<a href='$data_sub[url]&id_type=$data_sub[id_type]' title='".$data_sub['name']."'><img src='$_SESSION[web_name]/theme/$_SESSION[themes_]/$_SESSION[image_menu]' border=0>&nbsp;".$name_link."</a>";
          }else if(
$data_sub['id_type']=="2"){ // outside website
            
echo "<a href='http://$data_sub[url]' target='_blank' title='".$data_sub['name']."'><img src='$_SESSION[web_name]/theme/$_SESSION[themes_]/$_SESSION[image_menu]' border=0>&nbsp;".$name_link."</a>";                        
          }
        
?>
      </li></ul>
<?php ?>
    </div>
<?php
  
}
  
// ##################### Module การบริการ ##########################
  
else if($module_type == 'service' && $list['status'] == '1'){ ?>
    <div id='<?= $_SESSION['menu'?>'>
      <ul>
    <?php
      $sql_sub
="select id_sub,id_type,name,url from cms_menu_sub WHERE id_top='$id_top' and $list[status]='1' and status='1' order by position asc";
      
$result_sub=mysql_query($sql_sub);
      while(
$data_sub=mysql_fetch_array($result_sub)){ ?>
        <li>
          <a href='<?= $data_sub['url'?>&id_type=<?= $data_sub['id_type'?>' style="text-decoration: none; text-align: center; text-shadow: 0 0; box-shadow: 0 0;" class="<?= $_SESSION['themes_'?>">
            <?= $data_sub['name'?>
          </a>
        </li>
    <?php ?>
      </ul>
    </div>
<?php }
  
// ###################### Module ย่อย  ของ Poll #################
  
else if($module_type=="poll" && $list['status']==1){ ?>
    <table width="100%">
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td align="center">
          <?php include('coremain/module/poll/poll.php'); ?>
        </td>
      </tr>
    </table>
<?php }
  
// ###################### Module ย่อย  ของ Counter #################
  
else if($module_type=="counter" && $list['status']==1){ ?>
    <table width="100%">
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td align="center">
          <?php include('coremain/module/counter/counter.php'); ?>
        </td>
      </tr>
    </table>
  <?php
  
}
  
// ###################### Module ย่อย  ของ Other #################
  
else if($module_type=="web_link" && $list['status']==1){
  
?>
    <table width="100%">
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20'>
          <?php include('coremain/module/web_link/web_link.php'); ?>
        </td>
      </tr>
    </table>
  <?php
  
}
  
// ###################### Module ย่อย  ของ Code#################
  
else if($module_type=="code" && $list['status']==1){
  
?>
    <table width="100%">
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20'>
          <?php include('coremain/module/code/code.php'); ?>
        </td>
      </tr>
    </table>
  <?php
  
}
  
// ###################### Module ย่อย  ของ calendar #################
  
else if($module_type=="calendar" && $list['status']==1){
  
?>
    <table width="100%">
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20'>
          <?php include('coremain/module/calendar/calendar.php'); ?>
        </td>
      </tr>
    </table>
  <?php
  
}
  
// ##################### Module ย่อย OTOP ##########################        
  
else if($module_type=="picture" && $list['status']==1){
    if(
id_top_permission('id_top_permission')){
      
$sql_sub="select * from cms_link_picture WHERE id_top='$id_top' order by position desc";
    }else{
      
$sql_sub="select * from cms_link_picture WHERE id_top='$id_top' and status=1 order by position desc";
    }
    
$result_sub=mysql_query($sql_sub);
    while(
$data_sub=mysql_fetch_array($result_sub)){     // ส่วน display รูป และ ส่ง link
    
?>
      <div height='24' align='center' bgcolor='<?= $_SESSION['bg_menu'?>'>
        <a href='index.php?mod=link_picture&path=link_picture&id_pic=<?= $data_sub['id_pic'?>&data_top=<?= $id_top ?>'>
          <img src='<?= $_SESSION['web_name'?>/module_picture/<?= $data_sub['pic_name'?>' width="95%" class="img-corner">
        </a>
      </div>
    <?php }
    if(
id_top_permission('id_top_permission')){ ?>
      <div align='center'><img src='coremain/images/true.gif'> <a href='index.php?mod=link_picture_add&path=link_picture&id_top=<?= $id_top ?>' title='เพิ่มข้อมูล'>เพิ่มข้อมูล</a></div>
  <?php }
  }
  
// ##################### Module Link แสดงรูป ##########################        
  
else if($module_type=="sponser" && $list['status']==1){
  
?>
    <table width="100%">
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2>
          <?php include('coremain/module/sponser/sponser.php'); ?>
        </td>
      </tr>
      <?php if(id_top_permission($id_top)){ ?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan='2' >
          <div align='center'><img src='coremain/images/true.gif'> <a href='index.php?mod=sponser_add&path=sponser&id_top=<?= $id_top ?>' title='เพิ่มข้อมูล'>เพิ่มข้อมูล</a></div>
        </td>
      </tr>
      <?php ?>
    </table>
  <?php
  
}
  
// ###################### Module ย่อย  สาสน์ผู้บริหาร #################
  
else if($module_type=="boss_message" && $list['status']==1){
  
?>
    <table width="100%">
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2>
          <?php include('coremain/module/boss_message/boss_message.php'); ?>
        </td>
      </tr>
    </table>
  <?php
  
}
  
?>
    </td>
  <?php
    
if($new_row == 2){
      echo 
'</tr>';
    }
    ++
$num_col;
  }
  
?>
</table>
  

<script>
  
  $('.update_status').click(function(){
    var arr = $(this).attr('id').split('-');
    var type = arr[0];
    var status = arr[1];
    var arrData = [
      { name: 'module', value: arr[0] },
      { name: 'status', value: arr[1] }
    ];
    
    $.ajax({
      type: 'post',
      url: 'coremain/index_status.php',
      data: arrData,
      success: function(result){
        location.reload();
      }
    });
    
  });
  
  $( "#tabs_news, #tabs_tender" ).tabs();
  
</script>