meet_name = $meet_name;
$this->meet_id = $meet_id;
$this->gender = $gender;
$this->schoolId = $schoolId;
$this->seasonId = $seasonId;
$this->seasonYear = $seasonYear;
}
function setRawInputData($data)
{
if(is_string($data))
{
$data = str_replace("&", "&", $data);
$dataArray = explode("\n", trim($data));
$lineCount = 0;
$intermediateArray = array();
foreach($dataArray as $lnNo=>$ln)
{
if($lineCount == 0 && trim($ln) == '')
{
continue;
}
$this->rawDataLines[] = $ln;
$lineCount++;
}
}
}
function getData()
{
return $this->processedDataLines;
}
function getFormatedData()
{
$nameCountArray = array();
$return = array();
$parsedData = $this->processedDataLines;
if(is_array($parsedData) && sizeof($parsedData)>0)
{
$reportCnt = 0;
foreach($parsedData as $data)
{
$lineType = $data->getType();
$dispData = $data->getComposedData();
if($lineType=="license-header")
{
$return['LICENCED-TO'] = @$dispData['LICENCE TO'];
$return['SUB-LICENSE'] = @$dispData['SUB-LICENSE'];
$return['LICENSE-DATE'] = @$dispData['LICENSE DATE'];
}
else if($lineType=="school-report-head")
{
$return['EVENT-NAME'] = @$dispData['EVENT NAME'];
$return['EVENT-DATE'] = @$dispData['EVENT DATE'];
}
else if($lineType=="school-name-head")
{
$return['SCHOOL-NAME'] = @$dispData['SCHOOL NAME'];
}
else if($lineType=="report-data")
{
$reportMatrix = $data->getReportMatrix();
$return['REPORT'][$reportCnt]['HEADER']['FULL-TEXT'] = @$dispData['HEADER'];
$headerAnalysis = @$dispData['HEADER-ANALYSIS'];
$eventName = trim(str_replace($headerAnalysis->getLeadPhrase(),"",@$dispData['HEADER']));
$eventName = $this->__cleanUpEventname($eventName);
$return['REPORT'][$reportCnt]['HEADER']['EVENT-NAME'] = trim($eventName);
$return['REPORT'][$reportCnt]['HEADER']['EVENT-LEVEL'] = $headerAnalysis->getLeadPhrase();
if(trim($return['REPORT'][$reportCnt]['HEADER']['EVENT-NAME'])=='')
{
$return['REPORT'][$reportCnt]['HEADER']['EVENT-NAME'] = $headerAnalysis->getLeadPhrase();
$return['REPORT'][$reportCnt]['HEADER']['EVENT-LEVEL'] = '';
}
$return['REPORT'][$reportCnt]['HEADER']['GENDER'] = $headerAnalysis->getGender();
$return['REPORT'][$reportCnt]['HEADER']['SPORTS'] = $headerAnalysis->getSports();
$return['REPORT'][$reportCnt]['HEADER']['SPORT-TYPE'] = $headerAnalysis->getSportsType();
$return['REPORT'][$reportCnt]['HEADER']['SPORT-LEVEL'] = $headerAnalysis->getSportsLevel();
$return['REPORT'][$reportCnt]['HEADER']['SPORT-LEVEL-SQ'] = $headerAnalysis->getSportsLevel();
$return['REPORT'][$reportCnt]['HEADER']['METRIC'] = $headerAnalysis->getMetricPhrase();
$return['REPORT'][$reportCnt]['HEADER']['ADDLN-NOTE'] = $headerAnalysis->getOtherPhrases();
if($reportMatrix->isUsable())
{
$return['REPORT'][$reportCnt]['HAS-RECORDS'] = true;
$return['REPORT'][$reportCnt]['COLUMNS'][]="SL";
foreach($reportMatrix->getHeaders() as $head)
{
$return['REPORT'][$reportCnt]['COLUMNS'][]=$head;
}
$return['REPORT'][$reportCnt]['COLUMNS'][]="ROUND";
$return['REPORT'][$reportCnt]['COLUMNS'][]="REMARKS";
$recCnt=0;
foreach($reportMatrix->getMatrix() as $matrix)
{
$theFinalVal='';
foreach($return['REPORT'][$reportCnt]['COLUMNS'] as $col)
{
if($col!=='REMARKS')
{
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['RAW']=@$matrix[$col]['COMBINED'];
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['FINAL']=@$matrix[$col]['DATA'];
if(isset($matrix[$col]['FIRST-NAME']))
{
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['FIRST-NAME']=@$matrix[$col]['FIRST-NAME'];
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['LAST-NAME']=@$matrix[$col]['LAST-NAME'];
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['ROLL-NO']=@$matrix[$col]['ROLL-NO'];
}
$theFinalVal.=@$matrix[$col]['DATA'];
}
if($col==='SL')
{
if(trim(@$matrix[$col]['DATA'])!=='' && is_numeric(trim(@$matrix[$col]['DATA']))===false)
{
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['RAW']='';
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['FINAL']='';
}
}
if( ($return['REPORT'][$reportCnt]['HEADER']['SPORT-TYPE'] == ParserUtility::$_RELAY_
|| $return['REPORT'][$reportCnt]['HEADER']['SPORT-TYPE'] == ParserUtility::$_THROWING_TEAM_
|| $return['REPORT'][$reportCnt]['HEADER']['SPORT-TYPE'] == ParserUtility::$_JUMPING_TEAM_ )
&& trim(strtolower($col))==='school')
{
$schoolName = $this->__removeQuotedAlphabets(@$matrix[$col]['DATA']);
$return['REPORT'][$reportCnt]['DATA'][$recCnt][$col]['FINAL'] = $schoolName;
}
}
$return['REPORT'][$reportCnt]['DATA'][$recCnt]['UN-FORMATED']['FINAL'] = @$matrix['RAW-LINE']['DATA'];
$return['REPORT'][$reportCnt]['DATA'][$recCnt]['REMARKS']['FINAL'] = trim(@$matrix['MARK']['DATA'].' '.@$matrix['REMARKS']['DATA']);
if(trim(@$return['REPORT'][$reportCnt]['DATA'][$recCnt]['REMARKS']['FINAL']) !== '')
{
$finesse = $this->__extractNumericFromRemarks($return['REPORT'][$reportCnt]['DATA'][$recCnt]['REMARKS']['FINAL']);
if($finesse!==false)
{
$return['REPORT'][$reportCnt]['DATA'][$recCnt]['FINESSE'] = $finesse;
}
}
if(strlen(trim($theFinalVal))>0)
{
$recCnt++;
}
else
{
array_pop($return['REPORT'][$reportCnt]['DATA']);
}
}
}
else
{
$return['REPORT'][$reportCnt]['HAS-RECORDS'] = false;
$return['REPORT'][$reportCnt]['ERROR'] = $reportMatrix->getProblem();
}
$return['REPORT'][$reportCnt]['RAW-RECORDS'] = implode("\n",$reportMatrix->getReportLines());
$reportCnt++;
}
}
}
if(!isset($return['REPORT']))
{
$return['REPORT']=array();
}
foreach($return['REPORT'] as $ind=>$rptData)
{
if(!isset($rptData['DATA']))
{
$return['REPORT'][$ind]['DATA']=array();
}
}
return $return;
}
function process()
{
$this-> __processLines();
}
function __processLines()
{
if($this->debug) echo 'starting
';
$previousStatus = '';
$currentStatus = 'license-header';
$concatenator = "";
$lineObj = null;
$reportPartStarts = false;
$reportPartLevel = '';
foreach($this->rawDataLines as $lnNo=>$ln)
{
if($this->debug) echo '
PROCESSING ............. '.$ln;
if($this->debug) echo '
previousStatus ......... '.$previousStatus;
$analysis = new Lexicon($ln);
$analysis->preAnalyse();
if($this->debug) { echo '
ANALYSIS :::