$PAGE->navbar->add(get_string('addfunctions', 'webservice'));
     /// Add function operation
     if (confirm_sesskey() and $service and empty($service->component)) {
         $mform = new external_service_functions_form(null, array('action' => 'add', 'id' => $service->id));
         //cancelled add operation, redirect to function list page
         if ($mform->is_cancelled()) {
             redirect($functionlisturl);
         }
         //add the function to the service then redirect to function list page
         if ($data = $mform->get_data()) {
             ignore_user_abort(true);
             // no interruption here!
             foreach ($data->fids as $fid) {
                 $function = $webservicemanager->get_external_function_by_id($fid, MUST_EXIST);
                 // make sure the function is not there yet
                 if (!$webservicemanager->service_function_exists($function->name, $service->id)) {
                     $webservicemanager->add_external_function_to_service($function->name, $service->id);
                 }
             }
             redirect($functionlisturl);
         }
         //Add function operation page output
         echo $OUTPUT->header();
         echo $OUTPUT->heading($service->name);
         $mform->display();
         echo $OUTPUT->footer();
         die;
     }
     break;
 case 'delete':
     $PAGE->navbar->add(get_string('removefunction', 'webservice'));