<?php

/**
 * PluginPerformanceTrackerLog
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @package    ##PACKAGE##
 * @subpackage ##SUBPACKAGE##
 * @author     ##NAME## <##EMAIL##>
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class PluginPerformanceTrackerLog extends BasePerformanceTrackerLog
{
    const MODE_MY = 'my';
    const MODE_REVIEWER = 'reviewer';    
    const STATUS_ACTIVE = 1;
    const STATUS_DELETED = 2;     
       
    const ACIEVEMENT_NEGATIVE = 1;
    const ACIEVEMENT_POSITIVE = 2;
    
    public function getAchievementText(){
        if($this->getAchievement()==1){
            return 'Positive';
        }elseif($this->getAchievement()==2){
            return 'Negative';
        }
    }
    
    public function getReviewerName(){
        $reviewerId =$this->getReviewerId();
        if(!empty($reviewerId) && $reviewerId!=''){
            return $this->getEmployee()->getFirstAndLastNames();            
        }else{
            return $this->getSystemUser()->getUserName();
        }
    }
    
    public function canUpdate(){ 
         $reviewerId = $this->getReviewerId();
         $loggedInEmployee = sfContext::getInstance()->getUser()->getEmployeeNumber();
         if($reviewerId == $loggedInEmployee || $_SESSION['isAdmin'] =='Yes'){
             return true;
         }else{
             return false;
         }
    }
}