<?php

App::import('Core');
App::import('Component');
class IncShell extends Shell {

	public $uses = array('Evaluation','Customer'); 
	
	public function main() 
	{

		$today = date('Y-m-d'); 
		$previous_week = date('Y-m-d', strtotime("-7 days"));

		$evalEmps = $this->Evaluation->listIncompleteTests($today,$previous_week);		
		
		foreach($evalEmps as $evalEmp) {
	
			$statusDate = $evalEmp['Evaluation']['status_date'];
			$todaytime = date('Y-m-d H:i:s');
			$webadmin = 'webadmin';
			$n = count($evalEmps);

			// echo $n;  exit();

			#Update the Evaluation_status to the next status. #17, Missing Answers in this case.
			$this->Evaluation->id = $evalEmp['Evaluation']['id'];
			$this->Evaluation->saveField('status_id', 17);			
			$this->Evaluation->saveField('modifiedby', $webadmin);
			$this->Evaluation->saveField('status_date', $today);
			$this->Evaluation->saveField('modified', $todaytime);

			$this->out('All cases have been edited');
			$this->out('Number of cases with a changed status: "'.$n.'"');		
			$this->out('Employee\'s Name: ' . $evalEmp['Employee']['first_name'] . " " . $evalEmp['Employee']['last_name'] . "\n");
			}

	}
}
?>