parent
624986e973
commit
14712d4d78
|
@ -1099,37 +1099,41 @@ class Application_Model_Playlist
|
||||||
}
|
}
|
||||||
|
|
||||||
$qry = CcFilesQuery::create();
|
$qry = CcFilesQuery::create();
|
||||||
foreach ($storedCrit["crit"] as $criteria) {
|
if (isset($storedCrit["crit"])) {
|
||||||
$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
|
foreach ($storedCrit["crit"] as $criteria) {
|
||||||
$spCriteria = $criteria['criteria'];
|
$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
|
||||||
|
$spCriteria = $criteria['criteria'];
|
||||||
$spCriteriaModifier = $criteria['modifier'];
|
|
||||||
$spCriteriaValue = $criteria['value'];
|
$spCriteriaModifier = $criteria['modifier'];
|
||||||
if ($spCriteriaModifier == "starts with") {
|
$spCriteriaValue = $criteria['value'];
|
||||||
$spCriteriaValue = "$spCriteriaValue%";
|
if ($spCriteriaModifier == "starts with") {
|
||||||
} else if ($spCriteriaModifier == "ends with") {
|
$spCriteriaValue = "$spCriteriaValue%";
|
||||||
$spCriteriaValue = "%$spCriteriaValue";
|
} else if ($spCriteriaModifier == "ends with") {
|
||||||
} else if ($spCriteriaModifier == "contains" || $spCriteriaModifier == "does not contain") {
|
$spCriteriaValue = "%$spCriteriaValue";
|
||||||
$spCriteriaValue = "%$spCriteriaValue%";
|
} else if ($spCriteriaModifier == "contains" || $spCriteriaModifier == "does not contain") {
|
||||||
} else if ($spCriteriaModifier == "is in the range") {
|
$spCriteriaValue = "%$spCriteriaValue%";
|
||||||
$spCriteriaValue = "$spCriteria > '$spCriteriaValue' AND $spCriteria < '$criteria[extra]'";
|
} else if ($spCriteriaModifier == "is in the range") {
|
||||||
}
|
$spCriteriaValue = "$spCriteria > '$spCriteriaValue' AND $spCriteria < '$criteria[extra]'";
|
||||||
$spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
|
}
|
||||||
try{
|
$spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
|
||||||
$qry->filterBy($spCriteriaPhpName, $spCriteriaValue, $spCriteriaModifier);
|
try{
|
||||||
$qry->addAscendingOrderByColumn('random()');
|
$qry->filterBy($spCriteriaPhpName, $spCriteriaValue, $spCriteriaModifier);
|
||||||
}catch (Exception $e){
|
$qry->addAscendingOrderByColumn('random()');
|
||||||
Logging::log($e);
|
}catch (Exception $e){
|
||||||
|
Logging::log($e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// construct limit restriction
|
// construct limit restriction
|
||||||
$limits = array();
|
$limits = array();
|
||||||
if ($storedCrit['limit']['modifier'] == "items") {
|
if (isset($storedCrit['limit'])) {
|
||||||
$limits['time'] = 1440 * 60;
|
if ($storedCrit['limit']['modifier'] == "items") {
|
||||||
$limits['items'] = $storedCrit['limit']['value'];
|
$limits['time'] = 1440 * 60;
|
||||||
} else {
|
$limits['items'] = $storedCrit['limit']['value'];
|
||||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
|
} else {
|
||||||
$limits['items'] = null;
|
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
|
||||||
|
$limits['items'] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
||||||
|
|
Loading…
Reference in New Issue