Networksections can be updated now
This commit is contained in:
@@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
class NetworksectionController extends mfBaseController {
|
class NetworksectionController extends mfBaseController {
|
||||||
|
|
||||||
|
protected function init() {
|
||||||
|
$this->needlogin=true;
|
||||||
|
$me = new User();
|
||||||
|
$me->loadMe();
|
||||||
|
$this->me = $me;
|
||||||
|
$this->layout()->set("me",$me);
|
||||||
|
|
||||||
|
if(!$me->isAdmin()) {
|
||||||
|
$this->redirect("Dashboard");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function saveAction() {
|
protected function saveAction() {
|
||||||
$r = $this->request;
|
$r = $this->request;
|
||||||
//var_dump($r);exit;
|
//var_dump($r);exit;
|
||||||
@@ -21,16 +33,27 @@ class NetworksectionController extends mfBaseController {
|
|||||||
|
|
||||||
if(!is_array($sections) || !count($sections)) {
|
if(!is_array($sections) || !count($sections)) {
|
||||||
$this->redirect("Network", "Index", [], "view=sections&net=".$network_id);
|
$this->redirect("Network", "Index", [], "view=sections&net=".$network_id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//var_dump($sections);exit;
|
//var_dump($sections);exit;
|
||||||
|
|
||||||
foreach($sections as $section_id => $name) {
|
foreach($sections as $section_id => $name) {
|
||||||
if($section_id == "new") {
|
if($section_id == "new" && $name) {
|
||||||
$section = NetworksectionModel::create(["network_id" => $network_id, "name" => $name]);
|
$section = NetworksectionModel::create(["network_id" => $network_id, "name" => $name]);
|
||||||
//var_dump($section);exit;
|
//var_dump($section);exit;
|
||||||
$section->save();
|
$section->save();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_numeric($section_id)) {
|
||||||
|
$section = new Networksection($section_id);
|
||||||
|
if(!$section->id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$section->name = $name;
|
||||||
|
$section->edit_by = $this->me->id;
|
||||||
|
$section->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user