本文整理汇总了PHP中entryFilter::unsetByName方法的典型用法代码示例。如果您正苦于以下问题:PHP entryFilter::unsetByName方法的具体用法?PHP entryFilter::unsetByName怎么用?PHP entryFilter::unsetByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryFilter
的用法示例。
在下文中一共展示了entryFilter::unsetByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSchedulingToCriteria
private static function addSchedulingToCriteria(Criteria $c, entryFilter $filter = null)
{
$min = 0;
$max = kApiCache::getTime();
$allowNull = true;
if ($filter) {
if ($filter->is_set('_lteornull_start_date')) {
$max = min($max, $filter->get('_lteornull_start_date'));
$filter->unsetByName('_lteornull_start_date');
}
if ($filter->is_set('_gteornull_start_date')) {
$min = max($min, $filter->get('_gteornull_start_date'));
$filter->unsetByName('_gteornull_start_date');
}
if ($filter->is_set('_lte_start_date')) {
$max = min($max, $filter->get('_lte_start_date'));
$allowNull = false;
$filter->unsetByName('_lte_start_date');
}
if ($filter->is_set('_gte_start_date')) {
$min = max($min, $filter->get('_gte_start_date'));
$allowNull = false;
$filter->unsetByName('_gte_start_date');
}
}
self::addSchedulingCriterion($c, entryPeer::START_DATE, $min, $max, $allowNull);
$min = kApiCache::getTime();
$max = 0;
$allowNull = true;
if ($filter) {
if ($filter->is_set('_lteornull_end_date')) {
$max = min($max, $filter->get('_lteornull_end_date'));
$filter->unsetByName('_lteornull_end_date');
}
if ($filter->is_set('_gteornull_end_date')) {
$min = max($min, $filter->get('_gteornull_end_date'));
$filter->unsetByName('_gteornull_end_date');
}
if ($filter->is_set('_lte_end_date')) {
$max = min($max, $filter->get('_lte_end_date'));
$allowNull = false;
$filter->unsetByName('_lte_end_date');
}
if ($filter->is_set('_gte_end_date')) {
$min = max($min, $filter->get('_gte_end_date'));
$allowNull = false;
$filter->unsetByName('_gte_end_date');
}
}
self::addSchedulingCriterion($c, entryPeer::END_DATE, $min, $max, $allowNull);
}
示例2: applyFilterFields
/**
* Applies all filter fields and unset the handled fields
*
* @param baseObjectFilter $filter
*/
protected function applyFilterFields(entryFilter $filter)
{
if ($filter->get("_matchand_categories") !== null) {
$filter->set("_matchand_categories_ids", $filter->categoryNamesToIds($filter->get("_matchand_categories")));
$filter->unsetByName('_matchand_categories');
}
if ($filter->get("_matchor_categories") !== null) {
$filter->set("_matchor_categories_ids", $filter->categoryNamesToIds($filter->get("_matchor_categories")));
$filter->unsetByName('_matchor_categories');
}
if ($filter->get("_matchor_duration_type") !== null) {
$filter->set("_matchor_duration_type", $filter->durationTypesToIndexedStrings($filter->get("_matchor_duration_type")));
}
if ($filter->get(baseObjectFilter::ORDER) === "recent") {
$filter->set("_lte_available_from", time());
$filter->set("_gteornull_end_date", time());
// schedule not finished
$filter->set(baseObjectFilter::ORDER, "-available_from");
}
if ($filter->get('_free_text')) {
KalturaLog::debug('No advanced filter defined');
$freeTexts = $filter->get('_free_text');
$additionalConditions = array();
if (preg_match('/^"[^"]+"$/', $freeTexts)) {
$additionalConditions[] = $freeText;
// fixme - only name,tags,description ?
} else {
if (strpos($freeTexts, baseObjectFilter::IN_SEPARATOR) > 0) {
str_replace(baseObjectFilter::AND_SEPARATOR, baseObjectFilter::IN_SEPARATOR, $freeTexts);
$freeTextsArr = explode(baseObjectFilter::IN_SEPARATOR, $freeTexts);
foreach ($freeTextsArr as $valIndex => $valValue) {
if (!is_numeric($valValue) && strlen($valValue) <= 1) {
unset($freeTextsArr[$valIndex]);
}
}
foreach ($freeTextsArr as $freeText) {
$additionalConditions[] = $freeText;
// fixme - only name,tags,description ?
}
} else {
$freeTextsArr = explode(baseObjectFilter::AND_SEPARATOR, $freeTexts);
foreach ($freeTextsArr as $valIndex => $valValue) {
if (!is_numeric($valValue) && strlen($valValue) <= 1) {
unset($freeTextsArr[$valIndex]);
}
}
$freeTextExpr = implode(" +", $freeTextsArr);
$additionalConditions[] = $freeTextExpr;
// fixme - only name,tags,description ?
}
}
if (count($additionalConditions)) {
$this->whereClause[] = '(' . implode(' ', $additionalConditions) . ')';
}
}
$filter->unsetByName('_free_text');
foreach ($filter->fields as $field => $val) {
if (is_null($val) || !strlen($val)) {
// KalturaLog::debug("Skip field[$field] value is null");
continue;
}
$fieldParts = explode(baseObjectFilter::FILTER_PREFIX, $field, 3);
if (count($fieldParts) != 3) {
KalturaLog::debug("Skip field[{$field}] has [" . count($fieldParts) . "] parts");
continue;
}
list($prefix, $operator, $fieldName) = $fieldParts;
$fieldNamesArr = explode(baseObjectFilter::OR_SEPARATOR, $fieldName);
if (count($fieldNamesArr) > 1) {
$solrFieldNames = array();
foreach ($fieldNamesArr as $fieldName) {
$solrField = self::getSolrFieldName($fieldName);
$type = self::getSolrFieldType($solrField);
$solrFieldNames[] = $solrField;
}
$solrField = '(' . implode(',', $solrFieldNames) . ')';
$vals = array_unique(explode(baseObjectFilter::OR_SEPARATOR, $val));
$val = implode(' ', $vals);
} elseif (!$this->hasMatchableField($fieldName)) {
KalturaLog::debug("Skip field[{$field}] has no matchable for name[{$fieldName}]");
continue;
} else {
$solrField = self::getSolrFieldName($fieldName);
$type = self::getSolrFieldType($solrField);
}
$valStr = print_r($val, true);
KalturaLog::debug("Attach field[{$fieldName}] as solr field[{$solrField}] of type [{$type}] and comparison[{$operator}] for value[{$valStr}]");
switch ($operator) {
case baseObjectFilter::MULTI_LIKE_OR:
case baseObjectFilter::MATCH_OR:
$vals = explode(',', $val);
foreach ($vals as $valIndex => $valValue) {
if (!is_numeric($valValue) && strlen($valValue) <= 1) {
unset($vals[$valIndex]);
}
//.........这里部分代码省略.........