siteid.""; $data = $this->db->query($sql); $data = $data[0]; $this->site = $data; if ($data['fixflag'] =='Y')die('不好意思,網站目前維護中…'); /* if ( TM_REQUEST::getClientIp() <> '114.33.170.110' ){ die('不好意思,網站目前維護中…'); }*/ if ( $tpl <> '' ){ //$this->session->register('layout',tpl); $_SESSION['layout'] = $tpl; } if ( $_SESSION['layout'] <> '' ){ $this->site['layout'] = $_SESSION['layout']; } $this->site['css'] = "/" . $this->site['layout'] . "/css"; $this->site['js'] = "/" . $this->site['layout'] . "/js"; $show['title'] = $data['sitename']; $sql = "select * from page_type where siteid = " . $this->site['siteid'] . " and parentid = 0 order by typeid asc"; $d = $this->db->query($sql); for ($i=0;$idb->getOne("select url from filemanager where filefrom = 'type_picture' and fileid = '".$d[$i]['typeid']."_".$d[$i]['siteid']."' and uid = 1 "); $d[$i]['imageOver'] = $this->db->getOne("select url from filemanager where filefrom = 'type_picture' and fileid = '".$d[$i]['typeid']."_".$d[$i]['siteid']."' and uid = 2 "); } $show['menu'] = $d; } function viewContentsAction(){ } //藥品衛教單張 add by yiling 101.02.10 function viewhygieneListAction(){ $this->init($show); $type = $this->get('t'); $sql = "select * from hygienearticle,filemanager where depart_id = 'MED' and hygienearticle.id = filemanager.fileid and filemanager.filefrom = 'hygienearticle' order by id"; $d = $this->db->query($sql); for ( $i=0;$irender($this->site['layout'] . '/'.$type.'viewhygieneList.tpl', $data, $config,false)); echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } function viewPageAction(){ $this->init($show); $type = $this->get('t'); $parentid = $this->get('p'); if ( IDS::inject_check($type)||IDS::inject_check($parentid)){ header('Location: /med/viewMed' ); return; } $sql = "select * from page_type where typeid = ".$type." and parentid = ".$parentid." and siteid = " . $this->siteid; $vpData = $this->db->query($sql); if ( $vpData[0]['isPage'] == 1 ){ $sql = "select * from pages where siteid = ".$this->siteid." and maintype = ".$vpData[0]['typeid']." and subtype = ".$vpData[0]['parentid']." "; $data = $this->db->query($sql); $data = $data[0]; $kind = '0'.$type; $data['img_head'] = "images/kind".$kind.".jpg"; if ( $data['islink'] == 1 && $data['link'] <> '' ){ header('Location: ' . $data['link'] ); return; } $data['lastUpdate'] = ( $data['upd_date'] == '' or $data['upd_date'] == '0000-00-00 00:00:00' ) ? $data['cre_date'] : $data['upd_date'] ; if (!( $data['lastUpdate'] == '' or $data['lastUpdate'] == '0000-00-00' )){ $data['lastUpdate'] = "最後更新日期 : " . substr($data['lastUpdate'],0,10); } $show['cp1'] = str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/viewPage.tpl', $data, $config,false)); }else{ } echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } //藥品異動資訊 add by yiling 101.02.10 function viewchangeListAction(){ $this->init($show); $type = $this->get('t'); $sql = "select * from med_change order by post_date desc"; $d = $this->db->query($sql); for ( $i=0;$irender($this->site['layout'] . '/'.$type.'viewchangeList.tpl', $data, $config,false)); echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } function viewListAction(){ $this->init($show); $type = $this->get('t'); $sql = "select * from news where news_type = '$type' order by startdate desc"; $d = $this->db->query($sql); $data['data'] = $d; $show['cp1'] = str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/'.$type.'List.tpl', $data, $config,false)); echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } function viewDetailAction(){ $this->init($show); $id = $this->get('id'); $sql = "select * from news where newsid = $id"; $d = $this->db->query($sql); $data = $d[0]; $data['lastUpdate'] = ( $data['upd_date'] == '' or $data['upd_date'] == '0000-00-00 00:00:00' ) ? $data['cre_date'] : $data['upd_date'] ; $data['contents'] = str_replace(chr(10),'
',$data['contents']); $data['pre'] = $_SERVER['HTTP_REFERER']; $show['cp1'] = str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/viewDetail.tpl', $data, $config,false)); echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } /* function viewMedListAction(){ $pagesize = 10; $type = $this->get('type'); $start = $this->get('start'); $keyword = strtoupper($this->get('keyword')); $contents['keyword'] = $keyword; if ( $start == '' ) $start = 0; }*/ function viewMedAction(){ $this->init($show); /* $type = $this->get('t'); $parentid = $this->get('p'); $sql = "select * from page_type where typeid = $type and parentid = $parentid and siteid = " . $this->siteid; $vpData = $this->db->query($sql); if ( $vpData[0]['isPage'] == 1 ){ $sql = "select * from pages where siteid = ".$this->siteid." and maintype = ".$vpData[0]['typeid']." and subtype = ".$vpData[0]['parentid']." "; $data = $this->db->query($sql); $data = $data[0]; $kind = '0'.$type; $data['img_head'] = "images/kind".$kind.".jpg"; if ( $data['islink'] == 1 && $data['link'] <> '' ){ header('Location: ' . $data['link'] ); return; } $data['lastUpdate'] = ( $data['upd_date'] == '' or $data['upd_date'] == '0000-00-00 00:00:00' ) ? $data['cre_date'] : $data['upd_date'] ; if (!( $data['lastUpdate'] == '' or $data['lastUpdate'] == '0000-00-00' )){ $data['lastUpdate'] = "最後更新日期 : " . substr($data['lastUpdate'],0,10); } $show['cp1'] = str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/viewMedSys.tpl', $data, $config,false)); }else{ }*/ $show['cp1'] = str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/viewMed.tpl', $data, $config,false)); echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } function viewMedListAction(){ $this->init($show); $pagesize = 10; $type = $this->request->getPost('type'); if ( $type == '' ){$type = $this->get('type');} $keyword = trim(strtoupper($this->request->getPost('keyword'))); if ( $keyword == '' ){$keyword = trim(strtoupper($this->get('keyword')));} $start = $this->get('start'); $contents['keyword'] = $keyword; if ( $start == '' ) $start = 0; $ps = $start - 2; if ( $ps < 0 ) $ps = 0; //if ( $keyword <> '' ){ switch ( $type ){ case 'trade_desc'://商品名 $w = " where upper(trade_desc) like '%$keyword%' "; break; case 'med_desc'://處方名 $w = " where upper(med_desc) like '%$keyword%' "; break; case 'chn_desc'://中文名 $w = " where upper(chn_desc) like '%$keyword%' "; break; case '': $w = " where upper(med_desc) like '%$keyword%' or upper(trade_desc) like '%$keyword%' or upper(chn_desc) like '%$keyword%' "; break; } $contents[$type] = " selected='selected' "; $sql = "select distinct med_code from med_pic $w"; $t = $this->db->query($sql); $total = count($t); $sql = "select distinct med_code from med_pic $w order by start_date desc limit ". ( $start * $pagesize ) .",$pagesize"; $med_data = $this->db->query($sql); for ( $j=0;$jdb->query($sql); if ( $t[0]['med_code'] == '' or $t[0]['med_code'] == NULL ) continue; $temp = ''; $temp[] = ( $t[0]['sizew'] <> '' )?"寬:" . $t[0]['sizew'] . $c :''; $temp[] = ( $t[0]['sizeh'] <> '' )?"高:" . $t[0]['sizeh'] . $c :''; $temp[] = ( $t[0]['shape'] <> '' )?"劑型:" . $t[0]['shape'] . $c :''; $temp[] = ( $t[0]['color'] <> '' )?"顏色:" . $t[0]['color'] . $c :''; $temp[] = ( $t[0]['strip_type'] <> '' )?"剝痕否:" . $t[0]['strip_type'] :''; $t[0]['type'] = implode(' ',$temp); //有藥品圖片才show圖 add by yiling 101.02.09 $path = '/var/www/paoweb/demo/view/images/uploads/files/MedPicture'; $filename = $t[0]['med_code'].'_'.$t[0]['start_date'].'.jpg'; if (file_exists($path."/".$filename)) { $t[0]['med_img'] = "/images/uploads/files/MedPicture/".$filename; $t[0]['med_link'] = ''; }else{ $t[0]['med_img'] = "/med/images/none.gif"; $t[0]['med_link'] = ''; } //echo '
/ '.$filename.' : '.$t[0]['med_img']; //$t[0]['picpath'] = ( file_exists (APP_DIR . "/view/images/uploads/files/MedPicture/" . $t[0]['med_code'] . "_" . $t[0]['med_code'] .".jpg") )?'TRUE':'FALSE' ; //$t[0]['picpath2'] = APP_DIR . "/view/images/uploads/files/MedPicture/" . $t[0]['med_code'] . "_" . $t[0]['med_code'] .".jpg"; $data[] = $t[0];// } if ( count($data) <= 0 ){ $contents['noresult'] = "
請重新輸入你要搜尋的關鍵字
"; } if ( $total / $pagesize > 0 ){ $t = ceil($total / $pagesize); $contents['nav_desc'] = '每頁 '.$pagesize.' 筆,共有' . $total . '筆訊息'; if ( $start > 0 ){ $contents['nav'] .= '
第一頁 ' ; $contents['nav'] .= '上一頁 ' ; } if ( $t > 1 ){ for ( $i=$ps;$i<$t;$i++ ){ $s++; if ( $s < 7 or ( $t - $s ) < 2 ){ $contents['nav'] .= ' ' . ( $i + 1 ) . ' ' ; } if ($s == 7 ){ $contents['nav'] .= "~~"; } } } if ( ( $start + 1 ) < $t ){ $contents['nav'] .= '下一頁 ' ; $contents['nav'] .= '最後頁 ' ; } } $contents['med'] = $data; $show['cp1'] = str_replace("/view/","/",$this->render($this->site['layout'] . '/viewMedList.tpl', $contents, $config,false)); echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } function indexAction(){ $this->init($show); $sql = "select * from news where news_type = 'news' order by startdate desc"; $nd = $this->db->query($sql); $data['data'] = $nd; //var_dump($data); $show['cp1'] = str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/viewInfoList.tpl', $data, $config,false)); //$show['contents'] = str_replace("/view/","/",$this->render($this->site['layout'] . '/movie.tpl', $data, $config,false)); echo str_replace("/demo/view/","/",$this->render($this->site['layout'] . '/main.tpl', $show, $config,false)); } } 社團法人寶建醫院網站管理