Example #1
0
 public function action_edit()
 {
     $id = $_GET['id'];
     $m_category = Model::factory('category');
     if (!empty($_POST)) {
         $data = $this->_get_data($_POST);
         $ret = $m_category->updateById($data, $id);
         if ($ret !== false) {
             $this->redirect('category/tree');
         }
     }
     $cat_list = $m_category->getAll(array('status' => 'open'))->as_array('id');
     $cat_tree = Category::get_children_tree($cat_list);
     $info = $m_category->getRowById($id);
     $this->content = View::factory('category_edit');
     $this->content->cat_list = $cat_list;
     $this->content->cat_tree = $cat_tree;
     $this->content->info = $info;
 }