public function action_create() { if (Input::method() == 'POST') { $val = Model_User_Type::validate('create'); if ($val->run()) { $user_type = Model_User_Type::forge(array('name' => Input::post('name'), 'group' => Input::post('group'))); if ($user_type and $user_type->save()) { Session::set_flash('success', e('Added user_type #' . $user_type->id . '.')); Response::redirect('admin/user/types/view/' . $user_type->id); } else { Session::set_flash('error', e('Could not save user_type.')); } } else { Session::set_flash('error', $val->error()); } } $this->template->set_global('groups', $this->get_groups()); $this->template->title = "Employee Types » Create"; $this->template->content = View::forge('admin/user/types/create'); }
public function get_user_type() { return !is_null($this->user_type) ? $this->user_type : Model_User_Type::forge(array('id' => 0)); }