started along route of using extra to group modifiers
This commit is contained in:
parent
87b8ef4f91
commit
1e7a8dce8c
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/aws/aws-sdk-php" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzle/guzzle" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/ise/php-soundcloud" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/massivescale/celery-php" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/phing/phing" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/php-amqplib/php-amqplib" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/predis/predis" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/propel/propel1" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/raven/raven" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/simplepie/simplepie" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/zendframework/zendframework1" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="ES6" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/libretime.iml" filepath="$PROJECT_DIR$/.idea/libretime.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PhpIncludePathManager">
|
||||||
|
<include_path>
|
||||||
|
<path value="$PROJECT_DIR$/vendor/aws/aws-sdk-php" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/guzzle/guzzle" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/ise/php-soundcloud" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/predis/predis" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/php-amqplib/php-amqplib" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/massivescale/celery-php" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/raven/raven" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/simplepie/simplepie" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/phing/phing" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/zendframework/zendframework1" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/propel/propel1" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||||
|
</include_path>
|
||||||
|
</component>
|
||||||
|
<component name="PhpUnit">
|
||||||
|
<phpunit_settings>
|
||||||
|
<PhpUnitSettings load_method="CUSTOM_LOADER" custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" />
|
||||||
|
</phpunit_settings>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/vendor/massivescale/celery-php" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/vendor/simplepie/simplepie" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1199,11 +1199,13 @@ SQL;
|
||||||
$critKeys = array_keys($p_criteriaData['criteria']);
|
$critKeys = array_keys($p_criteriaData['criteria']);
|
||||||
for ($i = 0; $i < count($critKeys); $i++) {
|
for ($i = 0; $i < count($critKeys); $i++) {
|
||||||
foreach ($p_criteriaData['criteria'][$critKeys[$i]] as $d) {
|
foreach ($p_criteriaData['criteria'][$critKeys[$i]] as $d) {
|
||||||
// Logging::info($d);
|
Logging::info($d);
|
||||||
$field = $d['sp_criteria_field'];
|
$field = $d['sp_criteria_field'];
|
||||||
$value = $d['sp_criteria_value'];
|
$value = $d['sp_criteria_value'];
|
||||||
$modifier = $d['sp_criteria_modifier'];
|
$modifier = $d['sp_criteria_modifier'];
|
||||||
if (isset($d['sp_criteria_extra'])) { $extra = $d['sp_criteria_extra']; }
|
if (isset($d['sp_criteria_extra'])) { $extra = $d['sp_criteria_extra']; }
|
||||||
|
// if extra isn't set then we will use it to store the grouping of smartblocks
|
||||||
|
else {$extra = $i;};
|
||||||
if (isset($d['sp_criteria_datetime_select'])) { $datetimeunit = $d['sp_criteria_datetime_select']; }
|
if (isset($d['sp_criteria_datetime_select'])) { $datetimeunit = $d['sp_criteria_datetime_select']; }
|
||||||
if (isset($d['sp_criteria_extra_datetime_select'])) {$extradatetimeunit = $d['sp_criteria_extra_datetime_select'];}
|
if (isset($d['sp_criteria_extra_datetime_select'])) {$extradatetimeunit = $d['sp_criteria_extra_datetime_select'];}
|
||||||
|
|
||||||
|
@ -1240,6 +1242,9 @@ SQL;
|
||||||
|
|
||||||
$qry->setDbExtra($extra);
|
$qry->setDbExtra($extra);
|
||||||
}
|
}
|
||||||
|
if (isset($extra)) {
|
||||||
|
$qry->setDbExtra($extra);
|
||||||
|
}
|
||||||
$qry->save();
|
$qry->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1521,6 +1526,14 @@ SQL;
|
||||||
if (isset($storedCrit["crit"])) {
|
if (isset($storedCrit["crit"])) {
|
||||||
foreach ($storedCrit["crit"] as $crit) {
|
foreach ($storedCrit["crit"] as $crit) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$prevgroup = null;
|
||||||
|
$group = null;
|
||||||
|
Logging::info($crit);
|
||||||
|
// now we need to sort based upon extra which contains the and grouping from the form
|
||||||
|
usort($crit, function($a, $b) {
|
||||||
|
return $a['extra'] - $b['extra'];
|
||||||
|
});
|
||||||
|
Logging::info($crit);
|
||||||
foreach ($crit as $criteria) {
|
foreach ($crit as $criteria) {
|
||||||
$spCriteria = $criteria['criteria'];
|
$spCriteria = $criteria['criteria'];
|
||||||
$spCriteriaModifier = $criteria['modifier'];
|
$spCriteriaModifier = $criteria['modifier'];
|
||||||
|
@ -1538,9 +1551,9 @@ SQL;
|
||||||
} elseif ($spCriteria == "bit_rate" || $spCriteria == 'sample_rate') {
|
} elseif ($spCriteria == "bit_rate" || $spCriteria == 'sample_rate') {
|
||||||
// multiply 1000 because we store only number value
|
// multiply 1000 because we store only number value
|
||||||
// e.g 192kps is stored as 192000
|
// e.g 192kps is stored as 192000
|
||||||
$spCriteriaValue = $criteria['value']*1000;
|
$spCriteriaValue = $criteria['value'] * 1000;
|
||||||
if (isset($criteria['extra'])) {
|
if (isset($criteria['extra'])) {
|
||||||
$spCriteriaExtra = $criteria['extra']*1000;
|
$spCriteriaExtra = $criteria['extra'] * 1000;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If user is searching for an exact match of length we need to
|
* If user is searching for an exact match of length we need to
|
||||||
|
@ -1564,8 +1577,8 @@ SQL;
|
||||||
} else {
|
} else {
|
||||||
$spCriteriaValue = ($criteria['value']);
|
$spCriteriaValue = ($criteria['value']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$spCriteriaExtra = $criteria['extra'];
|
$spCriteriaExtra = $criteria['extra'];
|
||||||
|
$group = $criteria['extra'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($spCriteriaModifier == "starts with") {
|
if ($spCriteriaModifier == "starts with") {
|
||||||
|
@ -1599,25 +1612,33 @@ SQL;
|
||||||
// Logging::info($tdt);
|
// Logging::info($tdt);
|
||||||
$spCriteriaValue = "$spCriteria >= '$fdt' AND $spCriteria <= '$tdt'";
|
$spCriteriaValue = "$spCriteria >= '$fdt' AND $spCriteria <= '$tdt'";
|
||||||
}
|
}
|
||||||
|
logging::info('before');
|
||||||
|
logging::info($spCriteriaModifier);
|
||||||
|
|
||||||
$spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
|
$spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
|
||||||
|
|
||||||
|
logging::info('after');
|
||||||
|
logging::info($spCriteriaModifier);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($spCriteria == "owner_id") {
|
if ($spCriteria == "owner_id") {
|
||||||
$spCriteria = "subj.login";
|
$spCriteria = "subj.login";
|
||||||
}
|
}
|
||||||
if ($i > 0) {
|
if ($i > 0 && $group == $prevgroup) {
|
||||||
$qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier);
|
$qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier);
|
||||||
|
Logging::info('it happened');
|
||||||
} else {
|
} else {
|
||||||
|
Logging::info('it didnt happen');
|
||||||
$qry->add($spCriteria, $spCriteriaValue, $spCriteriaModifier);
|
$qry->add($spCriteria, $spCriteriaValue, $spCriteriaModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($spCriteriaModifier == Criteria::NOT_ILIKE || $spCriteriaModifier == Criteria::NOT_EQUAL) {
|
if ($spCriteriaModifier == Criteria::NOT_ILIKE || $spCriteriaModifier == Criteria::NOT_EQUAL) {
|
||||||
$qry->addOr($spCriteria, null, Criteria::ISNULL);
|
$qry->addOr($spCriteria, null, Criteria::ISNULL);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Logging::info($e);
|
Logging::info($e);
|
||||||
}
|
}
|
||||||
|
$prevgroup = $group;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1682,6 +1703,7 @@ SQL;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
||||||
|
Logging::info($qry->toString());
|
||||||
|
|
||||||
return array("files"=>$out, "limit"=>$limits, "repeat_tracks"=> $repeatTracks, "overflow_tracks"=> $overflowTracks, "count"=>$out->count());
|
return array("files"=>$out, "limit"=>$limits, "repeat_tracks"=> $repeatTracks, "overflow_tracks"=> $overflowTracks, "count"=>$out->count());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -1690,7 +1712,8 @@ SQL;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static function organizeSmartPlaylistCriteria($p_criteria)
|
public static function organizeSmartPlaylistCriteria($p_criteria)
|
||||||
{
|
{
|
||||||
|
Logging::info($p_criteria);
|
||||||
$fieldNames = array('sp_criteria_field', 'sp_criteria_modifier', 'sp_criteria_value', 'sp_criteria_extra', 'sp_criteria_datetime_select', 'sp_criteria_extra_datetime_select');
|
$fieldNames = array('sp_criteria_field', 'sp_criteria_modifier', 'sp_criteria_value', 'sp_criteria_extra', 'sp_criteria_datetime_select', 'sp_criteria_extra_datetime_select');
|
||||||
$output = array();
|
$output = array();
|
||||||
foreach ($p_criteria as $ele) {
|
foreach ($p_criteria as $ele) {
|
||||||
|
@ -1729,7 +1752,7 @@ SQL;
|
||||||
$output['etc'][$ele['name']] = $ele['value'];
|
$output['etc'][$ele['name']] = $ele['value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Logging::info($output);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
public static function getAllBlockFiles()
|
public static function getAllBlockFiles()
|
||||||
|
|
Loading…
Reference in New Issue