Ejemplo n.º 1
0
     }
     if (!isset($opcondition['operator'])) {
         $opcondition['operator'] = 0;
     }
     if (!isset($opcondition['value'])) {
         $opcondition['value'] = 0;
     }
     if (!str_in_array($opcondition['conditiontype'], $allowed_opconditions)) {
         continue;
     }
     $label = num2letter($i);
     $operationConditionsTable->addRow(array('(' . $label . ')', get_condition_desc($opcondition['conditiontype'], $opcondition['operator'], $opcondition['value']), array(new CButton('remove', _('Remove'), 'javascript: removeOperationCondition(' . $i . ');', 'link_menu'), new CVar('new_operation[opconditions][' . $i . '][conditiontype]', $opcondition['conditiontype']), new CVar('new_operation[opconditions][' . $i . '][operator]', $opcondition['operator']), new CVar('new_operation[opconditions][' . $i . '][value]', $opcondition['value']))), null, 'opconditions_' . $i);
     $grouped_opconditions[$opcondition['conditiontype']][] = $label;
     $i++;
 }
 if ($operationConditionsTable->itemsCount() > 1) {
     switch ($this->data['new_operation']['evaltype']) {
         case ACTION_EVAL_TYPE_AND:
             $group_op = $glog_op = _('and');
             break;
         case ACTION_EVAL_TYPE_OR:
             $group_op = $glog_op = _('or');
             break;
         default:
             $group_op = _('or');
             $glog_op = _('and');
             break;
     }
     foreach ($grouped_opconditions as $id => $condition) {
         $grouped_opconditions[$id] = '(' . implode(' ' . $group_op . ' ', $condition) . ')';
     }