public function import(\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 \Concrete\Core\Entity\Page\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();
         }
     }
 }
예제 #2
0
 protected function loadFeedFromRequest(\Concrete\Core\Entity\Page\Feed $pf = null)
 {
     if (!$pf) {
         $pf = new \Concrete\Core\Entity\Page\Feed();
     }
     $pf->setTitle($this->post('pfTitle'));
     $pf->setDescription($this->post('pfDescription'));
     $pf->setHandle($this->post('pfHandle'));
     $pf->setPageTypeID($this->post('ptID'));
     $pf->setCustomTopicAttributeKeyHandle($this->post('customTopicAttributeKeyHandle'));
     $customTopicTreeNodeID = $this->post('customTopicAttributeKeyHandle') ? $this->post('customTopicTreeNodeID') : 0;
     $pf->setCustomTopicTreeNodeID($customTopicTreeNodeID);
     $pf->setParentID(intval($this->post('cParentID')));
     $pf->setIncludeAllDescendents($this->post('pfIncludeAllDescendents'));
     $pf->setDisplayAliases($this->post('pfDisplayAliases'));
     $pf->setIconFileID($this->post('iconFID'));
     $pf->setDisplayFeaturedOnly($this->post('pfDisplayFeaturedOnly'));
     if ($this->post('pfContentToDisplay') == 'A') {
         $pf->displayAreaContent($this->post('pfAreaHandleToDisplay'));
     } else {
         $pf->displayShortDescriptionContent();
     }
     return $pf;
 }