/home/banprang/domains/plai.go.th/public_html/coremain/template/t04/right_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
<?php
### show only have mod ###
$wMenuMod = isset($_SESSION['mnt']) && $_SESSION['mnt'] != '' "id_top = '".$_SESSION['mnt']."'" "";

// menu for admin
if($_SESSION['admin_web']=="admin"){
    
$where = isset($mod) && $mod != '' && $wMenuMod != '' $wMenuMod "left_right='2' and permission!='health' and `lock`='1' and module_type!='other'";
    
$sql="SELECT     id_top,    name,    position,    left_right    ,status,module_type FROM cms_menu_top WHERE $where order by position asc";
}else if(
id_top_permission("health_system_admin")){
    
$where = isset($mod) && $mod != '' && $wMenuMod != '' $wMenuMod "left_right='2' and permission!='admin' and status='1' and module_type!='other' and `lock`='1'";
    
$sql "SELECT     id_top,    name,    position,    left_right    ,status,module_type FROM cms_menu_top WHERE $where order by position asc";    
// for member    
}else if ($_SESSION['admin_web']=="member"){
    
$where = isset($mod) && $mod != '' && $wMenuMod != '' $wMenuMod "left_right='2' and permission!='admin' and module_type!='other' and status='1' and `lock`='1'";
    
$sql="SELECT     id_top,    name,    position,    left_right    ,status,module_type FROM cms_menu_top WHERE $where order by position asc";
}else{
    
$where = isset($mod) && $mod != '' && $wMenuMod != '' $wMenuMod "left_right='2' and status='1' and permission!='admin' and module_type!='other' and `lock`='1'";
    
$sql="SELECT     id_top,    name,    position,    left_right    ,status,module_type FROM cms_menu_top WHERE $where order by position asc";
}
$result=mysql_query($sql);
$num_right=mysql_num_rows($result);
$count_l=1;
if(
$num_right>0){
  
$widthsl="190px";
}
if(
$_SESSION['admin_web']=="admin") {
  
$blog_width='120';
}else{
  
$blog_width='190';
}

$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;
}
?>


<table border='0' width='100%' cellpadding='0' cellspacing='0' bgcolor='<?= $_SESSION['bg_menu'?>'>
  <tr>
    <td>
