function act_getSampleCoefficientList($select, $where) { $list = SampleCoefficientModel::getSampleCoefficientList($select, $where); if ($list) { return $list; } else { self::$errCode = SampleCoefficientModel::$errCode; self::$errMsg = SampleCoefficientModel::$errMsg; return false; } }
function act_getCnameInfo() { $id = $_POST['id']; $list = SampleCoefficientModel::getSampleCoefficientList("distinct(cName)", "where sampleTypeId = '{$id}'"); if ($list) { return $list; } else { self::$errCode = SampleCoefficientModel::$errCode; self::$errMsg = SampleCoefficientModel::$errMsg; return false; } }
public function view_getSampleCoefficientList() { if (!isset($_SESSION['userId'])) { //检测用户是否登陆 header('location:index.php?mod=login&act=index'); exit; } $type = isset($_GET['type']) ? $_GET['type'] : ''; $status = isset($_GET['status']) ? $_GET['status'] : ''; $sampleCoefficientAct = new SampleCoefficientAct(); $where = 'WHERE 1=1 '; if ($type == 'search') { $cName = isset($_GET['cName']) ? $_GET['cName'] : ''; $sampleTypeId = isset($_GET['sampleTypeId']) ? $_GET['sampleTypeId'] : ''; if (!empty($cName)) { $where .= "AND cName='{$cName}' "; } if (!empty($sampleTypeId)) { $where .= "AND sampleTypeId='{$sampleTypeId}' "; } } $total = $sampleCoefficientAct->act_getSampleCoefficientCount($where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "ORDER BY id " . $page->limit; $sampleCoefficientList = $sampleCoefficientAct->act_getSampleCoefficientList('*', $where); for ($i = 0; $i < count($sampleCoefficientList); $i++) { //将id对应Name及Num添加到数组中 $sampleCoefficientList[$i]['sampleTypeName'] = SampleCoefficientModel::getSampleTypeNameById($sampleCoefficientList[$i]['sampleTypeId']); $sampleCoefficientList[$i]['sizeCodeNum'] = SampleCoefficientModel::getSizeCodeNumById($sampleCoefficientList[$i]['sizeCodeId']); } 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)); } $navarr = array("<a href='index.php?mod=sampleStandard&act=skuTypeQcList'>IQC检测标准</a>", ">>", "样本系数列表"); $this->smarty->assign('navarr', $navarr); $this->smarty->assign('module', '样本系数列表'); $this->smarty->assign('secnev', '4'); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('status', $status); $this->smarty->assign('username', $_SESSION['userName']); $this->smarty->assign('sampleCoefficientList', $sampleCoefficientList ? $sampleCoefficientList : null); //循环列表 $this->smarty->assign('sampleTypeList', SampleCoefficientModel::getCoefficientSampleTypeName()); //系数表中存在的样本类型 $this->smarty->assign('cNameList', SampleCoefficientModel::getSampleCoefficientList("distinct(cName)", '')); //系数表中存在的系数名称 $this->smarty->display("sampleCoefficient.html"); }