getChildInstanceByName(REQUESTTIMEINTERVAL_START, true); $startNode->setValue($start); $durationNode = $this->getChildInstanceByName(REQUESTTIMEINTERVAL_DURATION, true); $durationNode->setValue($duration); } public function getStart() { $startNode = $this->getChildInstanceByName(REQUESTTIMEINTERVAL_START); if ($startNode == NULL) return ""; return $startNode->getValue(); } public function getDuration() { $durationNode = $this->getChildInstanceByName(REQUESTTIMEINTERVAL_DURATION); if ($durationNode == NULL) return ""; return $durationNode->getValue(); } public function loadFromNode($xmlNode) { $startXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTTIMEINTERVAL_START); $durationXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTTIMEINTERVAL_DURATION); if (isset($startXmlNode) && isset($durationXmlNode)) $this->setInterval($this->getXmlNodeValue($startXmlNode), $this->getXmlNodeValue($durationXmlNode)); } } define ("REQUESTTIMETABLE_NAME", "timetable"); define ("REQUESTTIMETABLE_ID", "id"); define ("REQUESTTIMETABLE_TTNAME", "name"); define ("REQUESTTIMETABLE_INDEX", "index"); /** * @class RequestTimesTimeTableNodeClass * @brief Definition of a request time table node for AMDA_Kernel * @details */ class RequestTimesTimeTableNodeClass extends NodeClass { public function __construct() { parent::__construct(REQUESTTIMETABLE_NAME); } public function setId($id) { $this->setAttribute(REQUESTTIMETABLE_ID, $id); } public function getId() { return $this->getAttribute(REQUESTTIMETABLE_ID); } public function setTTName($name) { $this->setAttribute(REQUESTTIMETABLE_TTNAME, $name); } public function getTTName() { return $this->getAttribute(REQUESTTIMETABLE_TTNAME); } public function setIndex($index) { $this->setAttribute(REQUESTTIMETABLE_INDEX, $index); } public function getIndex() { return $this->getAttribute(REQUESTTIMETABLE_INDEX); } public function loadFromNode($xmlNode) { $this->setId($this->getXmlNodeAttribute($xmlNode, REQUESTTIMETABLE_ID)); $this->setTTName($this->getXmlNodeAttribute($xmlNode, REQUESTTIMETABLE_TTNAME)); $this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTTIMETABLE_INDEX)); } } define ("REQUESTCATALOG_NAME", "catalog"); define ("REQUESTCATALOG_ID", "id"); define ("REQUESTCATALOG_TTNAME", "name"); define ("REQUESTCATALOG_INDEX", "index"); /** * @class RequestCatalogNodeClass * @brief Definition of a request catalog node for AMDA_Kernel * @details */ class RequestCatalogNodeClass extends NodeClass { public function __construct() { parent::__construct(REQUESTCATALOG_NAME); } public function setId($id) { $this->setAttribute(REQUESTCATALOG_ID, $id); } public function getId() { return $this->getAttribute(REQUESTCATALOG_ID); } public function setCatalogName($name) { $this->setAttribute(REQUESTCATALOG_TTNAME, $name); } public function getCatalogName() { return $this->getAttribute(REQUESTCATALOG_TTNAME); } public function setIndex($index) { $this->setAttribute(REQUESTCATALOG_INDEX, $index); } public function getIndex() { return $this->getAttribute(REQUESTCATALOG_INDEX); } public function loadFromNode($xmlNode) { $this->setId($this->getXmlNodeAttribute($xmlNode, REQUESTCATALOG_ID)); $this->setCatalogName($this->getXmlNodeAttribute($xmlNode, REQUESTCATALOG_TTNAME)); $this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTCATALOG_INDEX)); } } define ("REQUESTTIMES_NAME", "times"); /** * @class RequestTimesNodeClass * @brief Definition of a request times node for AMDA_Kernel * @details */ class RequestTimesNodeClass extends NodeClass { public function __construct() { parent::__construct(REQUESTTIMES_NAME); } public function addInterval($start = "", $duration = "") { $interval = new RequestTimesIntervalNodeClass(); $interval->setInterval($start, $duration); $this->addChild($interval); return $interval; } public function getIntervals() { return $this->getChildrenByName(REQUESTTIMEINTERVAL_NAME); } public function addTimeTable($id = "", $name = "", $index = -1) { $timeTable = new RequestTimesTimeTableNodeClass(); $timeTable->setId($id); if ($name != '') $timeTable->setTTName($name); if ($index >= 0) $timeTable->setIndex($index); $this->addChild($timeTable); return $timeTable; } public function addCatalog($id = "", $name = "", $index = -1) { $catalogNode = new RequestCatalogNodeClass(); $catalogNode->setId($id); if ($name != '') $catalogNode->setCatalogName($name); if ($index >= 0) $catalogNode->setIndex($index); $this->addChild($catalogNode); return $catalogNode; } public function loadFromNode($xmlNode) { foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTTIMEINTERVAL_NAME) as $timeintervalXmlNode) { $this->addInterval()->loadFromNode($timeintervalXmlNode); } foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTTIMETABLE_NAME) as $timetableXmlNode) { $this->addTimeTable()->loadFromNode($timetableXmlNode); } foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTCATALOG_NAME) as $catalogXmlNode) { $this->addCatalog()->loadFromNode($catalogXmlNode); } } } ?>