/**
  * Draws the languages' table as a horizontal toolbar. This function assumes that
  * every image that represents a language has the same name of the language. Override
  * this function if you want to change this behaviour
  *   
  * @return string
  *
  */
 public function drawLanguages($mode)
 {
     $buttons = array();
     $pageName = $this->content->getW3sPage()->getPageName();
     // Cycles all the site's languages
     $languages = DbFinder::from('W3sLanguage')->find();
     foreach ($languages as $language) {
         // Set the buttons
         $image = $this->imagesPath . $language->getLanguage() . $this->imagesExtension;
         if ($mode == 'preview') {
             $button = array('image' => $image, 'action' => sprintf('W3sTemplate.loadPreviewPage(\'%s\', %s, %s);', sfContext::getInstance()->getController()->genUrl('webEditor/preview'), $language->getId(), $this->content->getPageId()));
         } else {
             $button = array('image' => $image, 'linkedTo' => sprintf('/%s/%s.html', $language->getLanguage(), $pageName));
         }
         $buttons[] = $button;
     }
     // Draws the languages
     $toolbar = new w3sToolbarHorizontal();
     $toolbar->setToolbar($buttons);
     return sprintf('<table>%s</table>', $toolbar->renderToolbar());
 }
Exemplo n.º 2
0
 /**
  * Draws the editor's toolbar
  * 
  * @return string
  *
  */
 protected function drawToolbar($toolbarFile)
 {
     $toolbar = new w3sToolbarHorizontal();
     $toolbar->fromYml($toolbarFile);
     return $toolbar->renderToolbar();
 }
 /**
  * Draws the menu.
  *   
  * @return string - The rendered menu
  *
  */
 function drawMenu()
 {
     $toolbar = new w3sToolbarHorizontal($this->user);
     $toolbar->fromYml($this->toolbarFile);
     return sprintf($this->skeleton, $toolbar->renderToolbar());
 }
Exemplo n.º 4
0
 /**
  * Draws the menu.
  *   
  * @return string - The rendered menu
  *
  */
 protected function drawPartialMenu()
 {
     $toolbar = new w3sToolbarHorizontal($this->user);
     $toolbar->fromYml($this->toolbarFile);
     return $toolbar->renderToolbar();
 }