further work on groupval

This commit is contained in:
Robbt 2019-01-20 09:04:46 -05:00
parent d03aa5bd86
commit eff7a19409
1 changed files with 158 additions and 155 deletions

View File

@ -281,14 +281,23 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if ($critCount > 1) { if ($critCount > 1) {
$groupCount = 0; $groupCount = 0;
$groupVal = null; $groupVal = null;
$prevGroupVal = null; //this is so that it won't match where $groupVal = 0 matching with null ?
$prevGroupVal = -1;
// this loops through and counts the number of different grouping of criteria their are
// for this criteria to preserve different bundles of criteria and modifiers vs. considering
// all criteria to be connected via or - this allows the usage of contains X
// AND does not contain Y without including everything
foreach ($storedCrit["crit"][$criteriaKeys[$i]] as $item) { foreach ($storedCrit["crit"][$criteriaKeys[$i]] as $item) {
$groupVal = $item["criteria_group"]; $groupVal = $item["criteria_group"];
Logging::info($groupVal); Logging::info($groupVal);
if ($groupVal != $prevGroupVal) {
$groupCount++;
$prevGroupVal = $groupVal;
} }
} }
Logging::info("group count = ");
Logging::info($groupCount);
}
// store the number of items with the same key in the ModRowMap // store the number of items with the same key in the ModRowMap
$modRowMap[$i] = $critCount; $modRowMap[$i] = $critCount;
@ -337,11 +346,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if (isset($criteriaKeys[$i])) { if (isset($criteriaKeys[$i])) {
if ($criteriaType == "s") { if ($criteriaType == "s") {
$criteriaModifers->setMultiOptions($this->getStringCriteriaOptions()); $criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
} } elseif ($criteriaType == "d") {
elseif ($criteriaType == "d") {
$criteriaModifers->setMultiOptions($this->getDateTimeCriteriaOptions()); $criteriaModifers->setMultiOptions($this->getDateTimeCriteriaOptions());
} } else {
else {
$criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions()); $criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
} }
$criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]); $criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
@ -384,8 +391,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
->setDecorators(array('viewHelper')); ->setDecorators(array('viewHelper'));
if (isset($criteriaKeys[$i]) && $relativeDateTime) { if (isset($criteriaKeys[$i]) && $relativeDateTime) {
$criteriaDatetimeSelect->setAttrib('enabled', 'enabled'); $criteriaDatetimeSelect->setAttrib('enabled', 'enabled');
} } else {
else {
$criteriaDatetimeSelect->setAttrib('disabled', 'disabled'); $criteriaDatetimeSelect->setAttrib('disabled', 'disabled');
} }
// check if the value is stored and it is a relative datetime field // check if the value is stored and it is a relative datetime field
@ -399,8 +405,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteriaDatetimeSelect->setMultiOptions($this->getTimePeriodCriteriaOptions()); $criteriaDatetimeSelect->setMultiOptions($this->getTimePeriodCriteriaOptions());
$criteriaDatetimeSelect->setValue($dateTimeSelectValue); $criteriaDatetimeSelect->setValue($dateTimeSelectValue);
$criteriaDatetimeSelect->setAttrib('enabled', 'enabled'); $criteriaDatetimeSelect->setAttrib('enabled', 'enabled');
} } else {
else {
$criteriaDatetimeSelect->setMultiOptions(array('0' => _('Select unit of time'))); $criteriaDatetimeSelect->setMultiOptions(array('0' => _('Select unit of time')));
$criteriaDatetimeSelect->setMultiOptions($this->getTimePeriodCriteriaOptions()); $criteriaDatetimeSelect->setMultiOptions($this->getTimePeriodCriteriaOptions());
@ -417,8 +422,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if (isset($criteriaType) && $criteriaType == "d" && $modifierTest == 'between') { if (isset($criteriaType) && $criteriaType == "d" && $modifierTest == 'between') {
// the criteria value will be a number followed by time unit and ago so set input to number part // the criteria value will be a number followed by time unit and ago so set input to number part
$criteriaExtra->setValue(filter_var($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"], FILTER_SANITIZE_NUMBER_INT)); $criteriaExtra->setValue(filter_var($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"], FILTER_SANITIZE_NUMBER_INT));
} } else {
else {
$criteriaExtra->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"]); $criteriaExtra->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"]);
} }
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text'); $criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
@ -450,7 +454,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
} }
$this->addElement($criteriaExtraDatetimeSelect); $this->addElement($criteriaExtraDatetimeSelect);
}//for }//for
}//for }//for
$repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks'); $repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');