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

/**
 * Saves a member.
 * 
 *
 * @author Matthew Lindberg
 */
class UpdateMember extends Action
{
	
	/**
	 * 
	 *
	 * @access public
	 * @return boolean
	 */
	function execute(& $context)
	{
		global $__CS;
		$__CS->EnterMethod("execute:UpdateMember");
		
		$session 	=& $context->getEntry(__SESSION);
		$request	=& $context->getEntry(__REQUEST);
		$timer		=& $context->getEntry(__TIMER);
		$control	=& $context->getEntry(__CONTROLLER);
		
		$member_id = $request->get("memberid");
		
		include_once('core/members/forms/MemberEditForm.php');
		$member_form 	=& new MemberEditForm(& $session, & $request);
		$member_form->loadFromRequest();
		
		$model 		=& $context->getEntry(__MODEL);
		
		if( !$model->updateFromForm( & $member_form, $member_id )) {
			die("Error saving new member in UpdateMember");
		}
		
		$request->addFeedback("member successfully updated");
		
		//$request->set(__ACTION,__MEMBER_EDIT);
		$request->set(__ACTION,__MEMBER_SEARCH);
		//$request->set("id",$member_id);
		
		$control->processRequest(& $request);
		$__CS->ExitMethod("execute:UpdateMember");
		return false;
	}
}
?>