<?php
// #####################Module หลัก #################
while($data_top=mysql_fetch_array($result)){
  
$id_top $data_top['id_top'];
  
$menu_name strpos($data_top['name'], '.gif') > -|| strpos($data_top['name'], '.jpg') > -|| strpos($data_top['name'], '.png') > -'' $data_top['name'];
  
$menu_bg $menu_name == '' $data_top['name'] : 'menu_bg.jpg';
?>
    <table width='100%' border='0' cellpadding='0' cellspacing='0'>
      <tr>
        <td width="100%" 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 ?></td>
      </tr>
    <?php if($_SESSION['admin_web']=="admin"){ ?>
      <tr height='18'><td width='100%' align='right'>
    <?php
// #############################Admin Edit ##########################
//    $sql_num="SELECT count(*) FROM cms_menu_top WHERE left_right='2'";
//    $re_num=mysql_query($sql_num);
//    $data_num=mysql_fetch_array($re_num);
    # Status Package Module
    
$status_module=select_query("status_module","cms_status_module","id","11");
    if(
$status_module[0]==1){
      
# Up 
      
if($count_l>1){
        echo 
"<a href='index.php?id_=$id_top&tables=cms_menu_top&id_order=1&left_right=2'><img src='coremain/images/up.gif' border='0' title='เลื่อนขึ้น'></a> "
      }else{
        echo 
"&nbsp;&nbsp;&nbsp;&nbsp;";
      }
      
# Down
      
if($count_l<$num_right){
        echo 
"<a href='index.php?id_=$id_top&tables=cms_menu_top&id_order=2&left_right=2'><img src='coremain/images/down.gif' border='0' title='เลื่อนลง'></a> "
      }else {
        echo 
"&nbsp;&nbsp;&nbsp;";
      }
      
# To Center Block
      
echo "<a href='index.php?id_=$id_top&tables=cms_menu_top&move_right=3'><img src='coremain/images/top2.gif' border='0' title='เลื่อนไปเมนูตรงกลาง'></a> "
      
# show - hide
      
if($data_top['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($data_top['module_type'], $array_module)){
      echo 
'<a href="javascript:void(0);" class="edit_manage_header" id="'.$id_top.'#@#'.$data_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=$data_top[module_type]'><img src='coremain/images/del1.gif' border='0' title='ลบข้อมูล'  onclick='return goURLdel();'></a>";
      }
    }
?>
      </td></tr>
<?php
  
}
// ###################### Module ย่อย  ของ Link#################
  
if($data_top["module_type"]=="link"){
    
$sql_sub="select id_sub,id_type,name,url from cms_menu_sub WHERE id_top='$id_top' and $data_top[status]='1' and status='1' order by position asc";
    
$result_sub=mysql_query($sql_sub);
    while(
$data_sub=mysql_fetch_array($result_sub)){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='24'>
          <div id='<?= $_SESSION['menu'?>'>
            <ul><li>
              <?php
                
if($data_sub['id_type']=="1"){
                  echo 
"<a href='$data_sub[url]&id_type=$data_sub[id_type]'><img src='$_SESSION[web_name]/theme/$_SESSION[themes_]/$_SESSION[image_menu]' border=0>&nbsp;&nbsp;".$data_sub['name']."</a>";
                }else if(
$data_sub[id_type]=="2"){
                  echo 
"<a href='http://$data_sub[url]' target='_blank'><img src='$_SESSION[web_name]/theme/$_SESSION[themes_]/$_SESSION[image_menu]' border=0>&nbsp;&nbsp;".$data_sub['name']."</a>";                        
                }
              
?>
            </li></ul>
          </div>
        </td>
      </tr>
<?php }
  }
// ###################### Module ย่อย  ของ Poll #################
  
else if($data_top["module_type"]=="poll" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20'>
          <?php include('coremain/module/poll/poll.php'); ?>
        </td>
      </tr>
<?php
}
// ###################### Module ย่อย  ของ Other #################
  
else if($data_top["module_type"]=="web_link" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20'>
          <?php include('coremain/module/web_link/web_link.php'); ?>
        </td>
      </tr>
<?php
}
// ###################### Module ย่อย  ของ Code#################
  
else if($data_top["module_type"]=="code" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2>
          <?php include('coremain/module/code/code.php'); ?>
        </td>
      </tr>
<?php
}
// ###################### Module ย่อย  ของ calendar #################
  
else if($data_top["module_type"]=="calendar" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2>
          <?php include('coremain/module/calendar/calendar.php'); ?>
        </td>
      </tr>
<?php
}
// ###################### Module ย่อย  ของ Counter #################
  
else if($data_top["module_type"]=="counter" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2>
          <?php include('coremain/module/counter/counter.php'); ?>
        </td>
      </tr>
<?php
}
// ##################### Module ย่อย OTOP ##########################        
  
else if($data_top["module_type"]=="picture" && $data_top['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
    
?>
        <tr bgcolor='<?= $_SESSION['bg_menu'?>' height='6'><td colspan=2></td></tr>
        <tr>
          <td colspan=2 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>
          </td>
        </tr>
    <?php }

    if(
id_top_permission('id_top_permission')){ ?>
      <tr><td colspan='2' bgcolor='<?= $_SESSION['bg_menu'?>'><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></td></tr>
  <?php }
  }
// ##################### Module ย่อย LINK ##########################        
  
else if($data_top["module_type"]=="sponser" && $data_top['status']==1){
?>
      <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 ?>
<?php
  
}
// ##################### Module ย่อย ของสมาชิก##########################        
  
else if($data_top["module_type"]=="service" && $data_top['status']==1){
    
$sql_sub="select id_sub,id_type,name,url from cms_menu_sub WHERE id_top='$id_top' and $data_top[status]='1' and status='1' order by position asc";
    
$result_sub=mysql_query($sql_sub);
    while(
$data_sub=mysql_fetch_array($result_sub)){
  
?>
        <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
          <td colspan=2 height='24'>
            <div id='<?= $_SESSION['menu'?>'>
              <ul><li>
                <a href='<?= $data_sub['url'?>&id_type=<?= $data_sub['id_type'?>'><img src='<?= $_SESSION['web_name'?>/theme/<?= $_SESSION['themes_'?>/<?= $_SESSION['image_menu'?>' border=0>&nbsp;&nbsp;<?= $data_sub['name'?></a>
              </li></ul>
            </div>
          </td>
        </tr>
<?php }
  }
// ###################### Module ย่อย  สาสน์ผู้บริหาร #################
  
else if($data_top["module_type"]=="boss_message" && $data_top['status']==1){
    
$id_top $data_top["id_top"];
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2>
          <?php include('coremain/module/boss_message/boss_message.php'); ?>
        </td>
      </tr>
<?php
  
}
// ###################### Module ย่อย  ข้อมูลทั่วไป #################
  
else if($data_top["module_type"]=="general_data" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20'>
          <div id='<?= $_SESSION['menu'?>'>
            <ul><li>
              <a href='./index.php?mod=general_data&path=general_data&id_type=1'>หมู่บ้านในเขต อบต.</a>
            </li></ul>
          </div>
        </td>
      </tr>
<?php
  
}
//clock
  
else if($data_top["module_type"]=="clock" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20' align='center'>
          <?php include('coremain/module/clock/clock.php'); ?>
        </td>
      </tr>
<?php
  
}
//link_pic
  
else if($data_top["module_type"]=="link_pic" && $data_top['status']==1){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20' align='center'>
          <?php include('coremain/module/link_pic/link_pic.php'); ?>
        </td>
      </tr>
<?php
  
}
// ############################## link out ###############################
  
else if($data_top["module_type"]=="alink" && $data_top['status']==1){
    
$sql_alink="select name , url from cms_menu_sub WHERE id_top='$id_top' and status=1 order by position desc";
    
$result_alink=mysql_query($sql_alink);
    while(
$data_alink=mysql_fetch_array($result_alink)){
?>
      <tr bgcolor='<?= $_SESSION['bg_menu'?>'>
        <td colspan=2 height='20' align='left'>
          <div id='<?= $_SESSION['menu'?>'>
            <ul><li>
              <a href='<?= $_SERVER["http_host"?>/<?= $data_alink['url']?>' target='blank_'><img src='<?= $_SESSION['web_name'?>/theme/<?= $_SESSION['themes_'?>/<?= $_SESSION['image_menu'?>' border=0>&nbsp;&nbsp;<?= $data_alink['name'?></a>
            </li></ul>
          </div>
        </td>
      </tr>
<?php }
  }
?>
    </table>
<?php $count_l++;
}
?>
      
  <?php if($_SESSION['admin_web']=="admin") { ?>
    <!-- แถบสีปิดโมดูลสุดท้าย-->
    <table width='100%' border='0' cellpadding='0' cellspacing='0'>
      <tr>
        <td height='20' bgcolor='<?= $_SESSION['bg_textrun'?>'></td>
      </tr>
    </table>
  <?php }
    
    
// #################แถบเพิ่ม ฺBlog #################
    
if($_SESSION['admin_web']=="admin"){
      
$status_module=select_query("status_module","cms_status_module","id","12");
      if(
$status_module[0]==1){
    
?>
      <br/>
      <table width='100%' border='0' cellpadding='0' cellspacing='0'>
        <tr>
          <td align=center bgcolor='ffcc00'>
            <a href="javascript:void(0);" class="btn_addblog" id="2"><img src='coremain/images/true.gif' title='เพิ่ม Blog' border=0> เพิ่ม Blog</a>
          </td>
        </tr>
      </table><br>
    <?php
      
}
    
// ################ เพิ่มเมนูใหม่ ############
    
?>
      <br/>
    <?php
    
}
    
?>
    </td>
  </tr>
</table>