public function postInsert(PropelPDO $con = null)
 {
     parent::postInsert($con);
     if (!$this->getFeedId() || !$this->getId()) {
         return;
     }
     $syndicationFeed = syndicationFeedPeer::retrieveByPK($this->getFeedId());
     if (!$syndicationFeed || !$syndicationFeed instanceof genericSyndicationFeed) {
         return;
     }
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($this->getId());
     $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
     //Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setPartnerIdEquel($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     // Creates playlist with entry filter
     $playlistXml = new SimpleXMLElement("<playlist/>");
     $filtersXml = $playlistXml->addChild("filters");
     $filterXml = $filtersXml->addChild("filter");
     $entryFilter->toXml($filterXml);
     $playlistContent = $playlistXml->asXML();
     // creates playlist based on the filter XML
     $playlist = new entry();
     $playlist->setKuserId(kCurrentContext::$uid);
     $playlist->setCreatorKuserId(kCurrentContext::$uid);
     $playlist->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
     $playlist->setPartnerId($this->getPartnerId());
     $playlist->setStatus(entryStatus::READY);
     $playlist->setKshowId(null);
     $playlist->setType(entryType::PLAYLIST);
     $playlist->setMediaType(entry::ENTRY_MEDIA_TYPE_XML);
     $playlist->setDataContent($playlistContent);
     $playlist->save();
     KalturaLog::log("Playlist [" . $playlist->getId() . "] created");
     // creates feed based on the playlist
     $syndicationFeed->setPlaylistId($playlist->getId());
     $syndicationFeed->save();
 }
예제 #2
0
파일: kshow.php 프로젝트: DBezemer/server
 /**
  * This helps create special entries in a kshow - the show_entry & intro
  * $type can be either entry::ENTRY_MEDIA_TYPE_SHOW (for the show_entry) or  entry::ENTRY_MEDIA_TYPE_VIDEO  (for the intro)
  */
 public function createEntry($type, $kuser_id, $thumbnail = null, $entry_name = null)
 {
     // for invites we use the default invites from the kaltura gallery show
     if ($type != entry::ENTRY_MEDIA_TYPE_SHOW) {
         $kshow_type = $this->getType();
         $intros = array(kshow::KSHOW_TYPE_MASHUP, kshow::KSHOW_TYPE_MUSIC_VIDEO, kshow::KSHOW_TYPE_HOWTO, kshow::KSHOW_TYPE_CALL_FOR_ACTION, kshow::KSHOW_TYPE_CONTEST, kshow::KSHOW_TYPE_GROUP_GREETING, kshow::KSHOW_TYPE_SPORTS, kshow::KSHOW_TYPE_DIGITAL_STORY, kshow::KSHOW_TYPE_GROUP_TRAVELOGUE);
         $id = 0;
         if (in_array($kshow_type, $intros)) {
             $id = $kshow_type;
         }
         $id = 120 + $id;
         $entry = entryPeer::retrieveByPK($id);
         if ($entry) {
             $this->setIntroId($entry->getId());
             $this->m_intro = $entry;
         }
         return $entry;
     }
     $kshow = $this;
     $entry = new entry();
     $entry->setKshowId($kshow->getId());
     $entry->setKuserId($kuser_id);
     $entry->setCreatorKuserId($kuser_id);
     if ($this->getPartnerId() !== null) {
         $entry->setPartnerId($this->getPartnerId());
     }
     // inherit partner_id from kshow
     if ($this->getSubpId() !== null) {
         $entry->setSubpId($this->getSubpId());
     }
     // inherit subp_id from kshow
     $entry->setStatus(entryStatus::READY);
     if ($entry_name) {
         $type_text = $entry_name;
     } else {
         $type_text = "Kaltura Video";
     }
     //$entry->setData ( "&kal_show.flv");
     $entry->setThumbnail($thumbnail ? $thumbnail : "&kal_show.jpg");
     $entry->setCreateThumb(false);
     $entry->setType(entryType::MIX);
     $entry->setMediaType(entry::ENTRY_MEDIA_TYPE_SHOW);
     $entry->setEditorType(myMetadataUtils::METADATA_EDITOR_SIMPLE);
     $entry->setName($type_text);
     $entry->setTags($type_text . "," . $kshow->getTags());
     $entry->save();
     $this->setShowEntryId($entry->getId());
     $this->m_show_entry = $entry;
     return $entry;
 }
예제 #3
0
 public static function createFriendsMakeover($subp_id, $puser_id, $puser_ids)
 {
     list($kshow_id, $roughcut_entry) = self::getFriendsMakover($subp_id, $puser_id);
     if (!$kshow_id) {
         return array(0, 0, 0);
     }
     $kshow = kshowPeer::retrieveByPK($kshow_id);
     if (!$roughcut_entry) {
         $roughcut_entry = new entry();
         $roughcut_entry->setKshowId($kshow->getId());
         $roughcut_entry->setKuserId($kshow->getProducerId());
         $roughcut_entry->setCreatorKuserId($kshow->getProducerId());
         $roughcut_entry->setPartnerId($kshow->getPartnerId());
         $roughcut_entry->setSubpId($kshow->getSubpId());
         $roughcut_entry->setStatus(entryStatus::READY);
         $roughcut_entry->setThumbnail("&kal_show.jpg");
         $roughcut_entry->setType(entryType::MIX);
         $roughcut_entry->setMediaType(entry::ENTRY_MEDIA_TYPE_SHOW);
         $roughcut_entry->setName("Kaltura Video");
         $roughcut_entry->setTags("");
         $roughcut_entry->save();
     }
     list($entry_ids, $entry_puser_ids) = self::getMakeoverEntries($subp_id, $puser_id, $puser_ids);
     $custom_data = implode(",", $entry_puser_ids);
     if ($roughcut_entry->getFromCustomData("facelift", $subp_id) == $custom_data) {
         // if the users list didnt change use the current roughcut
         return array($kshow_id, $roughcut_entry->getId(), 0);
     }
     $c = new Criteria();
     $c->add(entryPeer::ID, $entry_ids, Criteria::IN);
     $entries = entryPeer::doSelect($c);
     self::createKEditorMetadata($kshow, $roughcut_entry, $entries);
     $roughcut_entry->putInCustomData("facelift", $custom_data, $subp_id);
     $roughcut_entry->save();
     return array($kshow_id, $roughcut_entry->getId(), 1);
 }