/**
  * @param BaseObject $object
  * @param SimpleXMLElement $mrss
  * @param kMrssParameters $mrssParams
  * @return SimpleXMLElement
  */
 public function contribute(BaseObject $object, SimpleXMLElement $mrss, kMrssParameters $mrssParams = null)
 {
     if (!$object instanceof entry) {
         return;
     }
     $children = entryPeer::retrieveChildEntriesByEntryIdAndPartnerId($object->getId(), $object->getPartnerId());
     if (!count($children)) {
         return;
     }
     $childrenNode = $mrss->addChild('children');
     $childrenDom = dom_import_simplexml($childrenNode);
     foreach ($children as $child) {
         $childXML = kMrssManager::getEntryMrssXml($child);
         $childDom = dom_import_simplexml($childXML);
         $childDom = $childrenDom->ownerDocument->importNode($childDom, true);
         $childrenDom->appendChild($childDom);
     }
 }
Пример #2
0
 public function postUpdate(PropelPDO $con = null)
 {
     if (!$this->wasObjectSaved()) {
         return;
     }
     if ($this->alreadyInSave) {
         return parent::postUpdate($con);
     }
     $objectUpdated = $this->isModified();
     $objectDeleted = false;
     if ($this->isColumnModified(entryPeer::STATUS) && $this->getStatus() == entryStatus::DELETED) {
         $objectDeleted = true;
     }
     if ($this->isColumnModified(entryPeer::DATA) && $this->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         $partner = $this->getPartner();
         if ($partner) {
             $dataArr = explode('.', $this->getData());
             $id = $this->getId();
             if ($id == $partner->getAudioThumbEntryId()) {
                 $partner->setAudioThumbEntryVersion($dataArr[0]);
                 $partner->save();
             }
             if ($id == $partner->getLiveThumbEntryId()) {
                 $partner->setLiveThumbEntryVersion($dataArr[0]);
                 $partner->save();
             }
         }
     }
     $trackColumns = $this->getTrackColumns();
     $changedProperties = array();
     foreach ($trackColumns as $namespace => $trackColumn) {
         if (is_array($trackColumn)) {
             if (isset($this->oldCustomDataValues[$namespace])) {
                 foreach ($trackColumn as $trackCustomData) {
                     if (isset($this->oldCustomDataValues[$namespace][$trackCustomData])) {
                         $column = $trackCustomData;
                         if ($namespace) {
                             $column = "{$namespace}.{$trackCustomData}";
                         }
                         $previousValue = $this->oldCustomDataValues[$namespace][$trackCustomData];
                         $previousValue = is_scalar($previousValue) ? $previousValue : $this->getTrackEntryString($namespace, $trackCustomData, $previousValue);
                         $newValue = $this->getFromCustomData($trackCustomData, $namespace);
                         $newValue = is_scalar($newValue) ? $newValue : $this->getTrackEntryString($namespace, $trackCustomData, $newValue);
                         $changedProperties[] = "{$column} [{$previousValue}]->[{$newValue}]";
                     }
                 }
             }
         } elseif ($this->isColumnModified($trackColumn)) {
             $column = entryPeer::translateFieldName($trackColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_STUDLYPHPNAME);
             $previousValue = $this->getColumnsOldValue($trackColumn);
             $newValue = $this->getByName($trackColumn, BasePeer::TYPE_COLNAME);
             $changedProperties[] = "{$column} [{$previousValue}]->[{$newValue}]";
         }
     }
     if ($this->getRedirectEntryId() && array_key_exists('', $this->oldCustomDataValues) && array_key_exists('redirectEntryId', $this->oldCustomDataValues[''])) {
         $redirectEntry = entryPeer::retrieveByPK($this->getRedirectEntryId());
         if ($redirectEntry) {
             $redirectEntry->setModerationStatus($this->getModerationStatus());
             $redirectEntry->save();
         }
     }
     $ret = parent::postUpdate($con);
     if ($objectDeleted) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
         myStatisticsMgr::deleteEntry($this);
         $trackEntry = new TrackEntry();
         $trackEntry->setEntryId($this->getId());
         $trackEntry->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_DELETED_ENTRY);
         $trackEntry->setChangedProperties(implode("\n", $changedProperties));
         $trackEntry->setDescription(__METHOD__ . "[" . __LINE__ . "]");
         TrackEntry::addTrackEntry($trackEntry);
         //In case this entry has sub streams assigned to it we should delete them as well
         $subStreamEntries = entryPeer::retrieveChildEntriesByEntryIdAndPartnerId($this->id, $this->partner_id);
         foreach ($subStreamEntries as $subStreamEntry) {
             myEntryUtils::deleteEntry($subStreamEntry);
         }
     }
     if ($objectUpdated) {
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($this));
         if (!$objectDeleted && count($changedProperties)) {
             $trackEntry = new TrackEntry();
             $trackEntry->setEntryId($this->getId());
             $trackEntry->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_UPDATE_ENTRY);
             $trackEntry->setChangedProperties(implode("\n", $changedProperties));
             $trackEntry->setDescription(__METHOD__ . "[" . __LINE__ . "]");
             TrackEntry::addTrackEntry($trackEntry);
         }
     }
     return $ret;
 }