Example #1
0
 public function ajaxEditAction()
 {
     $id = reqnum('id', 0);
     $m = new PSys_MenuModel();
     if ($_POST['ispost']) {
         $data = array();
         $data['action'] = reqstr('action');
         $data['name'] = reqstr('name');
         $data['class'] = reqstr('class');
         $id = reqnum('id', 0);
         $data['pid'] = reqnum('pid', 0);
         if ($data['action'] and $data['name'] and $id > 0) {
             $where['id'] = $id;
             $ps = $m->UpdateOne($data, $where);
             if ($ps) {
                 $ss = $m->getMenuTree(0, true);
                 header('location:/menu/index');
                 exit;
             }
         }
     }
     if (!empty($id)) {
         $last = $m->GetOne(array('id' => $id));
         $this->smarty->assign("last", $last);
         $all = $m->getMenuTree();
         $this->smarty->assign("all", $all);
     }
     $this->smarty->assign("action", '/menu/ajaxEdit');
     $this->forward = "ajaxEdit";
 }