private function fetchNextPage() { $this->entriesCurrentPage = null; $this->clearMemory(); if ($this->currentCriteria) { if ($this->lastEntryIntId && $this->lastEntryCreatedAt) { $this->currentCriteria->add(entryPeer::INT_ID, $this->lastEntryIntId, Criteria::LESS_THAN); $this->currentCriteria->add(entryPeer::CREATED_AT, $this->lastEntryCreatedAt, Criteria::LESS_EQUAL); } } else { $this->currentCriteria = $this->getNextCriteria(); if (!$this->currentCriteria) { return; } } $nextPage = entryPeer::doSelect($this->currentCriteria); if (!count($nextPage)) { $this->currentCriteria = $this->getNextCriteria(); if (!$this->currentCriteria) { return; } $nextPage = entryPeer::doSelect($this->currentCriteria); } if (!count($nextPage)) { // finished all criterias and pages return; } $this->entriesCurrentPage = $nextPage; }
private function fetchNextPage() { if ($this->executed && $this->staticPlaylist) { return; } $this->entriesCurrentPage = null; kMemoryManager::clearMemory(); if ($this->currentCriteria) { if ($this->lastEntryCreatedAt) { $this->currentCriteria->add($this->getOrderByColumn(), $this->lastEntryCreatedAt, Criteria::LESS_EQUAL); } if (count($this->lastEntryIds)) { $this->currentCriteria->add(entryPeer::ID, $this->lastEntryIds, Criteria::NOT_IN); } } else { $this->currentCriteria = $this->getNextCriteria(); if (!$this->currentCriteria) { return; } } $nextPage = entryPeer::doSelect($this->currentCriteria); if (!count($nextPage)) { $this->currentCriteria = $this->getNextCriteria(); if (!$this->currentCriteria) { return; } $nextPage = entryPeer::doSelect($this->currentCriteria); } if (!count($nextPage)) { // finished all criterias and pages return; } if ($this->staticPlaylist) { //order the entries by static (AKA manual) entries order $nextPageEntries = array(); foreach ($nextPage as $entry) { $nextPageEntries[$entry->getId()] = $entry; } $nextPage = array(); foreach ($this->staticPlaylistEntriesIdsOrder as $entryId) { if (isset($nextPageEntries[$entryId])) { $nextPage[] = $nextPageEntries[$entryId]; } } } $this->entriesCurrentPage = $nextPage; reset($this->entriesCurrentPage); }
/** * * @param entry $clipEntry new entry to copy and adjust cue points from root entry to */ public static function copyCuePointsToClipEntry(entry $clipEntry) { $clipAtts = self::getClipAttributesFromEntry($clipEntry); if (!is_null($clipAtts)) { $sourceEntry = entryPeer::retrieveByPK($clipEntry->getSourceEntryId()); if (is_null($sourceEntry)) { KalturaLog::info("Didn't copy cuePoints for entry [{$clipEntry->getId()}] because source entry [" . $clipEntry->getSourceEntryId() . "] wasn't found"); return; } $sourceEntryDuration = $sourceEntry->getLengthInMsecs(); $clipStartTime = $clipAtts->getOffset(); if (is_null($clipStartTime)) { $clipStartTime = 0; } $clipDuration = $clipAtts->getDuration(); if (is_null($clipDuration)) { $clipDuration = $sourceEntryDuration; } $c = new KalturaCriteria(); $c->add(CuePointPeer::ENTRY_ID, $clipEntry->getSourceEntryId()); if ($clipDuration < $sourceEntryDuration) { $c->addAnd(CuePointPeer::START_TIME, $clipStartTime + $clipDuration, KalturaCriteria::LESS_EQUAL); } if ($clipStartTime > 0) { $c->addAnd(CuePointPeer::START_TIME, $clipStartTime, KalturaCriteria::GREATER_EQUAL); $c->addOr(CuePointPeer::START_TIME, 0, KalturaCriteria::EQUAL); } $c->addAscendingOrderByColumn(CuePointPeer::CREATED_AT); $rootEntryCuePointsToCopy = CuePointPeer::doSelect($c); if (count($rootEntryCuePointsToCopy) <= self::MAX_CUE_POINTS_TO_COPY_TO_CLIP) { foreach ($rootEntryCuePointsToCopy as $cuePoint) { $cuePoint->copyToClipEntry($clipEntry, $clipStartTime, $clipDuration); } } else { KalturaLog::alert("Can't copy cuePoints for entry [{$clipEntry->getId()}] because cuePoints count exceeded max limit of [" . self::MAX_CUE_POINTS_TO_COPY_TO_CLIP . "]"); } } }
public function add($p1, $value = null, $comparison = null) { if ($p1 instanceof Criterion) { $oc = $this->getCriterion($p1->getColumn()); if (!is_null($oc) && $oc->getValue() == $p1->getValue() && $oc->getComparison() != $p1->getComparison()) { return $this; } return parent::add($p1); } $nc = new SolrEntryCriterion($this, $p1, $value, $comparison); return parent::add($nc); }