/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/*
Program :
Description :
Programmer : ไชยรัตน์ สุนทรวิภาต
Individual
Email : pipo@sixhead.com
Website : http://www.sixhead.com
: http://www.todaysoftware.com
Office
Email : pipo@digithais.com
Website : http://www.digithais.com
Date :
Modify log :
*/
/*------------------------------------------------------------------*/
/*- Require --------------------------------------------------------*/
require_once "../../../module/_config.php";
require_once "../../../module/_module.php";
require_once "../../../module/_module_control.php";
require_once "../../../module/SiXhEaD.Template.php";
require_once "../../../module/SiXhEaD.SplitPage.php";
/*------------------------------------------------------------------*/
/*- Template -------------------------------------------------------*/
$tp_index = "_tp_index.html";
/*------------------------------------------------------------------*/
/*- Config & Misc --------------------------------------------------*/
$strCurrentLangauge = "En";
/*------------------------------------------------------------------*/
/*- Request --------------------------------------------------------*/
$Keyword = $_REQUEST[Keyword];
$ContentDateK = $_REQUEST[ContentDateK];
$ContentDateKEnd = $_REQUEST[ContentDateKEnd];
$Search = $_REQUEST[Search];
$ContentCategoryId = $_REQUEST[ContentCategoryId];
/*------------------------------------------------------------------*/
/*- Program --------------------------------------------------------*/
#if ($Keyword == "") {
# $Keyword = "";
#}
$ContentCategoryIdSql = "%";
if ($ContentCategoryId) {
$ContentCategoryIdSql = $ContentCategoryId;
}
$tp = new Template($tp_index);
$intCurrentYear = date("Y");
$strCurrentYearShow = setYear($intCurrentYear,$strCurrentLangauge);
$tp->Block("CurrentYearShow");
$tp->Apply();
if ($Search) {
$KeywordSql = "%";
if ($Keyword) {
$KeywordSql = "%$Keyword%";
}
$tp->Block("CurrentYearShow");
$tp->Hide();
}
$strOtherSql = "WHERE IsLocal = 'N' AND Active = 'Y' AND Title$strCurrentLangauge != '' AND ContentDate LIKE '$intCurrentYear-%' AND ContentCategoryId LIKE '$ContentCategoryIdSql'";
if ($Search) {
$strOtherSql = "WHERE IsLocal = 'N' AND Active = 'Y' AND Title$strCurrentLangauge LIKE '$KeywordSql' AND ContentCategoryId LIKE '$ContentCategoryIdSql'";
}
$objDb = mysql_connect($strCfgDbHost,$strCfgDbUser,$strCfgDbPass);
mysql_select_db($strCfgDbName);
if (!$objDb) { die('Could not connect: ' . "" /*mysql_error()*/); }
mysql_query("SET NAMES TIS620");
mysql_query("SET character_set_results=tis620");
$strDbTable = $strCfgDbTableNews;
$strOrderBy = "ContentDate DESC";
$strPrimaryKey = "ContentId";
$strOtherSelect = "*"; # ลงท้ายด้วย ,
$strOtherSql = $strOtherSql; # WHERE, LEFT JOIN
$strLinkParameter = "&Keyword=$Keyword&ContentDateK=$ContentDateK&ContentDateKEnd=$ContentDateKEnd&Search=$Search&ContentCategoryId=$ContentCategoryId"; # &Temp=$Temp
$intListPerPage = 10;
$strTextPrev = "‹ Prev";
$strTextNext = "Next ›";
$strTextFirst = "« First";
$strTextLast = "Last »";
$strSplitPLeft = " l ";
$strSplitPRight = "";
$intSplitTrim = 0;
/*
# --- Style 2 --- #
$strTextPageNow = "หน้าที่";
$strTextPageOf = "/";
$strTextPageUnit = "หน้า";
$strTextPageGo = "ไป";
$sp->Style(2);
$sp->Split($strDbTable,$strOrderBy,$strPrimaryKey,$strOtherSelect,$strOtherSql,$intListPerPage,$strLinkParameter);
*/
$sp = New SplitPage();
$sp->Style(1);
$sp->Split($strDbTable,$strOrderBy,$strPrimaryKey,$strOtherSelect,$strOtherSql,$intListPerPage,$strLinkParameter,$strTextFirst,$strTextLast,$strTextPrev,$strTextNext,$strSplitPLeft,$strSplitPRight,$intSplitTrim,$strTextPageNow,$strTextPageOf,$strTextPageUnit,$strTextPageGo);
$strPageLink = $sp->getPageLink();
$intRecordAll = $sp->getRecordAll();
$strSql = $sp->getSql(0);
$tp->Block("Data");
$objResult = mysql_query($strSql);
if (!$objResult) { echo "$strSqlChangeMe"; die("Invalid query: " . "" /*mysql_error()*/); }
while($row = mysql_fetch_array($objResult)) {
$ContentId = $row[ContentId];
$Title = $row["Title$strCurrentLangauge"];
$ContentDate = $row[ContentDate];
$ContentCategoryId2 = $row[ContentCategoryId];
$ContentDateShow = formatDateTimeString($ContentDate,$strCurrentLangauge);
$CategoryNameTemp = "";
if (!$ContentCategoryId) {
$strSqlExtra = "SELECT CategoryName$strCurrentLangauge FROM $strCfgDbTableNewsCategory WHERE ContentCategoryId = $ContentCategoryId2";
$objResultExtra = mysql_query($strSqlExtra);
if (!$objResultExtra) { echo "$strSqlExtra"; die("\n Invalid query: " . "" /*mysql_error()*/); }
while($rowExtra = mysql_fetch_array($objResultExtra)) {
$CategoryNameTemp = $rowExtra["CategoryName$strCurrentLangauge"];
}
mysql_free_result($objResultExtra);
$CategoryNameTemp = " ($CategoryNameTemp)";
}
$tp->Apply();
}
mysql_free_result($objResult);
$strContentCategoryIdSelect = <<::: Select :::
Data;
$strSql = "SELECT ContentCategoryId,Categoryname$strCurrentLangauge FROM $strCfgDbTableNewsCategory WHERE Active = 'Y' ORDER BY SortOrder";
$objResult = mysql_query($strSql);
if (!$objResult) { echo "$strSqlChangeMe"; die("Invalid query: " . "" /*mysql_error()*/); }
while($row = mysql_fetch_array($objResult)) {
$ContentCategoryIdTemp = $row[ContentCategoryId];
$CategoryNameTemp = $row["Categoryname$strCurrentLangauge"];
$strSelected = "";
if ($ContentCategoryIdTemp == $ContentCategoryId) {
$strSelected = "selected";
}
$strContentCategoryIdSelect .= <<$CategoryNameTemp
Data;
}
mysql_free_result($objResult);
$CategoryName = "";
if ($ContentCategoryId) {
$strSql = "SELECT Categoryname$strCurrentLangauge FROM $strCfgDbTableNewsCategory WHERE ContentCategoryId = $ContentCategoryId";
$objResult = mysql_query($strSql);
if (!$objResult) { echo "$strSqlChangeMe"; die("Invalid query: " . "" /*mysql_error()*/); }
while($row = mysql_fetch_array($objResult)) {
$CategoryName = $row["Categoryname$strCurrentLangauge"];
}
mysql_free_result($objResult);
}
mysql_close($objDb);
if ($Search && $ContentId == "") {
$CategoryName = "";
$tp->Block("SearchNotFound");
$tp->Apply();
}
if (!$Keyword && !$Search) {
$Keyword = "";
}
$tp->Display();
exit;
/*------------------------------------------------------------------*/
?>