public function getSubDecorator($elementType)
 {
     switch ($elementType) {
         case X_VlcShares_Skins_Manager::TABLECELL:
             return new X_VlcShares_Skins_Default_TableCellHeader();
         default:
             return X_VlcShares_Skins_Manager::i()->getDecorator($elementType);
     }
 }
Пример #2
0
 public function getSubDecorator($elementType)
 {
     switch ($elementType) {
         case X_VlcShares_Skins_Manager::MENUENTRY_LINK:
         case X_VlcShares_Skins_Manager::MENUENTRY_BUTTON:
             return new self(array('type' => self::BUTTON));
         case X_VlcShares_Skins_Manager::MENUENTRY_LABEL:
             return new self(array('type' => self::BUTTON, 'variant' => 'disabled'));
         default:
             return X_VlcShares_Skins_Manager::i()->getDecorator($elementType);
     }
 }
Пример #3
0
 public function newRow()
 {
     $row = new X_VlcShares_Elements_TableRow($this);
     $row->setView($this->view);
     $decorator = $this->getDecorator();
     if ($decorator instanceof X_VlcShares_Skins_ParentDecoratorInterface) {
         if (count($this->_rows) % 2) {
             $row->setDecorator($decorator->getSubDecorator(X_VlcShares_Skins_Manager::TABLEROW));
         } else {
             $row->setDecorator($decorator->getSubDecorator(X_VlcShares_Skins_Manager::TABLEROW_ALTERNATE));
         }
     } else {
         if (count($this->_rows) % 2) {
             $row->setDecorator(X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::TABLEROW));
         } else {
             $row->setDecorator(X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::TABLEROW_ALTERNATE));
         }
     }
     $this->_rows[] = $row;
     return $row;
 }
Пример #4
0
 /**
  * @see X_VlcShares_Elements_Element::getDefaultDecorator()
  */
 public function getDefaultDecorator()
 {
     return X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::TABLECELL);
 }
Пример #5
0
 public function getDefaultDecorator()
 {
     return X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::MENUENTRY_LINK);
 }
Пример #6
0
 public function getDefaultDecorator()
 {
     return X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::INNERBLOCK);
 }
Пример #7
0
 public function getDefaultDecorator()
 {
     return X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::PORTION);
 }
Пример #8
0
 /**
  * 
  * 
  * @return X_VlcShares_Skins_Manager
  */
 public static function i()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #9
0
 public function getDefaultDecorator()
 {
     return X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::CONTAINER);
 }
Пример #10
0
 /**
  * Factory method for MenuEntry
  * Set parent, view and decorator to the MenuEntry
  * @param string $type type of menuentry
  * @param string $param1
  * @param string $param2
  * @return X_VlcShares_Elements_MenuEntry|X_VlcShares_Elements_Menu
  */
 protected function addEntry($type, $param1 = null, $param2 = null)
 {
     switch ($type) {
         case self::SUBMENU:
             $entry = new self($this);
             $entry->setView($this->view)->setLevel($this->getOption('menu.level') + 1)->setLabel($param1)->setHref($param2);
             // I have to assign a subdecorator if the current decorator
             // of this implement ParentDecoratorInterface
             // or a default submenu decorator
             $parentDecorator = $this->getDecorator();
             if ($parentDecorator instanceof X_VlcShares_Skins_ParentDecoratorInterface) {
                 $decorator = $parentDecorator->getSubDecorator(X_VlcShares_Skins_Manager::MENUENTRY_SUBMENU);
             } else {
                 $decorator = X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::MENUENTRY_SUBMENU);
             }
             $entry->setDecorator($decorator);
             $this->_entries[] = $entry;
             return $entry;
             // add menu has to return a reference to the new submenu
         // add menu has to return a reference to the new submenu
         case self::LABEL:
             $entry = new X_VlcShares_Elements_MenuEntry($this);
             $entry->setView($this->view)->setLabel($param1);
             $parentDecorator = $this->getDecorator();
             if ($parentDecorator instanceof X_VlcShares_Skins_ParentDecoratorInterface) {
                 $decorator = $parentDecorator->getSubDecorator(X_VlcShares_Skins_Manager::MENUENTRY_LABEL);
             } else {
                 $decorator = X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::MENUENTRY_LABEL);
             }
             $entry->setDecorator($decorator);
             $this->_entries[] = $entry;
             break;
         case self::BUTTON:
             $entry = new X_VlcShares_Elements_MenuEntry($this);
             $entry->setView($this->view)->setLabel($param1)->setHref($param2);
             $parentDecorator = $this->getDecorator();
             if ($parentDecorator instanceof X_VlcShares_Skins_ParentDecoratorInterface) {
                 $decorator = $parentDecorator->getSubDecorator(X_VlcShares_Skins_Manager::MENUENTRY_BUTTON);
             } else {
                 $decorator = X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::MENUENTRY_BUTTON);
             }
             $entry->setDecorator($decorator);
             $this->_entries[] = $entry;
             break;
         case self::LINK:
         default:
             // all other types work as LINK
             $entry = new X_VlcShares_Elements_MenuEntry($this);
             $entry->setView($this->view)->setLabel($param1)->setHref($param2);
             $parentDecorator = $this->getDecorator();
             if ($parentDecorator instanceof X_VlcShares_Skins_ParentDecoratorInterface) {
                 $decorator = $parentDecorator->getSubDecorator(X_VlcShares_Skins_Manager::MENUENTRY_LINK);
             } else {
                 $decorator = X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::MENUENTRY_LINK);
             }
             $entry->setDecorator($decorator);
             $this->_entries[] = $entry;
             break;
     }
     return $this;
 }