Skip to content

Commit

Permalink
Merge pull request kaltura#5474 from kaltura/Lynx-12.15.0-PS-2993
Browse files Browse the repository at this point in the history
PS-2993: syndication-feed - enable relative-time filter
  • Loading branch information
shpiNi authored Apr 26, 2017
2 parents 77eb8ce + d98ff92 commit 5695373
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
20 changes: 17 additions & 3 deletions alpha/apps/kaltura/lib/model/objectfilters/entryFilter.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,23 @@ public function addSearchMatchToCriteria ( $criteria , $keys_to_search , $field_
}

protected function getRelativeTimeFields()
{
return array_merge(parent::getRelativeTimeFields(), self::$relative_time_fields);
}
{
return array_merge(parent::getRelativeTimeFields(), self::$relative_time_fields);
}

public function transformFieldsToRelative()
{
foreach($this->getRelativeTimeFields() as $relativeFieldName)
{
$relativeFieldName = "_" . $relativeFieldName;
if($this->is_set($relativeFieldName))
{
$value = $this->getByName($relativeFieldName);
$value = kTime::getRelativeTime($value);
$this->setByName($relativeFieldName, $value);
}
}
}

public function setIdEquel($v)
{
Expand Down
1 change: 1 addition & 0 deletions api_v3/lib/syndication/KalturaSyndicationFeedRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ public function addExternalAttachedFilter()

$coreFilter = new entryFilter();
$entryFilter->toObject($coreFilter);
$coreFilter->transformFieldsToRelative();
$this->addFilter($coreFilter);
}

Expand Down
6 changes: 5 additions & 1 deletion api_v3/services/SyndicationFeedService.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ protected function kalturaNetworkAllowed($actionName)
*
* @action add
* @param KalturaBaseSyndicationFeed $syndicationFeed
* @return KalturaBaseSyndicationFeed
* @return KalturaBaseSyndicationFeed
*
* @disableRelativeTime $syndicationFeed
*/
public function addAction(KalturaBaseSyndicationFeed $syndicationFeed)
{
Expand Down Expand Up @@ -134,6 +136,8 @@ public function getAction($id)
* @param KalturaBaseSyndicationFeed $syndicationFeed
* @return KalturaBaseSyndicationFeed
* @throws KalturaErrors::INVALID_FEED_ID
*
* @disableRelativeTime $syndicationFeed
*/
public function updateAction($id, KalturaBaseSyndicationFeed $syndicationFeed)
{
Expand Down

0 comments on commit 5695373

Please sign in to comment.