示例#1
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);
 }
 /**
  * {@inheritDoc}
  */
 public function getID()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getID', array());
     return parent::getID();
 }