<?php

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

	public $uses = array('Evaluation','Customer'); 
	
	public function main() 
	{
		$labelStr = array();
		$evalEmps = $this->Evaluation->listTestsStatus10To11();
		
		
			foreach($evalEmps as $evalEmp) {
				if ($evalEmp['Employee']['customer_id'] == 7){
				$nbDays = 1;
				$today = date('Y-m-d');	
				$statusDate = $evalEmp['Evaluation']['status_date'];
				$todaytime = date('Y-m-d H:i:s');
				$webadmin = 'webadmin';
					if ($nbDays <= floor((abs(strtotime($today)) - strtotime($statusDate))/ 86400)) {
					#Update the Evaluation_status to the next status. Second reminder in this case(#11)
					$this->Evaluation->id = $evalEmp['Evaluation']['id'];
					$this->Evaluation->saveField('status_id', 11);			
					$this->Evaluation->saveField('modifiedby', $webadmin);
					$this->Evaluation->saveField('status_date', $today);
					$this->Evaluation->saveField('modified', $todaytime);
					}
				}
				else {
				$nbDays = 5;
				$today = date('Y-m-d');	
				$statusDate = $evalEmp['Evaluation']['status_date'];
				$todaytime = date('Y-m-d H:i:s');
				$webadmin = 'webadmin';
					if ($nbDays <= floor((abs(strtotime($today)) - strtotime($statusDate))/ 86400)) {
					#Update the Evaluation_status to the next status. Second reminder in this case(#11)
					$this->Evaluation->id = $evalEmp['Evaluation']['id'];
					$this->Evaluation->saveField('status_id', 11);			
					$this->Evaluation->saveField('modifiedby', $webadmin);
					$this->Evaluation->saveField('status_date', $today);
					$this->Evaluation->saveField('modified', $todaytime);
					}
				}
			}
		

	}
}
?>