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) {
$groupCount = 0;
$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) {
$groupVal = $item["criteria_group"];
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
$modRowMap[$i] = $critCount;
@ -337,11 +346,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if (isset($criteriaKeys[$i])) {
if ($criteriaType == "s") {
$criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
}
elseif ($criteriaType == "d") {
} elseif ($criteriaType == "d") {
$criteriaModifers->setMultiOptions($this->getDateTimeCriteriaOptions());
}
else {
} else {
$criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
}
$criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
@ -384,8 +391,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
->setDecorators(array('viewHelper'));
if (isset($criteriaKeys[$i]) && $relativeDateTime) {
$criteriaDatetimeSelect->setAttrib('enabled', 'enabled');
}
else {
} else {
$criteriaDatetimeSelect->setAttrib('disabled', 'disabled');
}
// 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->setValue($dateTimeSelectValue);
$criteriaDatetimeSelect->setAttrib('enabled', 'enabled');
}
else {
} else {
$criteriaDatetimeSelect->setMultiOptions(array('0' => _('Select unit of time')));
$criteriaDatetimeSelect->setMultiOptions($this->getTimePeriodCriteriaOptions());
@ -417,8 +422,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
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
$criteriaExtra->setValue(filter_var($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"], FILTER_SANITIZE_NUMBER_INT));
}
else {
} else {
$criteriaExtra->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"]);
}
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
@ -450,7 +454,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
$this->addElement($criteriaExtraDatetimeSelect);
}//for
}//for
$repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');