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

/**
 * 
 *
 * @author Matthew Lindberg
 * @todo Make execute functon set ErrorView in controller on error instead of triggering error.
 */
class SelectResponsibilities extends Action
{
	/**
	 * 
	 *
	 * @access public
	 * @return boolean
	 */
	function execute(& $context)
	{
		global $__CS;
		$__CS->EnterMethod("execute:SelectResponsibilities");
		
		$member_model 	=& $context->getEntry(__MODEL);
		$request 		=& $context->getEntry(__REQUEST);
		$timer			=& $context->getEntry(__TIMER);
		$controller 	=& $context->getEntry(__CONTROLLER);
		$session		=& $context->getEntry(__SESSION);
		$da				=& $context->getEntry(__DATAACCESS);
		
		$member_id = $request->get("memberid");
		
		include_once('core/members/forms/ResponsibilitySelectForm.php');
		$respon_select_form =& new ResponsibilitySelectForm(& $session, & $request);
		
		include_once('core/responsibilities/models/ResponsibilityModel.php');
		$respon_model =& new ResponsibilityModel(& $da);
		
		$member_model->loadResponsibilities($member_id);
		
		
		
		include_once('core/members/views/ResponsibilitySelectView.php');
		$view =& new ResponsibilitySelectView(& $timer, & $member_model);
		$view->setSelectForm(& $respon_select_form);
		$view->setResponsibilityModel(& $respon_model);
		$view->setMemberID($member_id);
		
		
		
		
		// Add any feedback messages, if they exist
		if($request->hasFeedback()) {
			$view->addFeedback($request->getFeedback());
		}
		$view->init();
		$controller->setView(& $view);
		
		$__CS->ExitMethod("execute:SelectResponsibilities");
		return true;
	}
}
?>