Пример #1
0
 public function view_sampleStandardList()
 {
     $type = array();
     $sizeCode = array();
     $sName = isset($_GET['sName']) ? post_check($_GET['sName']) : '';
     $typeId = isset($_GET['typeId']) ? $_GET['typeId'] : '';
     $where = 'where 1 ';
     if ($sName) {
         $where .= "and sName ='{$sName}' ";
         $this->smarty->assign('sName', $sName);
     }
     if ($typeId) {
         $where .= "and sampleTypeId\t ='{$typeId}' ";
         $this->smarty->assign('typeId', $typeId);
         $sampleList = SampleStandardModel::getNowStandardList("sName", "where sampleTypeId='{$typeId}' group by sName");
         $this->smarty->assign('sampleList', $sampleList);
     }
     $total = SampleStandardModel::getSampleStandardNum($where);
     $num = 20;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by sName,sampleTypeId,minimumLimit asc " . $page->limit;
     $DetectStandardAct = new DetectStandardAct();
     $SampleStandardList = $DetectStandardAct->act_getSampleStandardList('*', $where);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('SampleStandardList', $SampleStandardList);
     $sampleType = DetectStandardModel::getSampleTypeList("*", "where 1");
     $this->smarty->assign('sampleType', $sampleType);
     if (!empty($SampleStandardList)) {
         foreach ($SampleStandardList as $key => $v) {
             $sampleType = DetectStandardModel::getSampleTypeList("typeName", "where id={$v['sampleTypeId']}");
             $type[$key] = $sampleType[0]['typeName'];
             $getSampleSizeCode = SampleStandardModel::getSampleSizeCodeList("sampleNum", "where id={$v['sizeCodeId']}");
             $sizeCode[$key] = $getSampleSizeCode[0]['sampleNum'];
         }
     }
     $this->smarty->assign('type', $type);
     $this->smarty->assign('sizeCode', $sizeCode);
     $this->smarty->assign('secnev', '4');
     //二级导航
     $this->smarty->assign('module', '当前检测标准');
     $this->smarty->assign('username', $_SESSION['userName']);
     $navarr = array("<a href='index.php?mod=nowSampleStandard&act=nowSampleType'>iqc检测标准</a>", ">>", "检测样本标准");
     $this->smarty->assign('navarr', $navarr);
     $this->smarty->display('sampleStandard.html');
 }