public function actions() { $chnid = LuLu::getGetValue('chnid'); $channel = $this->getChannel($chnid); $table = CommonUtility::getCachedTable($channel['table']); return DefineTable::getBackActions($table); }
public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load($_POST)) { $parentIds = Channel::getParentIds($model['parent_id']); if (in_array($model['id'], $parentIds)) { LuLu::setErrorMessage('不能设置父节点为当前节点的子节点'); return $this->redirect(['update', 'id' => $id]); } $model->save(); CacheUtility::createChannelCache(); return $this->redirect(['index']); } else { $locals = []; $locals['model'] = $model; $locals['tableList'] = CommonUtility::getCachedTable(); $locals['channelTpls'] = $this->getTpl('channel_'); $locals['listTpls'] = $this->getTpl('list_'); $locals['detailTpls'] = $this->getTpl('detail_'); return $this->render('update', $locals); } }