} } $smarty->assign("rankBean_1", $arrayType_1); $smarty->assign("rankBean_2", $arrayType_2); $smarty->assign("rankBean_3", $arrayType_3); $smarty->display('rankView.html'); } if ($bRet == false) { echo "<script>alert('记录更新失败!');history.back();</script>"; } } else { if ($_POST['submit'] && empty($_POST['id'])) { $arrayBean = array($_POST['type'], $_POST['name'], $_POST['desc'], date('Y-m-d H:i:s', time())); $bRet = Rank::addRank($arrayBean); if ($bRet) { $rankBean = Rank::getAllRecord(); $arrayType_1 = array(); $arrayType_2 = array(); $arrayType_3 = array(); foreach ($rankBean as $arrayIndex) { if ($arrayIndex->getType() == 1) { $arrayType_1[] = $arrayIndex; } else { if ($arrayIndex->getType() == 2) { $arrayType_2[] = $arrayIndex; } else { if ($arrayIndex->getType() == 3) { $arrayType_3[] = $arrayIndex; } } }