public function actionUnuseNode() { $searchModel = new DcmdNodeSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, true); ///获取服务池列表 $query = DcmdNodeGroup::find()->orderBy('ngroup_name')->asArray()->all(); $dcmd_node_group = array(); foreach ($query as $item) { $dcmd_node_group[$item['ngroup_id']] = $item['ngroup_name']; } return $this->render('unuse-node', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'dcmd_node_group' => $dcmd_node_group]); }
/** * Displays a single DcmdNodeGroup model. * @param integer $id * @return mixed */ public function actionView($id) { $searchModel = new DcmdNodeSearch(); $searchModel->ngroup_id = $id; $params = Yii::$app->request->queryParams; $params["DcmdNodeSearch"]["ngroup_id"] = $id; $params["DcmdNodeSearch"]["rack"] = ""; $dataProvider = $searchModel->search($params); $show_div = "dcmd-node-group"; if (array_key_exists('show_div', $params)) { $show_div = $params['show_div']; } if (array_key_exists("DcmdNodeSearch", Yii::$app->request->queryParams)) { $show_div = 'dcmd-node'; } ///获取属性 $self_attr = DcmdNodeGroupAttr::find()->andWhere(['ngroup_id' => $id])->asArray()->all(); $def_attr = DcmdNodeGroupAttrDef::find()->asArray()->all(); $attr_str = '<div id="w1" class="grid-view"> <table class="table table-striped table-bordered"><thead> <tr><th>属性名</th><th>值</th><th>操作</th></tr> </thead><tbody>'; $attr = array(); foreach ($self_attr as $item) { $attr_str .= '<tr><td>' . $item['attr_name'] . '</td><td>' . $item['attr_value'] . '</td><td><a href="/ducter/index.php?r=dcmd-node-group-attr/update&id=' . $item['id'] . '&ngroup_id=' . $id . '">修改</a></td></tr>'; $attr[$item['attr_name']] = $item['attr_name']; } foreach ($def_attr as $item) { if (array_key_exists($item['attr_name'], $attr)) { continue; } $attr_str .= '<tr><td>' . $item['attr_name'] . '</td><td>' . $item['def_value'] . '</td><td><a href="/ducter/index.php?r=dcmd-node-group-attr/update&id=0&attr_id=' . $item['attr_id'] . '&ngroup_id=' . $id . '">修改</a></td></tr>'; } $attr_str .= "</tbody></table></div>"; return $this->render('view', ['model' => $this->findModel($id), 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'attr_str' => $attr_str, 'ngroup_id' => $id, 'show_div' => $show_div]); }