exit; } } } // if there is no global_id or global_name, take the DEFAULT global configuration if ($global_name) { // check for valid configuration name and convert it into a config_id if (!$global_id = ExternConfig::GetConfigurationByName($range_id, $type, $config_name)) { echo $EXTERN_ERROR_MESSAGE; exit; } } elseif (!$global_id) { // check for standard configuration if ($id = ExternConfig::GetGlobalConfiguration($range_id)) $global_id = $id; else { // use no global configuration $global_id = NULL; } } // sem == -1: show data from last semester // sem == +1: show data from next semester // other values: show data from current semester $now = time(); foreach ($all_semester as $key => $sem_record) { if ($now >= $sem_record["beginn"] && $now <= $sem_record["ende"]) { $current = $key; break;
function GetInfo ($range_id, $config_id) { $query = "SELECT * FROM extern_config WHERE config_id = ? "; $query .= " AND range_id = ? "; $params = array($config_id, $range_id); $state = DBManager::get()->prepare($query); $state->execute($params); $res = $state->fetch(PDO::FETCH_ASSOC); if ($res) { $global_config = ExternConfig::GetGlobalConfiguration($range_id); $module_type = $res['config_type']; $module = $GLOBALS["EXTERN_MODULE_TYPES"][$res['config_type']]["module"]; $level = $GLOBALS["EXTERN_MODULE_TYPES"][$res['config_type']]["level"]; $make = strftime("%x", $res['mkdate']); $change = strftime("%x", $res['chdate']); $sri = "<studip_remote_include>\n\t<module name=\"$module\" />"; $sri .= "\n\t<config id=\"$config_id\" />\n\t"; if ($global_config) { $sri .= "<global id=\"$global_config\" />\n\t"; } $sri .= "<range id=\"$range_id\" />"; $sri .= "\n</studip_remote_include>"; $link_sri = $GLOBALS["EXTERN_SERVER_NAME"] . 'extern.php?page_url=' . _("URL_DER_INCLUDE_SEITE"); if ($level) { $link = $GLOBALS["EXTERN_SERVER_NAME"] . "extern.php?module=$module"; if ($global_config) { $link .= "&config_id=$config_id&global_id=$global_config&range_id=$range_id"; } else { $link .= "&config_id=$config_id&range_id=$range_id"; } $link_structure = $link . "&view=tree"; $sri_structure = "<studip_remote_include>\n\tmodule = $module\n\t"; $sri_structure = "config_id = $config_id\n\t"; if ($global_config) { $sri_structure .= "global_id = $global_config\n\t"; } $sri_structure .= "range_id=$range_id"; $sri_structure .= "\n\tview = tree\n</studip_remote_include>"; $link_br = $GLOBALS["EXTERN_SERVER_NAME"] . "extern.php?module=$module<br>"; if ($global_config) { $link_br .= "&config_id=$config_id<br>&global_id=$global_config<br>&range_id=$range_id"; } else { $link_br .= "&config_id=$config_id<br>&range_id=$range_id"; } $info = array("module_type" => $module_type, "module_name" => $module, "name" => $res['name'], "make_date" => $make, "change_date" => $change, "link" => $link, "link_stucture" => $link_structure, "sri" => $sri, "sri_structure" => $sri_structure, "link_sri" => $link_sri, "level" => $level, "link_br" => $link_br); } else { $info = array("module_type" => $module_type, "module_name" => $module_name, "name" =>$res['name'], "make_date" => $make, "change_date" => $change, "sri" => $sri, "link_sri" => $link_sri, "level" => $level); } return $info; } return FALSE; }
} else { echo $GLOBALS['EXTERN_ERROR_MESSAGE']; exit; } } } // the module itself validates the rest } else { // without a range_id and a module-name there's no chance to printout data // except an error message echo $GLOBALS['EXTERN_ERROR_MESSAGE']; exit; } // check for standard global configuration if (empty($global_id) && ($global_configuration = ExternConfig::GetGlobalConfiguration($range_id))) { $global_id = $global_configuration; } // all parameters ok, instantiate module and print data foreach ($GLOBALS['EXTERN_MODULE_TYPES'] as $type) { if ($type["module"] == $module) { $module_obj = ExternModule::GetInstance($range_id, $module, $config_id, $default, $global_id); } } // Workaround to include data in scripts if ($incdata) { $module_obj->config->config["Main"]["incdata"] = 1; }