<?php
// InsertResponsibilities.php
include_once('core/base/Action.php');

/**
 * Saves responsibility selections to a members responsibility list.
 * 
 *
 * @author Matthew Lindberg
 */
class InsertResponsibilities extends Action
{
	
	/**
	 * 
	 *
	 * @access public
	 * @return boolean
	 */
	function execute(& $context)
	{
		global $__CS;
		$__CS->EnterMethod("execute:InsertResponsibilities");
		
		$session 	=& $context->getEntry(__SESSION);
		$request	=& $context->getEntry(__REQUEST);
		$timer		=& $context->getEntry(__TIMER);
		$control	=& $context->getEntry(__CONTROLLER);
		$model 		=& $context->getEntry(__MODEL);
		
		$member_id = $request->get("memberid");
		
		include_once('core/members/forms/ResponsibilitySelectForm.php');
		$select_form =& new ResponsibilitySelectForm(& $session, & $request);
		
		if( !$model->saveResponsibilities(& $select_form, $member_id)) {
			die("Error saving responsibilities in InsertResponsibilities");
		}
		
		$request->set( "section", "responsection" );
		$request->set( "memberid",	$member_id );
		$request->set( __ACTION, __MEMBER_SELECT_RESPONS);
		$request->addFeedback("responsibility list has been updated");
		
		$control->processRequest(& $request);
		
		$__CS->ExitMethod("execute:InsertResponsibilities");
		return false;
	}
}
?>