<?php

/**
 * Description of MemberController
 *
 * @author Arkadiusz Rychlik <a.rychlik at eppe.com.pl>
 */
class Newsletter_Controller_Admin_MemberController extends Eppe_Crud_Controller_Action {

	protected $grid = 'Newsletter_Jqgrid_Member';
	protected $crud = 'Newsletter_CRUD_Member';
	public $group_id;

	public function init() {
		$this->group_id = $this->_getParam('group_id');
		parent::init();
	}

	public function ajaxToggleActiveAction() {
		$knt_id = $this->_getParam('id');
		$nlgroup_id = $this->_getParam('group_id');

		$result = $this->crud->toggleActive($nlgroup_id, $knt_id);

		if ($result['result'] == true) {
			$this->ajaxResponse->evalJS = 'new Success("' . __('Znacznik aktywności został zmieniony') . '"); return true;';
		}
		else {
			$this->ajaxResponse->evalJS = 'new Warning("' . __($result['msg']) . '")';
		}
	}

}
