Пример #1
0
 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;
 }
Пример #2
0
 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;
 }