Beispiel #1
0
 /**
  * @param \SimpleXMLElement $obj
  * @param null $parent
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 protected function getItems(\SimpleXMLElement $obj, $parent = null)
 {
     $returnChildren = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($obj->children() as $objData) {
         $id = $this->blockParser->getXmlAttr($objData, 'id');
         $menuItemTranslation = $this->db->createQueryBuilder()->select("menu, translation")->from('\\Fraym\\Menu\\Entity\\MenuItemTranslation', 'translation')->join('translation.menuItem', 'menu')->where('menu.id = :id AND translation.locale = :localeId AND translation.active = 1')->setParameter('id', $id)->setParameter('localeId', $this->route->getCurrentMenuItemTranslation()->locale->id)->getQuery()->getOneOrNullResult();
         $this->db->free();
         if ($menuItemTranslation) {
             $menuItem = clone $this->db->getRepository('\\Fraym\\Menu\\Entity\\MenuItem')->findOneById($menuItemTranslation->menuItem->id);
             $children = $this->getItems($objData, $menuItem);
             $menuItem->parent = $parent;
             $menuItem->children = $children;
             $returnChildren->set($menuItem->id, $menuItem);
         }
     }
     return $returnChildren;
 }
Beispiel #2
0
 /**
  * @param $template
  * @return \SimpleXMLElement
  */
 public function getTemplateXmlObject($template)
 {
     $template = $this->getTemplatePath() . DIRECTORY_SEPARATOR . $template;
     $templateContent = file_get_contents($template);
     $blocks = $this->blockParser->getAllBlocks($templateContent);
     foreach ($blocks as $block) {
         $obj = $this->blockParser->getXmlObjectFromString($block);
         if ($this->blockParser->getXmlAttr($obj, 'type') === 'config') {
             return $obj;
         }
     }
 }
Beispiel #3
0
 /**
  * @param $xml
  * @param $content
  * @return mixed
  */
 public function createEditViewElement($xml, $content)
 {
     $contentId = $this->blockParser->getXmlAttr($xml, 'id');
     $cssClass = $this->blockParser->getXmlAttr($xml, 'class');
     $editStyle = $this->blockParser->getXmlAttr($xml, 'editStyle');
     $actionBarStyle = $this->blockParser->getXmlAttr($xml, 'actionBarStyle');
     $description = $this->blockParser->getXmlAttr($xml, 'description');
     $renderElement = $this->blockParser->getXmlAttr($xml, 'renderElement') === false ? false : true;
     $htmlElement = $this->blockParser->getXmlAttr($xml, 'element') ?: 'div';
     $unique = $this->blockParser->getXmlAttr($xml, 'unique') === true ? true : false;
     $this->view->assign('description', $description);
     $this->view->assign('actionBarStyle', $actionBarStyle);
     $this->view->assign('editStyle', $editStyle);
     $this->view->assign('unique', $unique);
     $this->view->assign('cssClass', $cssClass);
     $this->view->assign('htmlElement', $htmlElement);
     $this->view->assign('renderElement', $renderElement);
     $this->view->assign('contentId', $contentId);
     $this->view->assign('inEditMode', $this->block->inEditMode());
     $this->view->assign('content', $content);
     return $this->view->fetch('EditViewBar');
 }