コード例 #1
0
 protected function getCssAttributesToRender()
 {
     //ORDER OF THE SELECTORS IS IMPORTANT!!!!!
     //main menu selector and first un-ordered list
     $selector = new Selector($this->getID(), 'id');
     $selector->addId($this->getID() . ' ul');
     $selector->addStyle('list-style', 'none');
     //list style
     $selector->addStyle('line-height', '1');
     //this makes sure lines are 1em and not 1+.
     $borderWidth = $this->getBorderWidth();
     if (strlen($borderWidth)) {
         $borderWidth = $this->formatTRBL($borderWidth);
     }
     $borderColor = $this->getBorderColor();
     $borderStyle = $this->getBorderStyle();
     $selector->addStyle('border', $borderWidth . ' ' . $borderStyle . ' ' . '#' . $borderColor);
     $padding = $this->getPadding();
     if (strlen($padding)) {
         $selector->addStyle('padding', $this->formatTRBL($padding));
     }
     $width = $this->getWidth();
     if (strlen($width)) {
         if (is_numeric($width)) {
             $selector->addStyle('width', $width . 'em');
         } else {
             $selector->addStyle('width', $width);
         }
     }
     $selector->addStyle('margin', '0');
     //eliminate the margin
     $selector->addStyle('float', 'left');
     $background = $this->getBackColor();
     if (strlen($background)) {
         $selector->addStyle('background', '#' . $background);
     }
     $this->cssFile->addSelector($selector);
     //get the main navigation items width
     $headingWidth = $this->getHeadingWidth();
     //main menu anchor
     $selector = new Selector($this->getID() . ' a', 'id');
     $selector->addStyle('display', 'block');
     if (strlen($headingWidth)) {
         $selector->addStyle('width', $headingWidth);
     }
     $textDecoration = $this->getTextDecoration();
     if (strlen($textDecoration)) {
         $selector->addStyle('text-decoration', $textDecoration);
     }
     $color = $this->getForeColor();
     if (strlen($color)) {
         $selector->addStyle('color', '#' . $color);
     }
     $fontWeight = $this->getFontWeight();
     if (strlen($fontWeight)) {
         $selector->addStyle('font-weight', $fontWeight);
     }
     $this->cssFile->addSelector($selector);
     //main menu li
     //width is for opera
     $selector = new Selector($this->getID() . ' li', 'id');
     $selector->addStyle('float', 'left');
     if (strlen($headingWidth)) {
         $selector->addStyle('width', $headingWidth);
     }
     //$selector->addStyle('float','left');
     $this->cssFile->addSelector($selector);
     //hide the third list
     $selector = new Selector($this->getID() . ' li:hover ul ul', 'id');
     $selector->addId($this->getID() . ' li:hover ul ul ul');
     $selector->addId($this->getID() . ' li.sfhover ul ul');
     $selector->addId($this->getID() . ' li.sfhover ul ul ul');
     $selector->addStyle('left', '-999' . 'em');
     $this->cssFile->addSelector($selector);
     //unhide the second list
     $selector = new Selector($this->getID() . ' li:hover ul', 'id');
     $selector->addId($this->getID() . ' li li:hover ul', 'id');
     $selector->addId($this->getID() . ' li li li:hover ul');
     $selector->addId($this->getID() . ' li.sfhover ul');
     $selector->addId($this->getID() . ' li li.sfhover ul');
     $selector->addId($this->getID() . ' li li li.sfhover ul');
     $selector->addStyle('left', 'auto');
     $this->cssFile->addSelector($selector);
 }