New look at NemeinQuiz

NemeinQuiz is an online exam tool originally developed for Pharmaceutical Information Centre for their pharmaceutical sales courses. We published the package as Open Source with some quick setup instructions.

While setting up a Midgard-powered site for the Student Union of Helsinki School of Economics (KY), I decided to take another look at NemeinQuiz to see how well it would integrate into the MidCOM template site as the online questionnaire.

Some quick screenshots how it looks like (in Finnish, sorry):



The old instructions were mostly valid for usage with MidCOM as well. Here is what I did:

  • Created a new prefixed host /quiz under the site, using same style as the main host
  • Set the root page of the prefixed host to be active
  • Created root-level topic named __NemeinQuiz and managed by a "Quiz users" group
  • Put the following code to the page's <(code-init)> element:
    // Midcom-template compatibility
    $GLOBALS["midcom_site"]["uri"] = "/";
    // Which language to use, currently localized to finnish and english
    // Try to instance the root topic
    $GLOBALS["midcom_site"]['root_topic'] = mgd_get_object_by_guid("e03d770ca230df1f11137badfd6ae1a4");
    // Single sign-on with the live site
    if (!$midgard->user) {

    // Allow single sing-on with the main site
    $auth_conf['host_override'] = '';
    $auth_conf['path_override'] = '/';

    // Include the NemeinAuthentication library

    // Refresh existing session from user's cookies
    $login_error = auth_by_cookies();

    // Support for anonymous submission, add correct
    // account information
    if (!$midgard->user && $argv[0] != "edit") {
    $midgard = mgd_get_midgard();

    // Don't log missing localization strings

    // Which group owns the __NemeinQuiz topic?
    $nngroup = mgd_get_object_by_guid("d70f026e977819dda67851dc377e73ea");

    // Start the Quiz application
  • Put the following code to the page's content:
  • In addition, created an <(edit-this-page)> element to provide better UI-level compatibility with MidCOM:
    <div class="edit-this-page">
    if (!$GLOBALS["midgard"]->user) {
      echo "<a href=\"/midcom-admin/?midcom_site[redirect]=".$GLOBALS["midgard"]->uri."\">Login</a>\n";
    } else {
      if ($argc > 0 && $argv[0] == "view") {
        echo "<a href=\"".$GLOBALS["midgard"]->self."edit/both/".$argv[1].".html\">Muokkaa sivua</a> | ";
      echo "<a href=\"".$GLOBALS["midgard"]->self."edit/\">Luo sivu</a>\n";

In addition to NemeinQuiz, KY is also using the new net.nemein.quickpoll component for running simple, "Slashdot-like" selection quizzes on the front page.

NemeinQuiz is also available as questionnaire tool bundled in the TownPortal package.

Read more Midgard posts.