コード例 #1
0
 public static function executeStaticPlaylistFromEntryIds(array $entry_id_list, $entry_filter = null, $detailed = true, $pager = null)
 {
     // if exists extra_filters - use the first one to filter the entry_id_list
     $c = KalturaCriteria::create(entryPeer::OM_CLASS);
     $filter = new entryFilter();
     $filter->setIdIn($entry_id_list);
     $filter->setStatusEquel(entryStatus::READY);
     $filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
     $filter->attachToCriteria($c);
     if (!self::$isAdminKs) {
         self::addSchedulingToCriteria($c);
     }
     self::addModerationToCriteria($c);
     if ($entry_filter) {
         if ($entry_filter->getLimit() > 0) {
             $limit = $entry_filter->getLimit();
         }
         $entry_filter->setLimit(null);
         // read the _eq_display_in_search field but ignore it because it's part of a more complex criterion - see bellow
         $display_in_search = $entry_filter->get("_eq_display_in_search");
         if ($display_in_search >= 2) {
             $entry_filter->set("_eq_display_in_search", null);
         }
         $entry_filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
         $entry_filter->attachToCriteria($c);
         // add some hard-coded criteria
         $c->addAnd(entryPeer::TYPE, array(entryType::MEDIA_CLIP, entryType::MIX, entryType::LIVE_STREAM), Criteria::IN);
         // search only for clips or roughcuts
         $c->addAnd(entryPeer::STATUS, entryStatus::READY);
         // search only for READY entries
         if ($display_in_search >= 2) {
             // We don't allow searching in the KalturaNEtwork anymore (mainly for performance reasons)
             // allow only assets for the partner
             $c->addAnd(entryPeer::PARTNER_ID, $partner_id);
             //
             /*				
             				$crit = $c->getNewCriterion ( entryPeer::PARTNER_ID , $partner_id );
             				$crit->addOr ( $c->getNewCriterion ( entryPeer::DISPLAY_IN_SEARCH , $display_in_search ) );
             				$c->addAnd ( $crit );
             */
         }
     }
     if ($detailed) {
         $unsorted_entry_list = entryPeer::doSelectJoinkuser($c);
     } else {
         $unsorted_entry_list = entryPeer::doSelect($c);
     }
     // maybe join with kuser to add some data about the contributor
     // now sort the list according to $entry_id_list
     $entry_list = array();
     // build a map where the key is the id of the entry
     $id_list = self::buildIdMap($unsorted_entry_list);
     if ($pager) {
         $pageSize = $pager->calcPageSize();
         $startOffset = $pager->calcOffset();
     }
     // VERY STRANGE !! &$entry_id must be with a & or else the values of the array change !!!
     foreach ($entry_id_list as &$entry_id) {
         if ($entry_id != "") {
             $current_entry = @$id_list[$entry_id];
             if ($current_entry) {
                 if (isset($limit) && $limit-- === 0) {
                     break;
                 }
                 if ($pager) {
                     if ($startOffset > 0) {
                         $startOffset--;
                         continue;
                     } else {
                         if ($pageSize > 0) {
                             $pageSize--;
                         } else {
                             break;
                         }
                     }
                 }
                 // add to the entry_list only when the entry_id is not empty
                 $entry_list[] = $current_entry;
             }
         }
     }
     if (count($entry_list) == 0) {
         return null;
     }
     return $entry_list;
 }
 public static function createTeam1Image($kshow_id)
 {
     try {
         $contentPath = myContentStorage::getFSContentRootPath();
         $kshow = kshowPeer::retrieveByPK($kshow_id);
         if (!$kshow) {
             return NULL;
         }
         // the canvas for the output -
         $im = imagecreatetruecolor(120, 90);
         $logo_path = kFile::fixPath(SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'main' . DIRECTORY_SEPARATOR . 'kLogoBig.gif');
         $logoIm = imagecreatefromgif($logo_path);
         $logoIm_x = imagesx($logoIm);
         $logoIm_y = imagesy($logoIm);
         imagecopyresampled($im, $logoIm, 0, 0, 0, 0, $logoIm_x * 0.25, $logoIm_y * 0.25, $logoIm_x, $logoIm_y);
         imagedestroy($logoIm);
         // get producer's image
         $producer = kuser::getKuserById($kshow->getProducerId());
         $producer_image_path = kFile::fixPath($contentPath . $producer->getPicturePath());
         if (file_exists($producer_image_path)) {
             list($sourcewidth, $sourceheight, $type, $attr, $srcIm) = myFileConverter::createImageByFile($producer_image_path);
             $srcIm_x = imagesx($srcIm);
             $srcIm_y = imagesy($srcIm);
             // producer -
             imagecopyresampled($im, $srcIm, 0, 0, $srcIm_x * 0.1, $srcIm_y * 0.1, self::DIM_X * 2, self::DIM_Y * 2, $srcIm_x * 0.9, $srcIm_y * 0.9);
             imagedestroy($srcIm);
         }
         // fetch as many different kusers as possible who contributed to the kshow
         // first entries willcome up first
         $c = new Criteria();
         $c->add(entryPeer::KSHOW_ID, $kshow_id);
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP, Criteria::EQUAL);
         //$c->add ( entryPeer::PICTURE, null, Criteria::NOT_EQUAL );
         $c->setLimit(16);
         // we'll need 16 images of contributers
         $c->addGroupByColumn(entryPeer::KUSER_ID);
         $c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
         $entries = entryPeer::doSelectJoinkuser($c);
         if ($entries == NULL || count($entries) == 0) {
             imagedestroy($im);
             return;
         }
         //		$entry_index = 0;
         $entry_list_len = count($entries);
         reset($entries);
         if ($entry_list_len > 0) {
             /*
             				 $pos = array(2,3,4, 7,8,9, 10,11,12,13,14, 15,16,17,18,19);
             				 $i = 20;
             				 while(--$i)
             				 {
             $p1 = rand(0, 15);
             $p2 = rand(0, 15);
             $p = $pos[$p1];
             $pos[$p1] = $pos[$p2];
             $pos[$p2] = $p;
             }
             
             $i = count($entries);
             while($i--)
             {
             $x = current($pos) % 5;
             $y = floor(current($pos) / 5);
             next($pos);
             self::addKuserPictureFromEntry ( $contentPath , $im ,$entries , $x , $y );
             }
             */
             for ($y = 0; $y <= 1; ++$y) {
                 for ($x = 2; $x <= 4; ++$x) {
                     self::addKuserPictureFromEntry($contentPath, $im, $entries, $x, $y);
                 }
             }
             for ($y = 2; $y <= 3; ++$y) {
                 for ($x = 0; $x <= 4; ++$x) {
                     self::addKuserPictureFromEntry($contentPath, $im, $entries, $x, $y);
                 }
             }
         } else {
             // no contributers - need to create some other image
         }
         // add the clapper image on top
         $clapper_path = kFile::fixPath(SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'mykaltura' . DIRECTORY_SEPARATOR . 'productionicon.png');
         $clapperIm = imagecreatefrompng($clapper_path);
         imagecopyresampled($im, $clapperIm, 1.2 * self::DIM_X, 1.2 * self::DIM_Y, 0, 0, self::DIM_X, self::DIM_Y, imagesx($clapperIm), imagesy($clapperIm));
         imagedestroy($clapperIm);
         $path = kFile::fixPath($contentPath . $kshow->getTeamPicturePath());
         myContentStorage::fullMkdir($path);
         imagepng($im, $path);
         imagedestroy($im);
         $kshow->setHasTeamImage(true);
         $kshow->save();
     } catch (Exception $ex) {
         // nothing much we can do here !
     }
 }
