function execute() { $_Title = 'Quản lý Bệnh viện'; $_msg = null; $captcha = new SimpleCaptcha(); $formmode = $_POST["formmode"]; $mode_inpvl = __post('mode_inpvl'); $captchatxt = __post('captcha'); $captchaForm = __post('captchaForm'); $idchk = $_POST["chk"]; $flagCaptcha = $captcha->CaptchaValidate($captchatxt); $flagCaptchaForm = $captcha->CaptchaValidate($captchaForm); $id = __post('Id'); /*===================================*/ if ($formmode != '') { $name = __post("name"); $province_id = __post("province_id"); $status = (int) __post("status"); $order = (int) __post("order"); $_msg = $this->form_add($id, $province_id, $name, $status, $order); if (!isset($_msg)) { $_msg['result'] = -20; } } $list_form = new XTemplate('Config/Hospital.html'); $left_menu = $this->rmenu(); $list_form->assign('slide_bar', $this->slide_bar($left_menu)); $list_form->assign('tabs', $this->set_tabs()); $list_form->assign('dialog_title', 'thành viên'); $CaptchaText = $captcha->CreateText(); /****** Delete (8) - Export (16) ***********************************/ $arr_attr_btnmdelete = array('style' => '', 'onclick' => 'sbm_form(8,\'' . $CaptchaText . '\')'); $inp_btnmdelete = addInput2('button', 'btndelete', $btnmdelete, $arr_attr_btnmdelete, $list_form, 'Xóa'); if ($mode_inpvl == 'DELETE') { $idList = '0'; foreach ($idchk as $ind => $delvl) { $idArr = explode('|', $delvl); if ($idArr[1] == $this->md5sum($this->prefix['delete'] . $idArr[0])) { $idList .= ',' . $idArr[0]; } } if ($idList != '0') { $_msg = $this->form_delete($idList); } } /****** Delete (8) - Export (16) ***********************************/ if ($this->acl_per(16)) { $arr_attr_btnexport = array('style' => '', 'onclick' => 'sbm_form(16,\'' . $CaptchaText . '\')'); $inp_btnexport = addInput2('button', 'btnexport', $btnexport, $arr_attr_btnexport, $list_form, 'Xuất Excel'); } /************************************* *****************/ $keyword = __post("keyword"); $selectkeyword = __post("selectkeyword"); $Attr_keyword = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập Keyword \'}', 'style' => ''); $txt_keyword = addInput('text', 'keyword', $keyword, $Attr_keyword, $list_form); $infosk[0] = array('t1.name' => 'Tên bệnh viện'); $vlkey = array_keys($infosk[$selectkeyword]); //list($vlkey, $vlval) = each(); $Attr_selectkeyword = array('style' => ''); $txt_selectkeyword = addSelectList5('selectkeyword', $infosk, NULL, $Attr_selectkeyword, $list_form, $selectkeyword); if ($keyword != '' && $vlkey[0] != '') { $filter = ' and ' . $vlkey[0] . " like N'%{$keyword}%'"; } $s_province_id = (int) __post('s_province_id'); $s_status = __post('s_status'); if ($s_province_id > 0) { $filter = ' and t1.province_id = ' . $s_province_id; } if ($s_status != "") { $filter = ' and t1.status = ' . (int) $s_status; } //-----------------------------------------// $gridview = ''; $gridview .= $this->PageHeader(); $gridview .= $this->_AddPageHeader(); $exportGrid = $this->setHeader(); $DBList = $this->setList($CaptchaText, $filter, $conpany_list); $exportGrid .= $DBList[0]; $gridview .= $exportGrid; $gridview .= $this->setFooter(); $gridview .= $this->setPaging(); $arr_info_province_id = $this->getListProvince(); $Attr_province_id = array('style' => ''); $txt_province_id = addSelectList2('s_province_id', $arr_info_province_id, "-- Tất cả --", $Attr_province_id, $list_form, $s_province_id); $arr_info_status = array(1 => 'Active', 0 => 'InActive'); $Attr_status = array('style' => ''); $txt_status = addSelectList2('s_status', $arr_info_status, "-- Tất cả --", $Attr_status, $list_form, $s_status); if ($mode_inpvl === 'EXPORT' && $this->acl_per(16)) { $this->ExportToExcel(fnStrConvert($_Title), strip_tags($exportGrid, '<table><tr><td><th>')); die; } //-----------------------------------------// setMessage($list_form, $_msg); $list_form->assign('title', $_Title); $list_form->assign('_error_', $error); $list_form->assign('gridview', $gridview); $list_form->parse('main'); $this->html = $list_form->out_return('main'); echo $this->html; }
function page_news($home = false, $search = false) { global $db, $fullsite, $cla_cid, $cla_nid, $cla_site, $ts_config; $curPage = $_POST['page']; if ((int) $curPage <= 0) { $curPage = 1; } $lang = '_' . get_language(); if ($home) { $title_page = get_lang('home'); } if ($search == true && __post('txt_search') != '') { $filter_search = " and (keyword_vi like '%" . __post('txt_search') . "%' or keyword_en like '%" . __post('txt_search') . "%' )"; if ($search == true && $has_data == false) { $title_page = get_lang('search_result'); } } if ($home == true || $search == true) { echo '<div class="group_area"> <div style="background-color:#71baf1;" class="lft-title"> ' . $title_page . ' </div> <div class="group_content">'; } if ((int) $cla_cid > 0 || $home) { $PageSize = (int) $ts_config['max_news_page']; $from = ($curPage - 1) * $PageSize; $limit = $PageSize; $sqlTotal = "SELECT count(*) as TotalRecord FROM ntk_news WHERE status = 1"; if ((int) $cla_cid > 0) { $sqlTotal .= " and cid=" . $cla_cid . " "; } if ((int) $cla_nid > 0) { $sqlTotal .= " AND id<=" . $cla_nid; } $sqlTotal .= $filter_search; if ($home) { $sqlTotal .= " AND show_index = 1 "; } //echo $sqlTotal; $result = $db->query($sqlTotal, true, "Query failed"); $TotalRecord = 0; if ($aR = $db->fetchByAssoc($result)) { $TotalRecord = (int) $aR['TotalRecord']; } $has_data = false; if ($TotalRecord > 0) { $TotalPage = intval($TotalRecord / $PageSize + ($TotalRecord % $PageSize > 0 ? 1 : 0)); $paging = Paging2($TotalPage, $curPage, 'form1'); $sql = "SELECT t1.*,t2.menu_name" . $lang . " FROM ntk_news t1\n\t\t\t\t\tleft join ntk_menus t2 on t1.cid = t2.menu_id\n\t\t\t\tWHERE t1.status = 1"; if ((int) $cla_cid > 0) { $sql .= " and t1.cid=" . $cla_cid . " "; } if ((int) $cla_nid > 0) { $sql .= " AND t1.id = " . $cla_nid; } if ($home) { $sql .= " AND t1.show_index = 1 "; } $sql .= $filter_search; $sql .= "ORDER BY news_order ASC,id ASC \tLIMIT " . $from . "," . $limit . " "; //echo $sql; $result = $db->query($sql, true, "Query failed"); echo '<form action="" name="form1" id="form1" method="POST"> <input type="hidden" value="1" name="page" id="page"/> '; $stt = 0; while ($aR = $db->fetchByAssoc($result)) { if ($aR['title' . $lang] != '' && $aR['short' . $lang] != '') { if ($stt == 0) { if ($home == false && $search == false) { echo '<div class="group_area"><div style="background-color:#71baf1;" class="lft-title">' . $aR['menu_name' . $lang] . '</div><div class="group_content">'; } } $has_data = true; $title_url = ''; $title_url = fnStrConvert($aR['title' . $lang]); $title_url = str_replace(" ", '-', $title_url); echo '<div class="news_title"><a href="' . $fullsite . '/' . (int) $aR['cid'] . '/' . (int) $aR['id'] . '/' . $title_url . '.html">' . $aR['title' . $lang] . '</a></div>'; echo '<div><div class="news_date">' . date2vndate($aR['create_date']) . '</div><div class="news_download">'; $sql = " select t1.*,t2.file_type_name,t2.file_type_icon \n\t\t\t\t\t\t\t\tfrom ntk_new_files t1\n\t\t\t\t\t\t\t\tleft join ntk_file_type t2 on t1.file_type_id = t2.file_type_id\n\t\t\t\t\t\t\t\twhere t1.new_id = " . (int) $aR['id'] . "\n\t\t\t\t\t\t"; $result_file = $db->query($sql, true, "Query failed"); $i = 0; while ($aR_file = $db->fetchByAssoc($result_file)) { if ($i == 0) { echo '<span class="download_file_title">Tải file tại đây</span> '; } if ($aR_file['require_login'] == 1 && !is_login()) { $href = 'javascript:notLogin();'; } else { $href = $ts_config['site_url_download_file'] . $aR_file['file_path']; } if ($i > 0) { echo ' | '; } //$urlre = $sugar_config['site_url_download_file']."/download_file_case.php?fn=".$filePath; //header('location:'.$urlre.''); //die(); echo '<a href="' . $href . '"><img src="' . $fullsite . '/images/' . $aR_file['file_type_icon'] . '"></a>'; $i++; } echo '</div></div><br>'; echo '<div class="news_short"><div style="width:25px; float:left;"> </div>' . html_entity_decode($aR['short' . $lang]) . ' <a href="' . $fullsite . '/' . (int) $aR['cid'] . '/' . (int) $aR['id'] . '/' . $title_url . '.html">' . get_lang('text_detail') . '</a></div>'; echo '<hr size=2 style="color:#cccccc">'; $stt++; } } if ($has_data == true) { echo '<div style="margin-top:10px;margin-bottom:10px;">' . $paging . '</div>'; } } if ($search == true && $has_data == false) { echo '<div style="">' . get_lang('search_no_result') . '</div>'; } echo "</form1>"; echo "</div></div>"; } }
function tag_link($text) { $text = fnStrConvert($text); $regexp = "/( )/i"; $text = preg_replace($regexp, "-", $text); return $text; }
function page_news($home = false) { global $db, $fullsite, $cla_cid, $cla_nid, $cla_site, $ts_config; $lang = '_' . get_language(); if ((int) $cla_cid > 0 || $home) { $sql = "SELECT * FROM ntk_news WHERE status = 1"; if ((int) $cla_cid > 0) { $sql .= " and cid=" . $cla_cid . " "; } if ((int) $cla_nid > 0) { $sql .= " AND id<=" . $cla_nid; } if ($home) { $sql .= " AND show_index = 1 "; } $sql .= "ORDER BY news_order ASC,id ASC \tLIMIT 0,10 "; //echo $sql;die(); $result = $db->query($sql, true, "Query failed"); while ($aR = $db->fetchByAssoc($result)) { if ($aR['title' . $lang] != '' && $aR['short' . $lang] != '') { $title_url = ''; $title_url = fnStrConvert($aR['title' . $lang]); $title_url = str_replace(" ", '-', $title_url); echo '<div class="news_title"><a href="' . $fullsite . '/' . (int) $aR['cid'] . '/' . (int) $aR['id'] . '/' . $title_url . '.html">' . $aR['title' . $lang] . '</a></div>'; echo '<div><div class="news_date">' . date2vndate($aR['create_date']) . '</div><div class="news_download">'; $sql = " select t1.*,t2.file_type_name,t2.file_type_icon \n\t\t\t\t\t\t\tfrom ntk_new_files t1\n\t\t\t\t\t\t\tleft join ntk_file_type t2 on t1.file_type_id = t2.file_type_id\n\t\t\t\t\t\t\twhere t1.new_id = " . (int) $aR['id'] . "\n\t\t\t\t\t"; $result_file = $db->query($sql, true, "Query failed"); $i = 0; while ($aR_file = $db->fetchByAssoc($result_file)) { if ($aR_file['require_login'] == 1 && !is_login()) { $href = 'javascript:notLogin();'; } else { $href = $ts_config['site_url_download_file'] . $aR_file['file_path']; } if ($i > 0) { echo ' | '; } //$urlre = $sugar_config['site_url_download_file']."/download_file_case.php?fn=".$filePath; //header('location:'.$urlre.''); //die(); echo '<a href="' . $href . '"><img src="' . $fullsite . '/images/' . $aR_file['file_type_icon'] . '"></a>'; $i++; } echo '</div></div><br>'; echo '<div class="news_short"><div style="width:25px; float:left;"> </div>' . $aR['short' . $lang] . ' <a href="' . $fullsite . '/' . (int) $aR['cid'] . '/' . (int) $aR['id'] . '/' . $title_url . '.html">' . get_lang('text_detail') . '</a></div>'; echo '<hr size=2 style="color:#cccccc">'; } } } }
function execute() { global $ts_config; $_Title = 'Forum - Quản lý Bài đăng'; $_msg = null; $captcha = new SimpleCaptcha(); $formmode = $_POST["formmode"]; $mode_inpvl = __post('mode_inpvl'); $captchatxt = __post('captcha'); $captchaForm = __post('captchaForm'); $idchk = $_POST["chk"]; $flagCaptcha = $captcha->CaptchaValidate($captchatxt); $flagCaptchaForm = $captcha->CaptchaValidate($captchaForm); $id = __post('Id'); /*===================================*/ if ($formmode != '') { $menu_id = __post("menu_id"); $title_vi = __post("title_vi"); $title_en = __post("title_en"); $short_vi = __post("short_vi"); $short_en = __post("short_en"); $content_vi = __post("content_vi"); $content_en = __post("content_en"); $keyword_vi = __post("keyword_vi"); $keyword_en = __post("keyword_en"); $status = (int) __post("status"); $show_index = (int) __post("show_index"); $result_id = $this->form_add($id, $menu_id, $title_vi, $title_en, $short_vi, $short_en, $content_vi, $content_en, $keyword_vi, $keyword_en, $status, $show_index); if ((int) $id <= 0) { $id = $result_id; } /* $result = UpLoadMultiFile($ts_config['upload_dir'],'filenew',$gen_name = false,$title='',$max_size=9048576); $file_type_id = 7; foreach($result as $k=>$va){ $sSQL = "insert into ntk_new_files(new_id,file_name,file_path,file_type_id,require_login) values(".$id.",'".$va['name']."','".$va['file_name']."',".$file_type_id.",1) "; $re = $this->db->query($sSQL, true, "Query failed"); }*/ if ($result_id > 0) { $_msg['result'] = 1; } else { $_msg['result'] = -20; } } $list_form = new XTemplate('Config/Post.html'); $left_menu = $this->rmenu(); $list_form->assign('slide_bar', $this->slide_bar($left_menu)); $list_form->assign('tabs', $this->set_tabs()); $list_form->assign('dialog_title', 'thành viên'); $CaptchaText = $captcha->CreateText(); /****** Delete (8) - Export (16) ***********************************/ $arr_attr_btnmdelete = array('style' => '', 'onclick' => 'sbm_form(8,\'' . $CaptchaText . '\')'); $inp_btnmdelete = addInput2('button', 'btndelete', $btnmdelete, $arr_attr_btnmdelete, $list_form, 'Xóa'); if ($mode_inpvl == 'DELETE') { $idList = '0'; foreach ($idchk as $ind => $delvl) { $idArr = explode('|', $delvl); if ($idArr[1] == $this->md5sum($this->prefix['delete'] . $idArr[0])) { $idList .= ',' . $idArr[0]; } } if ($idList != '0') { $_msg = $this->form_delete($idList); } } /****** Delete (8) - Export (16) ***********************************/ if ($this->acl_per(16)) { $arr_attr_btnexport = array('style' => '', 'onclick' => 'sbm_form(16,\'' . $CaptchaText . '\')'); $inp_btnexport = addInput2('button', 'btnexport', $btnexport, $arr_attr_btnexport, $list_form, 'Xuất Excel'); } /************************************* *****************/ $keyword = __post("keyword"); $selectkeyword = __post("selectkeyword"); $Attr_keyword = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập Keyword \'}', 'style' => ''); $txt_keyword = addInput('text', 'keyword', $keyword, $Attr_keyword, $list_form); $infosk[0] = array('t1.title_vi' => 'Tên bài đăng(vi)'); $infosk[1] = array('t1.title_en' => 'Tên bài đăng(en)'); $vlkey = array_keys($infosk[$selectkeyword]); //list($vlkey, $vlval) = each(); $Attr_selectkeyword = array('style' => ''); $txt_selectkeyword = addSelectList5('selectkeyword', $infosk, NULL, $Attr_selectkeyword, $list_form, $selectkeyword); if ($keyword != '' && $vlkey[0] != '') { $filter .= ' and ' . $vlkey[0] . " like N'%{$keyword}%'"; } $category_id = (int) __post('category_id'); $status = __post('status'); $show_index = __post('show_index'); //echo $filter; if ($category_id > 0) { $filter .= ' and t1.cid = ' . $category_id; } if ($status != "") { $filter .= ' and t1.status = ' . (int) $status; } if ($show_index != "") { $filter .= ' and t1.show_index = ' . (int) $show_index; } //-----------------------------------------// $gridview = ''; $gridview .= $this->PageHeader(); $gridview .= $this->_AddPageHeader(); $exportGrid = $this->setHeader(); $DBList = $this->setList($CaptchaText, $filter, $conpany_list); $exportGrid .= $DBList[0]; $gridview .= $exportGrid; $gridview .= $this->setFooter(); $gridview .= $this->setPaging(); $arr_info_show_index = array(1 => 'Hiển thị trang chủ', 0 => 'Không hiển thị trang chủ'); $Attr_show_index = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng chọn trạng thái \'}', 'style' => ''); $txt_show_index = addSelectList2('show_index', $arr_info_show_index, '-- Trang chủ --', $Attr_show_index, $list_form, $show_index); $arr_info_category_id = $this->getListPostCategories(); $Attr_category_id = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng chọn danh mục \'}', 'style' => 'width:400px;'); $txt_category_id = addSelectList2('category_id', $arr_info_category_id, '-- Danh mục --', $Attr_category_id, $list_form, $category_id); $arr_info_status = array(1 => 'Active', 0 => 'InActive'); $Attr_status = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng chọn trạng thái \'}', 'style' => ''); $txt_status = addSelectList2('status', $arr_info_status, '-- Trạng thái --', $Attr_status, $list_form, $status); if ($mode_inpvl === 'EXPORT' && $this->acl_per(16)) { $this->ExportToExcel(fnStrConvert($_Title), strip_tags($exportGrid, '<table><tr><td><th>')); die; } //-----------------------------------------// setMessage($list_form, $_msg); $list_form->assign('title', $_Title); $list_form->assign('_error_', $error); $list_form->assign('gridview', $gridview); $list_form->parse('main'); $this->html = $list_form->out_return('main'); echo $this->html; }