예제 #1
0
        if ($form->validate()) {
            if ($check) {
                $values = $form->exportValues();
                $res = $obj->update($values);
                Display::display_confirmation_message(sprintf(get_lang('ItemUpdated'), $values['name']), false);
            }
            $obj->display();
        } else {
            /*echo '<div class="actions">';
              echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
              echo '</div>';*/
            $form->addElement('hidden', 'sec_token');
            $form->setConstants(array('sec_token' => $token));
            $form->display();
        }
        break;
    case 'delete':
        // Action handling: delete
        if ($check) {
            $res = $obj->delete($_GET['id']);
            if ($res) {
                Display::display_confirmation_message(get_lang('ItemDeleted'));
            }
        }
        $obj->display();
        break;
    default:
        $obj->display();
        break;
}
Display::display_footer();
 static function transaction_extra_field_eliminar_generic($extra_field_variable, $original_data, $web_service_details, $type = 'session')
 {
     //horario
     $extra_field = new ExtraField($type);
     $extra_field_info = $extra_field->get_handler_field_info_by_field_variable($extra_field_variable);
     $extra_field_option = new ExtraFieldOption($type);
     $extra_field_option_info = $extra_field_option->get_field_option_by_field_and_option($extra_field_info['id'], $original_data['item_id']);
     if (!empty($extra_field_option_info)) {
         $info_before = $extra_field_option->get_field_options_by_field($extra_field_info['id']);
         $deleting_option_ids = array();
         foreach ($extra_field_option_info as $option) {
             //@todo Delete all horario in sessions?
             $result = $extra_field_option->delete($option['id']);
             if ($result) {
                 $deleting_option_ids[] = $option['id'];
             }
         }
         $info_after = $extra_field_option->get_field_options_by_field($extra_field_info['id']);
         if (!empty($deleting_option_ids)) {
             $deleting_option_ids = implode(',', $deleting_option_ids);
             return array('entity' => $extra_field_variable, 'before' => $info_before, 'after' => $info_after, 'message' => "Extra field options were deleted for the field_variable: {$extra_field_variable}, options id deleted: {$deleting_option_ids}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
         } else {
             return array('message' => "Extra field option was NOT deleted. No field options ids where found for variable: '{$extra_field_variable}' with id:'" . $original_data['item_id'] . "'", 'status_id' => self::TRANSACTION_STATUS_FAILED);
         }
     } else {
         return array('message' => "Extra field option was NOT deleted  - Extra field not found in DB. Trying to locate field_variable: '{$extra_field_variable}' with id: '{$original_data['item_id']}'", 'status_id' => self::TRANSACTION_STATUS_FAILED);
     }
 }