public function execute(Batch $batch) { $inspector = \Core::make('import/value_inspector'); $feeds = $batch->getObjectCollection('page_feed'); if (!$feeds) { return; } foreach ($feeds->getFeeds() as $feed) { if (!$feed->getPublisherValidator()->skipItem()) { $f = new Feed(); $parentID = intval($inspector->inspect($feed->getParent())->getReplacedValue()); $pageType = intval($inspector->inspect($feed->getPageType())->getReplacedValue()); $f->setTitle($feed->getTitle()); $f->setHandle($feed->getHandle()); $f->setDescription($feed->getDescription()); $f->setParentID($parentID); $f->setPageTypeID($pageType); $f->setIncludeAllDescendents($feed->getIncludeAllDescendants()); $f->setDisplayFeaturedOnly($feed->getDisplayFeaturedOnly()); $f->setDisplayAliases($feed->getDisplayAliases()); if ($feed->getContentType() == 'description') { $f->displayShortDescriptionContent(); } else { $f->displayAreaContent($feed->getContentTypeArea()); } $f->save(); } } }
protected function loadFeedFromRequest(Feed $pf = null) { if (!$pf) { $pf = new Feed(); } $pf->setTitle($this->post('pfTitle')); $pf->setDescription($this->post('pfDescription')); $pf->setHandle($this->post('pfHandle')); $pf->setPageTypeID($this->post('ptID')); $pf->setParentID(intval($this->post('cParentID'))); $pf->setIncludeAllDescendents($this->post('pfIncludeAllDescendents')); $pf->setDisplayAliases($this->post('pfDisplayAliases')); $pf->setDisplayFeaturedOnly($this->post('pfDisplayFeaturedOnly')); if ($this->post('pfContentToDisplay') == 'A') { $pf->displayAreaContent($this->post('pfAreaHandleToDisplay')); } else { $pf->displayShortDescriptionContent(); } return $pf; }
protected function importPageFeeds(\SimpleXMLElement $sx) { if (isset($sx->pagefeeds)) { foreach ($sx->pagefeeds->feed as $f) { $feed = Feed::getByHandle((string) $f->handle); $inspector = \Core::make('import/value_inspector'); if (!is_object($feed)) { $feed = new Feed(); } if ($f->parent) { $result = $inspector->inspect((string) $f->parent); $parent = $result->getReplacedValue(); $feed->setParentID($parent); } $feed->setTitle((string) $f->title); $feed->setDescription((string) $f->description); $feed->setHandle((string) $f->handle); if ($f->descendents) { $feed->setIncludeAllDescendents(true); } if ($f->aliases) { $feed->setDisplayAliases(true); } if ($f->featured) { $feed->setDisplayFeaturedOnly(true); } if ($f->pagetype) { $result = $inspector->inspect((string) $f->pagetype); $pagetype = $result->getReplacedValue(); $feed->setPageTypeID($pagetype); } $contentType = $f->contenttype; $type = (string) $contentType['type']; if ($type == 'description') { $feed->displayShortDescriptionContent(); } elseif ($type == 'area') { $feed->displayAreaContent((string) $contentType['handle']); } $feed->save(); } } }
/** * {@inheritDoc} */ public function displayAreaContent($arHandle) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'displayAreaContent', array($arHandle)); return parent::displayAreaContent($arHandle); }
protected function importPageFeeds(\SimpleXMLElement $sx) { if (isset($sx->pagefeeds)) { foreach ($sx->pagefeeds->feed as $f) { $feed = new Feed(); if ($f->parent) { $feed->setParentID(self::getValue((string) $f->parent)); } $feed->setTitle((string) $f->title); $feed->setDescription((string) $f->description); $feed->setHandle((string) $f->handle); if ($f->descendents) { $feed->setIncludeAllDescendents(true); } if ($f->aliases) { $feed->setDisplayAliases(true); } if ($f->featured) { $feed->setDisplayFeaturedOnly(true); } if ($f->pagetype) { $feed->setPageTypeID(self::getValue((string) $f->pagetype)); } $contentType = $f->contenttype; $type = (string) $contentType['type']; if ($type == 'description') { $feed->displayShortDescriptionContent(); } else { if ($type == 'area') { $feed->displayAreaContent((string) $contentType['handle']); } } $feed->save(); } } }