コード例 #3
0
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $list_type = $this->getP("list_type", self::LIST_TYPE_ALL);
     $kshow_entry_list = array();
     $kuser_entry_list = array();
     if ($list_type & self::LIST_TYPE_KSHOW) {
         $c = new Criteria();
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
         $c->add(entryPeer::KSHOW_ID, $this->kshow_id);
         $kshow_entry_list = entryPeer::doSelectJoinkuser($c);
     }
     if ($list_type & self::LIST_TYPE_KUSER) {
         $c = new Criteria();
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
         $c->add(entryPeer::KUSER_ID, $this->getLoggedInUserIds(), Criteria::IN);
         $kuser_entry_list = entryPeer::doSelectJoinkuser($c);
     }
     if ($list_type & self::LIST_TYPE_EPISODE) {
         if ($kshow->getEpisodeId()) {
             // episode_id will point to the "parent" kshow
             // fetch the entries of the parent kshow
             $c = new Criteria();
             $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
             $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
             $c->add(entryPeer::KSHOW_ID, $kshow->getEpisodeId());
             $parent_kshow_entries = entryPeer::doSelectJoinkuser($c);
             if (count($parent_kshow_entries)) {
                 $kshow_entry_list = kArray::append($kshow_entry_list, $parent_kshow_entries);
             }
         }
     }
     // fetch all entries that were used in the roughcut - those of other kusers
     // - appeared under kuser_entry_list when someone else logged in
     if ($list_type & self::LIST_TYPE_ROUGHCUT) {
         if ($kshow->getHasRoughcut()) {
             $roughcut_file_name = $entry->getDataPath();
             $entry_ids_from_roughcut = myFlvStreamer::getAllAssetsIds($roughcut_file_name);
             $final_id_list = array();
             foreach ($entry_ids_from_roughcut as $id) {
                 $found = false;
                 foreach ($kshow_entry_list as $entry) {
                     if ($entry->getId() == $id) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     $final_id_list[] = $id;
                 }
             }
             $c = new Criteria();
             $c->add(entryPeer::ID, $final_id_list, Criteria::IN);
             $extra_entries = entryPeer::doSelectJoinkuser($c);
             // merge the 2 lists into 1:
             $kshow_entry_list = kArray::append($kshow_entry_list, $extra_entries);
         }
     }
     $this->kshow_entry_list = $kshow_entry_list;
     $this->kuser_entry_list = $kuser_entry_list;
 }
 public static function executeDynamicPlaylist($partner_id, $xml, $extra_filters = null, $detailed = true)
 {
     list($total_results, $list_of_filters) = self::getPlaylistFilterListStruct($xml);
     $entry_filters = array();
     if (!$list_of_filters) {
         return null;
     }
     // TODO - for now we assume that there are more or equal filters in the XML than the ones from the request
     $i = 1;
     // the extra_filter is 1-based
     foreach ($list_of_filters as $entry_filter_xml) {
         // 	in general this service can fetch entries from kaltura networks.
         // for each filter we should decide if thie assumption is true...
         $allow_partner_only = true;
         // compile all the filters - only then execute them if not yet reached the total_results
         // TODO - optimize - maybe create them only when needed. - For now it's safer to compile all even if not needed.
         $entry_filter = new entryFilter();
         // add the desired prefix "_" because the XML is not expected to have it while the entryFilter class expects it
         $entry_filter->fillObjectFromXml($entry_filter_xml, "_");
         // make sure there is alway a limit for each filter - if not an explicit one - the system limit should be used
         if ($entry_filter->getLimit() == null || $entry_filter->getLimit() < 1) {
             $entry_filter->setLimit(self::TOTAL_RESULTS);
         }
         $extra_filter = @$extra_filters[$i];
         // merge the current_filter with the correcponding extra_filter
         // allow the extra_filter to override properties of the current filter
         if ($extra_filter) {
             $entry_filter->fillObjectFromObject($extra_filter, myBaseObject::CLONE_FIELD_POLICY_THIS, myBaseObject::CLONE_POLICY_PREFER_NEW, null, null, false);
             $entry_filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
         }
         self::updateEntryFilter($entry_filter, $partner_id, true);
         $entry_filters[] = $entry_filter;
         $i++;
     }
     $number_of_entries = 0;
     $entry_list = array();
     $i = 1;
     foreach ($entry_filters as $entry_filter) {
         $current_limit = max(0, $total_results - $number_of_entries);
         // if the current_limit is < 0 - set it to be 0
         $exclude_id_list = self::getIds($entry_list);
         $c = KalturaCriteria::create(entryPeer::OM_CLASS);
         // don't fetch the same entries twice - filter out all the entries that were already fetched
         if ($exclude_id_list) {
             $c->add(entryPeer::ID, $exclude_id_list, Criteria::NOT_IN);
         }
         // no need to fetch any more results
         if ($current_limit <= 0) {
             break;
         }
         $filter_limit = $entry_filter->getLimit();
         if ($filter_limit > $current_limit) {
             // set a smaller limit incase the filter's limit is to high
             $entry_filter->setLimit($current_limit);
         }
         // read the _eq_display_in_search field but ignore it because it's part of a more complex criterion
         $display_in_search = $entry_filter->get("_eq_display_in_search");
         if ($display_in_search >= 2) {
             $entry_filter->set("_eq_display_in_search", null);
         }
         $entry_filter->attachToCriteria($c);
         // add some hard-coded criteria
         $c->addAnd(entryPeer::TYPE, array(entryType::MEDIA_CLIP, entryType::MIX, entryType::LIVE_STREAM), Criteria::IN);
         // search only for clips or roughcuts
         $c->addAnd(entryPeer::STATUS, entryStatus::READY);
         // search only for READY entries
         $c->addAnd(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
         if ($display_in_search >= 2) {
             // We don't allow searching in the KalturaNEtwork anymore (mainly for performance reasons)
             // allow only assets for the partner
             $c->addAnd(entryPeer::PARTNER_ID, $partner_id);
             //
             /*				
             				$crit = $c->getNewCriterion ( entryPeer::PARTNER_ID , $partner_id );
             				$crit->addOr ( $c->getNewCriterion ( entryPeer::DISPLAY_IN_SEARCH , $display_in_search ) );
             				$c->addAnd ( $crit );
             */
         }
         if (!self::$isAdminKs) {
             self::addSchedulingToCriteria($c);
         }
         self::addModerationToCriteria($c);
         KalturaCriterion::disableTag(KalturaCriterion::TAG_WIDGET_SESSION);
         if ($detailed) {
             $entry_list_for_filter = entryPeer::doSelectJoinkuser($c);
         } else {
             $entry_list_for_filter = entryPeer::doSelect($c);
         }
         // maybe join with kuser to add some data about the contributor
         KalturaCriterion::restoreTag(KalturaCriterion::TAG_WIDGET_SESSION);
         // update total count and merge current result with the global list
         $number_of_entries += count($entry_list_for_filter);
         $entry_list = array_merge($entry_list, $entry_list_for_filter);
     }
     return $entry_list;
 }
コード例 #5
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$partner_id) {
         die;
     }
     $entry_id = $this->getP("entry_id");
     // if the entry_type was sent by the client - make sure it's of type  ENTRY_TYPE_SHOW.
     // this is to prevent this service as part of a bad multirequest
     $entry_type = $this->getP("entry_type", null);
     if (!empty($entry_type) && $entry_type != entryType::MIX) {
         $this->addDebug("entry", "not of type " . entryType::MIX);
         return;
     }
     $kshow_id = $this->getP("kshow_id");
     list($kshow, $entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $entry_id);
     if ($error_obj) {
         $this->addError($error_obj);
         return;
     }
     KalturaLog::log(__METHOD__ . " kshow_id [{$kshow_id}] entry_id [{$entry_id}]");
     $list_type = $this->getP("list_type", self::LIST_TYPE_ROUGHCUT);
     $version = $this->getP("version", null);
     if ((int) $version == -1) {
         $version = null;
     }
     // will retrieve the latest
     $disable_roughcut_entry_data = $this->getP("disable_roughcut_entry_data", false);
     $disable_user_data = $this->getP("disable_user_data", false);
     // will allow to optimize the cals and NOT join with the kuser table
     $merge_entry_lists = false;
     if ($this->getPartner()) {
         $merge_entry_lists = $this->getPartner()->getMergeEntryLists();
     }
     $kshow_entry_list = array();
     $kuser_entry_list = array();
     $aggrigate_id_list = array();
     $this->benchmarkStart("list_type_kshow");
     if ($list_type & self::LIST_TYPE_KSHOW && $kshow_id) {
         $c = new Criteria();
         $c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
         //			$c->addAnd ( entryPeer::MEDIA_TYPE , entry::ENTRY_MEDIA_TYPE_SHOW , Criteria::NOT_EQUAL );
         $c->addAnd(entryPeer::KSHOW_ID, $kshow_id);
         $this->addIgnoreIdList($c, $aggrigate_id_list);
         //			$this->addOffsetAndLimit ( $c ); // fetch as many as the kshow has
         if ($disable_user_data) {
             $kshow_entry_list = entryPeer::doSelect($c);
         } else {
             $kshow_entry_list = entryPeer::doSelectJoinkuser($c);
         }
         $this->updateAggrigatedIdList($aggrigate_id_list, $kshow_entry_list);
     }
     $this->benchmarkEnd("list_type_kshow");
     $this->benchmarkStart("list_type_kuser");
     if ($list_type & self::LIST_TYPE_KUSER) {
         // try to get puserKuser - PS2
         $puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $puser_id, false);
         // try to get kuser by partnerId & puserId - PS3 - backward compatibility
         $apiv3Kuser = kuserPeer::getKuserByPartnerAndUid($partner_id, $puser_id, true);
         if ($puser_kuser && $puser_kuser->getKuserId() || $apiv3Kuser) {
             $c = new Criteria();
             $c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
             //				$c->addAnd ( entryPeer::MEDIA_TYPE , entry::ENTRY_MEDIA_TYPE_SHOW , Criteria::NOT_EQUAL );
             $kuserIds = array();
             if ($puser_kuser && $puser_kuser->getKuserId()) {
                 $kuserIds[] = $puser_kuser->getKuserId();
             }
             if ($apiv3Kuser) {
                 if (!$puser_kuser || $puser_kuser->getKuserId() != $apiv3Kuser->getId()) {
                     $kuserIds[] = $apiv3Kuser->getId();
                 }
             }
             /*
             				if(count($kuserIds) > 1)
             				{
             					$c->addAnd ( entryPeer::KUSER_ID , $kuserIds, Criteria::IN );
             				}
             				else
             				{
             					$c->addAnd ( entryPeer::KUSER_ID , $kuserIds[0] );
             				}
             				if ( $merge_entry_lists )
             				{
             					// if will join lists - no need to fetch entries twice
             					$this->addIgnoreIdList ($c , $aggrigate_id_list);
             				}
             				$this->addOffsetAndLimit ( $c ); // limit the number of the user's clips
             				if ( $disable_user_data )
             					$kuser_entry_list = entryPeer::doSelect( $c );
             				else
             					$kuser_entry_list = entryPeer::doSelectJoinkuser( $c );
             */
             $this->addOffsetAndLimit($c);
             // limit the number of the user's clips
             if ($merge_entry_lists) {
                 // if will join lists - no need to fetch entries twice
                 $this->addIgnoreIdList($c, $aggrigate_id_list);
             }
             $kuser_entry_list = array();
             $kuserIds = array_unique($kuserIds);
             foreach ($kuserIds as $kuserId) {
                 $newC = clone $c;
                 $newC->addAnd(entryPeer::KUSER_ID, $kuserId);
                 if ($disable_user_data) {
                     $one_kuser_list = entryPeer::doSelect($newC);
                 } else {
                     $one_kuser_list = entryPeer::doSelectJoinkuser($newC);
                 }
                 $kuser_entry_list = array_merge($kuser_entry_list, $one_kuser_list);
             }
             // Since we are using 2 potential kusers, we might not have the obvious kuser from $puser_kuser
             $strEntries = "";
             if ($puser_kuser) {
                 $kuser = kuserPeer::retrieveByPk($puser_kuser->getKuserId());
                 if ($kuser) {
                     $strEntriesTemp = @unserialize($kuser->getPartnerData());
                     if ($strEntriesTemp) {
                         $strEntries .= $strEntriesTemp;
                     }
                 }
             }
             if ($apiv3Kuser) {
                 $strEntriesTemp = @unserialize($apiv3Kuser->getPartnerData());
                 if ($strEntriesTemp) {
                     $strEntries .= $strEntriesTemp;
                 }
             }
             if ($strEntries) {
                 $entries = explode(',', $strEntries);
                 $fixed_entry_list = array();
                 foreach ($entries as $entryId) {
                     $fixed_entry_list[] = trim($entryId);
                 }
                 $c = new Criteria();
                 $c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
                 $c->addAnd(entryPeer::ID, $fixed_entry_list, Criteria::IN);
                 if ($merge_entry_lists) {
                     // if will join lists - no need to fetch entries twice
                     $this->addIgnoreIdList($c, $aggrigate_id_list);
                 }
                 if ($disable_user_data) {
                     $extra_user_entries = entryPeer::doSelect($c);
                 } else {
                     $extra_user_entries = entryPeer::doSelectJoinkuser($c);
                 }
                 if (count($extra_user_entries)) {
                     $kuser_entry_list = array_merge($extra_user_entries, $kuser_entry_list);
                 }
             }
         } else {
             $kuser_entry_list = array();
         }
         if ($merge_entry_lists) {
             $kshow_entry_list = kArray::append($kshow_entry_list, $kuser_entry_list);
             $kuser_entry_list = null;
         }
     }
     $this->benchmarkEnd("list_type_kuser");
     $this->benchmarkStart("list_type_episode");
     if ($list_type & self::LIST_TYPE_EPISODE) {
         if ($kshow && $kshow->getEpisodeId()) {
             // episode_id will point to the "parent" kshow
             // fetch the entries of the parent kshow
             $c = new Criteria();
             $c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
             //				$c->addAnd ( entryPeer::MEDIA_TYPE , entry::ENTRY_MEDIA_TYPE_SHOW , Criteria::NOT_EQUAL );
             $c->addAnd(entryPeer::KSHOW_ID, $kshow->getEpisodeId());
             $this->addIgnoreIdList($c, $aggrigate_id_list);
             //				$this->addOffsetAndLimit ( $c ); // limit the number of the inherited entries from the episode
             if ($disable_user_data) {
                 $parent_kshow_entries = entryPeer::doSelect($c);
             } else {
                 $parent_kshow_entries = entryPeer::doSelectJoinkuser($c);
             }
             if (count($parent_kshow_entries)) {
                 $kshow_entry_list = kArray::append($kshow_entry_list, $parent_kshow_entries);
             }
         }
     }
     $this->benchmarkEnd("list_type_episode");
     // fetch all entries that were used in the roughcut - those of other kusers
     // - appeared under kuser_entry_list when someone else logged in
     $this->benchmarkStart("list_type_roughcut");
     $entry_data_from_roughcut_map = array();
     // will hold an associative array where the id is the key
     if ($list_type & self::LIST_TYPE_ROUGHCUT) {
         if ($entry->getType() == entryType::MIX) {
             $sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version);
             $roughcut_file_name = kFileSyncUtils::getReadyLocalFilePathForKey($sync_key);
             $entry_data_from_roughcut = myFlvStreamer::getAllAssetsData($roughcut_file_name);
             $final_id_list = array();
             foreach ($entry_data_from_roughcut as $data) {
                 $id = $data["id"];
                 // first element is the id
                 $entry_data_from_roughcut_map[] = $data;
                 $found = false;
                 foreach ($kshow_entry_list as $entry) {
                     // see we are not fetching duplicate entries
                     if ($entry->getId() == $id) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     $final_id_list[] = $id;
                 }
             }
             if (count($final_id_list) > 0) {
                 // allow deleted entries when searching for entries on the roughcut
                 // don't forget to return the status at the end of the process
                 entryPeer::allowDeletedInCriteriaFilter();
                 $c = new Criteria();
                 $c->addAnd(entryPeer::ID, $final_id_list, Criteria::IN);
                 $c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
                 $this->addIgnoreIdList($c, $aggrigate_id_list);
                 //				$this->addOffsetAndLimit ( $c );
                 if ($disable_user_data) {
                     $extra_entries = entryPeer::doSelect($c);
                 } else {
                     $extra_entries = entryPeer::doSelectJoinkuser($c);
                 }
                 // return the status to the criteriaFilter
                 entryPeer::blockDeletedInCriteriaFilter();
                 // merge the 2 lists into 1:
                 $kshow_entry_list = kArray::append($kshow_entry_list, $extra_entries);
             }
         }
     }
     $this->benchmarkEnd("list_type_roughcut");
     $this->benchmarkStart("create_wrapper");
     $entry_wrapper = objectWrapperBase::getWrapperClass($kshow_entry_list, objectWrapperBase::DETAIL_LEVEL_REGULAR, -3, 0, array("contributorScreenName"));
     //$entry_wrapper->addFields ( array ( "kuser.screenName" ) );
     $this->addMsg("show", $entry_wrapper);
     // if ! $disable_roughcut_entry_data - add the roughcut_entry_data
     if (!$disable_roughcut_entry_data) {
         $this->addMsg("roughcut_entry_data", $entry_data_from_roughcut_map);
     }
     if (count($kuser_entry_list) > 0) {
         $this->addMsg("user", objectWrapperBase::getWrapperClass($kuser_entry_list, objectWrapperBase::DETAIL_LEVEL_REGULAR));
     } else {
         $this->addMsg("user", null);
     }
     $this->benchmarkEnd("create_wrapper");
 }
コード例 #6
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this accessControl is new, it will return
  * an empty collection; or if this accessControl has previously
  * been saved, it will retrieve related entrys from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in accessControl.
  */
 public function getentrysJoinkuser($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(accessControlPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collentrys === null) {
         if ($this->isNew()) {
             $this->collentrys = array();
         } else {
             $criteria->add(entryPeer::ACCESS_CONTROL_ID, $this->id);
             $this->collentrys = entryPeer::doSelectJoinkuser($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(entryPeer::ACCESS_CONTROL_ID, $this->id);
         if (!isset($this->lastentryCriteria) || !$this->lastentryCriteria->equals($criteria)) {
             $this->collentrys = entryPeer::doSelectJoinkuser($criteria, $con, $join_behavior);
         }
     }
     $this->lastentryCriteria = $criteria;
     return $this->collentrys;
 }