/** * Renders this imagemap. * @param THtmlWriter */ public function render($writer) { parent::render($writer); $hotspots = $this->getHotSpots(); if ($hotspots->getCount() > 0) { $clientID = $this->getClientID(); $cs = $this->getPage()->getClientScript(); $writer->writeLine(); $writer->addAttribute('name', self::MAP_NAME_PREFIX . $clientID); $writer->renderBeginTag('map'); $writer->writeLine(); if (($mode = $this->getHotSpotMode()) === THotSpotMode::NotSet) { $mode = THotSpotMode::Navigate; } $target = $this->getTarget(); $i = 0; $options['EventTarget'] = $this->getUniqueID(); $options['StopEvent'] = true; $cs = $this->getPage()->getClientScript(); foreach ($hotspots as $hotspot) { if ($hotspot->getHotSpotMode() === THotSpotMode::NotSet) { $hotspot->setHotSpotMode($mode); } if ($target !== '' && $hotspot->getTarget() === '') { $hotspot->setTarget($target); } if ($hotspot->getHotSpotMode() === THotSpotMode::PostBack) { $id = $clientID . '_' . $i; $writer->addAttribute('id', $id); $writer->addAttribute('href', '#' . $id); //create unique no-op url references $options['ID'] = $id; $options['EventParameter'] = "{$i}"; $options['CausesValidation'] = $hotspot->getCausesValidation(); $options['ValidationGroup'] = $hotspot->getValidationGroup(); $cs->registerPostBackControl($this->getClientClassName(), $options); } $hotspot->render($writer); $writer->writeLine(); $i++; } $writer->renderEndTag(); } }