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();
         }
     }
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 public function save($args)
 {
     // If we've gotten to the process() function for this class, we assume that we're in
     // the clear, as far as permissions are concerned (since we check permissions at several
     // points within the dispatcher)
     $db = Loader::db();
     $bID = $this->bID;
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     $args = $args + array('enableExternalFiltering' => 0, 'includeAllDescendents' => 0, 'includeDate' => 0, 'truncateSummaries' => 0, 'displayFeaturedOnly' => 0, 'topicFilter' => '', 'displayThumbnail' => 0, 'displayAliases' => 0, 'truncateChars' => 0, 'paginate' => 0, 'rss' => 0, 'pfID' => 0);
     $args['num'] = $args['num'] > 0 ? $args['num'] : 0;
     $args['cThis'] = $args['cParentID'] == $this->cID ? '1' : '0';
     $args['cParentID'] = $args['cParentID'] == 'OTHER' ? $args['cParentIDValue'] : $args['cParentID'];
     if (!$args['cParentID']) {
         $args['cParentID'] = 0;
     }
     $args['enableExternalFiltering'] = $args['enableExternalFiltering'] ? '1' : '0';
     $args['includeAllDescendents'] = $args['includeAllDescendents'] ? '1' : '0';
     $args['includeDate'] = $args['includeDate'] ? '1' : '0';
     $args['truncateSummaries'] = $args['truncateSummaries'] ? '1' : '0';
     $args['displayFeaturedOnly'] = $args['displayFeaturedOnly'] ? '1' : '0';
     $args['filterByRelated'] = $args['topicFilter'] == 'related' ? '1' : '0';
     $args['filterByCustomTopic'] = $args['topicFilter'] == 'custom' ? '1' : '0';
     $args['displayThumbnail'] = $args['displayThumbnail'] ? '1' : '0';
     $args['displayAliases'] = $args['displayAliases'] ? '1' : '0';
     $args['truncateChars'] = intval($args['truncateChars']);
     $args['paginate'] = intval($args['paginate']);
     $args['rss'] = intval($args['rss']);
     $args['ptID'] = intval($args['ptID']);
     if (!$args['filterByRelated']) {
         $args['relatedTopicAttributeKeyHandle'] = '';
     }
     if (!$args['filterByCustomTopic']) {
         $args['customTopicAttributeKeyHandle'] = '';
         $args['customTopicTreeNodeID'] = 0;
     }
     if ($args['rss']) {
         if (isset($this->pfID) && $this->pfID) {
             $pf = Feed::getByID($this->pfID);
         }
         if (!is_object($pf)) {
             $pf = new \Concrete\Core\Page\Feed();
             $pf->setTitle($args['rssTitle']);
             $pf->setDescription($args['rssDescription']);
             $pf->setHandle($args['rssHandle']);
         }
         $pf->setParentID($args['cParentID']);
         $pf->setPageTypeID($args['ptID']);
         $pf->setIncludeAllDescendents($args['includeAllDescendents']);
         $pf->setDisplayAliases($args['displayAliases']);
         $pf->setDisplayFeaturedOnly($args['displayFeaturedOnly']);
         $pf->setDisplayAliases($args['displayAliases']);
         $pf->displayShortDescriptionContent();
         $pf->save();
         $args['pfID'] = $pf->getID();
     } elseif (isset($this->pfID) && $this->pfID && !$args['rss']) {
         // let's make sure this isn't in use elsewhere.
         $cnt = $db->GetOne('select count(pfID) from btPageList where pfID = ?', array($this->pfID));
         if ($cnt == 1) {
             // this is the last one, so we delete
             $pf = Feed::getByID($this->pfID);
             if (is_object($pf)) {
                 $pf->delete();
             }
         }
         $args['pfID'] = 0;
     }
     $args['pfID'] = intval($args['pfID']);
     parent::save($args);
 }
Esempio n. 4
0
 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 setDisplayAliases($pfDisplayAliases)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDisplayAliases', array($pfDisplayAliases));
     return parent::setDisplayAliases($pfDisplayAliases);
 }
 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();
         }
     }
 }