<?php
// SelectDeeds.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 SelectDeeds extends Action
{
	/**
	 * Executes the search members action.
	 *
	 * @access public
	 * @return boolean
	 */
	function execute(& $context)
	{
		global $__CS;
		$__CS->EnterMethod("execute:SelectDeeds");
		
		$model  	=& $context->getEntry(__MODEL);
		$request 	=& $context->getEntry(__REQUEST);
		$timer		=& $context->getEntry(__TIMER);
		$controller =& $context->getEntry(__CONTROLLER);
		$session	=& $context->getEntry(__SESSION);
		$da			=& $context->getEntry(__DATAACCESS);
		
		$model->setMemberID($request->get("memberid"));
		
		include_once('core/members/forms/DeedSelectForm.php');
		$deed_select_form =& new DeedSelectForm(& $session, & $request);
		
		include_once('core/deeds/models/DeedModel.php');
		$deed_model =& new DeedModel(& $da);
		
		include_once('core/members/views/DeedSelectView.php');
		$view =& new DeedSelectView(& $timer, & $model, & $deed_model, & $deed_select_form);
		
		$deed_coll =& $deed_model->selectAll();
		$view->setDeedCollection(& $deed_coll);
		
		// Add any feedback messages, if they exist
		if($request->hasFeedback()) {
			$view->addFeedback($request->getFeedback());
		}
		$view->init();
		$controller->setView(& $view);
		
		$__CS->ExitMethod("execute:SelectDeeds");
		return true;
	}
}
?>