| 109 |
} |
} |
| 110 |
if (is_array($action_sets)) { |
if (is_array($action_sets)) { |
| 111 |
foreach ($action_sets as $action_set) { |
foreach ($action_sets as $action_set) { |
| 112 |
if (!empty($action_set['status'])) { |
if (!empty($action_set['status']) && $action_set['status'] == VOTING_ACTIONS_STATE_ENABLED) { |
| 113 |
$actions = array(); |
$actions = array(); |
| 114 |
if (_voting_actions_process_set($context, $action_set, $actions) == TRUE) { |
if (_voting_actions_process_set($context, $action_set, $actions) === TRUE) { |
| 115 |
actions_do($actions, $content); |
actions_do($actions, $context['content']); |
| 116 |
} |
} |
| 117 |
} |
} |
| 118 |
} |
} |
| 160 |
// check the required flag of the subset. if it is, evaluate it. |
// check the required flag of the subset. if it is, evaluate it. |
| 161 |
if ($subset['required'] == TRUE) { |
if ($subset['required'] == TRUE) { |
| 162 |
$set_result = $set_result && _voting_actions_process_set($context, $subset, $actions); |
$set_result = $set_result && _voting_actions_process_set($context, $subset, $actions); |
| 163 |
if ($set_result == FALSE) { |
if ($set_result === FALSE) { |
| 164 |
return FALSE; |
return FALSE; |
| 165 |
} |
} |
| 166 |
} |
} |
| 167 |
} |
} |
| 168 |
|
|
| 169 |
if ($set_result == TRUE) { |
if ($set_result === TRUE) { |
| 170 |
// It's still true after executing required subsets. Add the actions, then process optional subsets. |
// It's still true after executing required subsets. Add the actions, then process optional subsets. |
| 171 |
foreach ($action_set['actions'] as $action) { |
foreach ($action_set['actions'] as $action) { |
| 172 |
$actions[] = $action; |
$actions[] = $action; |
| 345 |
// First we'll loop through and delete any that are |
// First we'll loop through and delete any that are |
| 346 |
// in the db but not in the new version of the set. |
// in the db but not in the new version of the set. |
| 347 |
$current_sets = array(); |
$current_sets = array(); |
| 348 |
|
$current_sets['replacements'][] = $set['vasid']; |
| 349 |
foreach ($set['conditions'] as $condition) { |
foreach ($set['conditions'] as $condition) { |
| 350 |
if (isset($condition['vacid'])) { |
if (isset($condition['vacid'])) { |
| 351 |
$current_sets['wildcards'][] = '%d'; |
$current_sets['wildcards'][] = '%d'; |
| 352 |
$current_sets['replacements'][] = $condition['vacid']; |
$current_sets['replacements'][] = $condition['vacid']; |
| 353 |
} |
} |
| 354 |
} |
} |
| 355 |
db_query("DELETE FROM {voting_actions_condition} WHERE vacid NOT IN (". implode(',', $current_sets['wildcards']) .")", $current_sets['replacements']); |
db_query("DELETE FROM {voting_actions_condition} WHERE vasid = %d AND vacid NOT IN (". implode(',', $current_sets['wildcards']) .")", $current_sets['replacements']); |
| 356 |
|
|
| 357 |
foreach ($set['conditions'] as $condition) { |
foreach ($set['conditions'] as $condition) { |
| 358 |
|
$condition['vasid'] = $set['vasid']; |
| 359 |
if (isset($condition['vacid'])) { |
if (isset($condition['vacid'])) { |
| 360 |
_voting_actions_update_condition($condition); |
_voting_actions_update_condition($condition); |
| 361 |
} |
} |