/home/banprang/domains/plai.go.th/public_html/coremain/module/calendar/showevent.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
<?php
session_start
();
//include ("../../function_sql_query.php");
//include ("../../function_form.php");
include ("../../function_import_request.php");
echo
"<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>";
echo
"<link href='coremain/ccs/style.css' rel='stylesheet' type='text/css'>";
import_request_variables('pG''p_');
//#5.3#//if($p_dbname!="")                                                    {         $dbname=trim($p_dbname);                            }
$dbname = isset($p_dbname) ? $p_dbname '';
$_SESSION['dbname'] = isset($_SESSION['dbname']) ? trim($_SESSION['dbname']) : $dbname;
//#5.3#//if($p_member_c!="")                                 {        $member_c=trim($p_member_c);            }
$member_c = isset($p_member_c) ? $p_member_c '';
//#5.3#//if($member_c!="")                                    {        $_SESSION[member]=$member_c;            }
$_SESSION['member'] = isset($_SESSION['member']) ? $_SESSION['member'] : $member_c;
//#5.3#//if($p_per!="")                                        {         $per=trim($p_per);                        }
$per = isset($p_per) ? $p_per '';
//#5.3#//if($_SESSION['per']=="")                             {        $_SESSION['per']=$per;                    }
$_SESSION['per'] = isset($_SESSION['per']) ? trim($_SESSION['per']) : $per;

if(
$p_date!="")                                        {         $date=trim($p_date);                   }
if(
$p_month!="")                                    {         $month=trim($p_month);                 }
if(
$p_year!="")                                        {         $year=trim($p_year);                   }

include(
"../../../$_SESSION[web_name]/connect.php");
include(
"../../function_button.php");

$months1="0".$month;
$month=substr($months1,-2);
$query_Recordset "SELECT * FROM cms_calendar WHERE date = '$date-$month-$year' ORDER BY id DESC";
$Recordset mysql_query($query_Recordset);
$row_Recordset mysql_fetch_assoc($Recordset);
$totalRows_Recordset mysql_num_rows($Recordset);
//********************************* ทำการเช็คว่าปัจจุบัน ฐานข้อมูลใช้หน้ากากอะไร************************************************************
/*$sqltm="select * from main_themes where status=1";
$resulttm=mysql_query($sqltm);
$datatm=mysql_fetch_array($resulttm);
*/
?>
<table width='98%' border='0' cellspacing='0' align='center' height='20'>
  <tr>
    <td valign='top'>
      <table width='100%' border='0' cellspacing='1' align='center' cellpadding='0'>
        <tr> 
          <td bgcolor="#ffffff" height="292" valign="top">
          <!-- ส่วนหัว -->
          <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1'>
            <tr>
              <td width='100%' height='18'>
              <?php if($_SESSION['admin_web']=="admin" || $_SESSION['per']=="1"){ ?>
                <center><img src='coremain/images/add.gif'><a href="javascript:void(0);" class="num_addevent" id="<?php echo $year.'-'.$month.'-'.$date ?>">เพิ่มข้อมูล</a></center>
              <?php ?>
              </td>
            </tr>
          </table>
          
        <?php if($totalRows_Recordset == 0){ ?>
          <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' bgcolor='FFFFFF'>
            <tr>
              <td width='100%' height='80'><center><B>ยังไม่มีปฏิทินกิจกรรม</B></center></td>
            </tr>
          </table>
        <?php }else{
          do{ 
?>
          <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1'>
            <tr>
              <td width='80%'>&nbsp;<img src='coremain/images/arr3.jpg'> <?php echo $row_Recordset['event']; ?></td>
              <td>
            <?php if($row_Recordset['file'] != ""){ ?>
              &nbsp;<a href="#WIN" onClick="window.open('../../../<?php echo $_SESSION['web_name']?>/module_calendar/<? echo $row_Recordset[file];?>','blah2','width=779,height=685,resizable=yes    ,status=yes,scrollbar=yes')">เอกสาร</a>
            <?php }else{ echo "..........."; }

            if(
$_SESSION['admin_web']=="admin" || $_SESSION['per']=="1"){ ?>
              &nbsp;<a href="javascript:void(0);" class="num_addevent" id="<?php echo $year.'-'.$month.'-'.$date.'#@#'.$row_Recordset['id'?>"><img src="coremain/images/edit.gif" border="0" alt="แก้ไข" /></a>
              <!--&nbsp;<a href='update.php?id=<?php //echo $row_Recordset['id'] ?>&date=<?php //echo $date ?>&month=<?php //echo $month ?>&year=<?php //echo $year ?>&dbnames=<?php //echo $dbnames ?>'><img src='coremain/images/edit.gif' border='0' alt='แก้ไข'></a>-->
              &nbsp;<a href='delete.php?id_dels=<?php echo $row_Recordset['id'?>&date=<?php echo $date ?>&month=<?php echo $month ?>&year=<?php echo $year ?>' onclick='return goURL();'><img src='coremain/images/del1.gif' border='0'  alt='ลบ'></a>
            <?php ?>
              </td>
            </tr>
          </table>
      <?php
          
} while ($row_Recordset mysql_fetch_assoc($Recordset));
          
mysql_free_result($Recordset);
        }
      
?>
            <br><br>
            <!--<center><input type='submit' name='Submit2' value='ปิดหน้านี้' onmouseover="this.style.cursor='hand'" onclick='window.close()'></center>-->
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

<script language="JavaScript">
  
  function goURL() {
    var blnLink;
    blnLink = confirm("Click OK เพื่อยืนยันการลบข้อมูล?")

    if (!blnLink) { return false; }

    return true;
  }
  
  $('.num_addevent').click(function(){
    var id = $(this).attr('id').split('#@#');
    var arr = id[0].split('-');
    var arrData = [
      { name: 'date', value: arr[2] },
      { name: 'month', value: arr[1] },
      { name: 'year', value: arr[0] }
    ];
    var url = 'coremain/module/calendar/add_event.php';
    var title = 'เพิ่มปฏิทินงาน';
    if(id[1] !== undefined){
      arrData.push({ name: 'id', value: id[1] });
      url = 'coremain/module/calendar/update.php';
      title = 'แก้ไขปฏิทินงาน';
    }
    var dialog = 'dialog-popup';
    var popup = $('#'+dialog);
    showDialog(dialog);
    popup.dialog('option', 'title', title);
    
    $.ajax({
      type: 'post',
      url: url,
      data: arrData,
      success: function(result){
        popup.html(result);
      }
    });
  });
  
</script>