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

/**
 * Saves deeds to a member's deed log.
 * 
 *
 * @author Matthew Lindberg
 */
class InsertDeeds extends Action
{
	
	/**
	 * 
	 *
	 * @access public
	 * @return boolean
	 */
	function execute(& $context)
	{
		global $__CS;
		$__CS->EnterMethod("execute:InsertDeeds");
		
		$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/DeedSelectForm.php');
		$select_form =& new DeedSelectForm(& $session, & $request);
		
		if( !$model->saveDeedlogDeeds(& $select_form, $member_id)) {
			die("Error saving Deed in InsertDeeds");
		}
		
		$request->set( "section", "deedlogsection" );
		$request->set( "id",	$member_id );
		$request->set( __ACTION, __MEMBER_EDIT );
		$request->addFeedback("new deeds successfully added to deedlog");
		
		$control->processRequest(& $request);
		$__CS->ExitMethod("execute:InsertDeeds");
		return false;
	}
}
?>