/** * Callback for moodle admin page. * * @return boolean true if success, false on error */ function podcaster_process_options(&$config) { global $CFG; $tab = $config->tab; switch ($tab) { case 'main': case 'license': case 'repository': case 'metachannel': case 'language': case 'tools': // OK break; default: $tab = 'main'; } $module = $config->module; $return = isset($config->finish) ? true : false; $next = isset($config->continue) ? true : false; $error = 0; require_once $CFG->dirroot . '/mod/podcaster/locallib.php'; require_once $CFG->dirroot . '/mod/podcaster/lib/admin.php'; $admin =& podcaster_admin::get_instance(); if (($error = $admin->process_form($tab, $config)) != PODCASTER_NOERROR) { $return = false; $next = false; $subject = $admin->subject; } if ($return) { redirect($CFG->wwwroot . '/' . $CFG->admin . '/modules.php', get_string('changessaved'), 1); } $nexttab = !$next ? $tab : ($tab == 'main' ? 'license' : ($tab == 'license' ? 'repository' : ($tab == 'repository' ? 'metachannel' : ($tab == 'metachannel' ? 'language' : ($tab == 'language' ? 'tools' : 'main'))))); redirect($CFG->wwwroot . '/' . $CFG->admin . '/module.php?module=' . $module . '&tab=' . $nexttab . ($error ? '&error=' . $error . '&subject=' . $subject : '')); }
function postinstall() { global $CFG; include_once $CFG->dirroot . '/mod/podcaster/lib/public.php'; // repository default parameter $repositories = get_records('podcaster_repository'); foreach ($repositories as $r) { if (!$r->params) { $rep =& podcaster_repository::create_repository($r->prefix, true); if (!$rep) { continue; } $r->params = $rep->get_default_params(); update_record('podcaster_repository', $r); } } podcaster_admin::default_config(); }