<?php
// ViewNotePopup.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 ViewNotePopup extends Action
{
	/**
	 * 
	 *
	 * @access public
	 * @return boolean
	 */
	function execute(& $context)
	{
		global $__CS;
		$__CS->EnterMethod("execute");
		
		$request	=& $context->getEntry(__REQUEST);
		$da			=& $context->getEntry(__DATAACCESS);
		$control	=& $context->getEntry(__CONTROLLER);
		$timer		=& $context->getEntry(__TIMER);
		$model		=& $context->getEntry(__MODEL);
		
		
		$note_id = $request->get("noteid");
		$sql = "SELECT * FROM Note WHERE i_noteID=".$note_id;

		$result =& $da->query($sql);
		$note = $result[0];
		
		include('core/members/views/NotePopupView.php');
		$view =& new NotePopupView(& $timer, & $model);
		$view->setTitle($note->getValue("vch_title"));
		$view->setNote($note->getValue("text_note"));
		$view->setDate($note->getValue("date_created"));
		
		$control->setView(& $view);

		$__CS->ExitMethod("execute");
		return true;
	}
}
?>