<?
require_once("LenexBase.class.php");
require_once "LenexContact.class.php";
require_once "LenexAgeDate.class.php";
require_once "LenexClub.class.php";
require_once "LenexPointTable.class.php";
require_once "LenexPool.class.php";
require_once "LenexQualify.class.php";
require_once "LenexSession.class.php";
require_once "LenexFee.class.php";
/*
nation codes according to ISO 3166 alpha-3
http://www.swimrankings.net/files/Lenex_Nation.txt
*/
class LenexMeet extends LenexBase {
var $document=NULL;
var $index=-1;
var $ageDate=NULL;
var $altitude=0;
var $city="";
var $clubs=array();
var $contact=NULL;
var $course="";
var $deadline="";
var $fee=NULL;
var $maxentries=0;
var $name="";
var $nation="";
var $number="";
var $organizer="";
var $pointTable=NULL;
var $pool=NULL;
var $promoter="";
var $qualify="";
var $sessions=array();
var $state="";
var $timing="";
var $type="";
function LenexMeet($city,$name,$nation,$fee=NULL) {
$this->city=$city;
$this->name=$name;
$this->nation=$nation;
$this->fee=$fee;
}
/*static*/
function fromSAX($attrs) {
$obj =& new LenexMeet(@$attrs["CITY"],@$attrs["NAME"],@$attrs["NATION"]);
$obj->altitude=@$attrs["ALTITUDE"];
$obj->course=@$attrs["COURSE"];
$obj->deadline=@$attrs["DEADLINE"];
$obj->maxentries=@$attrs["MAXENTRIES"];
$obj->number=@$attrs["NUMBER"];
$obj->organizer=@$attrs["ORGANIZER"];
$obj->promoter=@$attrs["PROMOTER"];
$obj->qualify=@$attrs["QUALIFY"];
$obj->state=@$attrs["STATE"];
$obj->timing=@$attrs["TIMING"];
$obj->type=@$attrs["TYPE"];
return $obj;
}
/*override*/
function setParent(&$obj) {
$obj->addMeet($this);
}
function addSession(&$session) {
$this->sessions[$session->number] =& $session;
$session->meet =& $this;
}
function setAgeDate(&$ageDate) {
$this->ageDate =& $ageDate;
}
function addClub(&$club) {
$this->clubs[] =& $club;
}
function setContact(&$contact) {
$this->contact =& $contact;
}
function setFee(&$fee) {
$this->fee =& $fee;
}
function setPointTable(&$pointTable) {
$this->pointTable =& $pointTable;
}
function setPool(&$pool) {
$this->pool =& $pool;
}
function setQualify(&$qualify) {
$this->qualify =& $qualify;
}
function getAgeDate() {
if ($this->ageDate===NULL && count($this->sessions)>0) {
$k = array_keys($this->sessions);
$s =& $this->sessions[current($k)];
$result =& new LenexAgeDate(LENEX_AGEDATE_TYPE_YEAR,$s->date);
return $result;
}
return $this->ageDate;
}
}
?>