<?php

/**
 * NOTAMS
 */
class NOTAMS extends CodonModule {

	public function index() {
		$notams = NotamsData::getAll(1);
		$this->set('notams', $notams);
		$this->render('notams/index');
	}
	
	
	public function widget() {
		$notams = NotamsData::getNotams(3);
		$this->set('notams', $notams);
		$this->render('notams/widget');
	}
	
	
	public function view($id) {
		$notam = NotamsData::GetNotam($id);
		$pilot = Auth::$userinfo;

		if($notam) {
			NotamsData::markasread($notam->id, $pilot->pilotid);
			$this->set('notam', $notam);
			$this->render('notams/view');
		}
		else 
			echo 'No NOTAM found.';
	}
}