course->controller->is_loaded() == false) { //TODO: more appropriate error message? error(get_string('objectauthnotfound','sloodle')); exit(); } // Make sure the user has permission to manage activities on this course $course_context = get_context_instance(CONTEXT_COURSE, $auth_obj->course->get_course_id()); require_capability('moodle/course:manageactivities', $course_context); // Delete all configuration options already associated with the object sloodle_delete_records('sloodle_object_config', 'object', $sloodleauthid); // Define parameter names we will ignore $IGNORE_PARAMS = array('sloodleauthid', 'sloodledebug'); // This structure will store our values $config_setting = new stdClass(); $config_setting->object = $sloodleauthid; // Add the new ones $numstored = 0; foreach ($_REQUEST as $k => $v) { // Ignore anything which does not start with "sloodle" if (strpos($k, 'sloodle') !== 0) continue; // Ignore certain parameters if (in_array($k, $IGNORE_PARAMS)) continue; // Store the setting $config_setting->name = $k; $config_setting->value = $v; if (sloodle_insert_record('sloodle_object_config', $config_setting)) { $numstored++; } } // Construct a breadcrumb navigation menu $nav = get_string('modulename', 'sloodle').' -> '; $nav .= get_string('objectconfiguration','sloodle'); // Display the page header sloodle_print_header(get_string('objectconfiguration','sloodle'), get_string('objectconfiguration','sloodle'), $nav, '', '', false); // Display the information about the object sloodle_print_box_start('generalbox boxaligncenter boxwidthnarrow'); echo '
'; echo ''.get_string('objectdetails','sloodle').'
'; echo get_string('objectname','sloodle').': '.$auth_obj->name.'
'; echo get_string('objectuuid','sloodle').': '.$auth_obj->uuid.'
'; echo get_string('objecttype','sloodle').': '.$auth_obj->type.'
'; echo get_string('authorizedfor', 'sloodle').$auth_obj->course->get_full_name().' > '.$auth_obj->course->controller->get_name().'
'; // Indicate how many settings were stored echo '
'; print_string('numsettingsstored','sloodle'); echo " $numstored
\n"; echo '
'; sloodle_print_box_end(); echo '
'; // Print a continue button, to go back to the course echo '
'; echo "
wwwroot}/course/view.php\" method=\"GET\">"; echo ''; echo ''; echo '
'; sloodle_print_footer(); ?>