<?php

/**
 * Generated: 2013-11-04 11:03:31
 * @author Rtn_Module_Tool
 */
class Newsletter_Controller_Admin_GroupController extends Eppe_Crud_Controller_Action {

	protected $grid = 'Newsletter_Jqgrid_Group';
	protected $crud = 'Newsletter_CRUD_Group';
	
	protected function _add() {
		$formClassName = $this->crud->getFormClassName();
		$form = new $formClassName();

		if ($this->_isPost()) {
			$post = $this->_getPost();

			if (isset($post['cancel'])) {
				$this->_redirectIndex();
			}

			if ($form->isValid($post) && $this->crud->create($post)) {
				$this->_addMessage(__('Zmiany zostały zapisane'));
				$this->_redirectIndex();
			}
			else {
				$form->populate($this->_getPost());
			}
		}

		$this->view->form = $form;
	}

}
