Esempio n. 1
0
 function save_lines($post_data, $parent, $key = '')
 {
     require_once 'modules/AOW_WorkFlow/aow_utils.php';
     $line_count = count($post_data[$key . 'field']);
     $j = 0;
     for ($i = 0; $i < $line_count; ++$i) {
         if ($post_data[$key . 'deleted'][$i] == 1) {
             $this->mark_deleted($post_data[$key . 'id'][$i]);
         } else {
             $field = new AOR_Field();
             foreach ($this->field_defs as $field_def) {
                 if (isset($post_data[$key . $field_def['name']][$i])) {
                     if (is_array($post_data[$key . $field_def['name']][$i])) {
                         $post_data[$key . $field_def['name']][$i] = base64_encode(serialize($post_data[$key . $field_def['name']][$i]));
                     } else {
                         if ($field_def['name'] == 'value') {
                             $post_data[$key . $field_def['name']][$i] = fixUpFormatting($_REQUEST['report_module'], $field->field, $post_data[$key . $field_def['name']][$i]);
                         }
                     }
                     $field->{$field_def}['name'] = $post_data[$key . $field_def['name']][$i];
                 }
             }
             if (trim($field->field) != '') {
                 $field->aor_report_id = $parent->id;
                 $field->save();
             }
         }
     }
 }
Esempio n. 2
0
 function save_lines($post_data, $parent, $key = '')
 {
     require_once 'modules/AOW_WorkFlow/aow_utils.php';
     $line_count = count($post_data[$key . 'field']);
     for ($i = 0; $i < $line_count; ++$i) {
         if ($post_data[$key . 'deleted'][$i] == 1) {
             $this->mark_deleted($post_data[$key . 'id'][$i]);
         } else {
             $field = new AOR_Field();
             $field->group_display = false;
             if ($key == 'aor_fields_') {
                 foreach ($post_data['aor_fields_group_display'] as $gdKey => $gdValue) {
                     if ($gdValue == $i) {
                         $field->group_display = $gdKey + 1;
                         break;
                     }
                 }
             }
             foreach ($this->field_defs as $field_def) {
                 $field_name = $field_def['name'];
                 if (is_array($post_data[$key . $field_name])) {
                     if ($field_name != 'group_display' && isset($post_data[$key . $field_name][$i])) {
                         if (is_array($post_data[$key . $field_name][$i])) {
                             $post_data[$key . $field_name][$i] = base64_encode(serialize($post_data[$key . $field_name][$i]));
                         } else {
                             if ($field_name == 'value') {
                                 $post_data[$key . $field_name][$i] = fixUpFormatting($_REQUEST['report_module'], $field->field, $post_data[$key . $field_name][$i]);
                             }
                         }
                         if ($field_name == 'module_path') {
                             $post_data[$key . $field_name][$i] = base64_encode(serialize(explode(":", $post_data[$key . $field_name][$i])));
                         }
                         $field->{$field_name} = $post_data[$key . $field_name][$i];
                     }
                 } else {
                     if (is_null($post_data[$key . $field_name])) {
                         // do nothing
                     } else {
                         throw new Exception('illegal type in post data at key ' . $key . $field_name . ' ' . gettype($post_data[$key . $field_name]));
                     }
                 }
             }
             if (trim($field->field) != '') {
                 $field->aor_report_id = $parent->id;
                 $field->save();
             }
         }
     }
 }