You are here

quiz_dashboard.module in Quiz 6.6

Quiz Dashboard

Module creates a report to analyse and compare the results of quiz attendees.

File

includes/quiz_dashboard/quiz_dashboard.module
View source
<?php

/**
 * @file
 * Quiz Dashboard
 *
 * Module creates a report to analyse and compare the results of quiz attendees.
 */

/*
 * @function
 * Implementation of hook_init().
 * includes the CSS file
 */
function quiz_dashboard_init() {
  drupal_add_css(drupal_get_path('module', 'quiz_dashboard') . '/quiz_dashboard.css', 'theme');
}

/**
 * @function
 * Implementation of hook_help().
 */
function quiz_dashboard_help($path, $arg) {
  if ($path == 'admin/help#quiz_dashboard') {
    return '<p>' . t('Module creates a report to analyse and compare the results of quiz attendees. The reports will be displayed visually using goolge chart API.') . '</p>';
  }
}

/**
 * @function
 * Implementation of hook_perm()
 * Valid permissions for this module
 *
 * @return
 * array of valid permissions.
 */
function quiz_dashboard_perm() {
  $permission = array(
    'access user dashboard',
    'access author dashboard',
  );

  // access user dashborad - will allow access to invidual users dashboard.
  // access author dashboard - will allow access to all users dashboard.
  return $permission;
}

/**
 * @function
 * Implementation of hook_menu()
 */
function quiz_dashboard_menu() {
  global $user;
  $items = array();
  $items['admin/quiz/reports/dashboard/creator'] = array(
    'title' => t('Quiz Creators Dashboard'),
    'description' => t('Generates a report on quiz results for quiz creators.'),
    'file' => 'quiz_dashboard.admin.inc',
    'page callback' => 'quiz_dashboard_get_basic_stats',
    //'page arguments' => array('questions_import_form'),
    'access arguments' => array(
      'access author dashboard',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/quiz/reports/dashboard/creator/%/view'] = array(
    'title' => t('Quiz Creators Dashboard'),
    'description' => t('Generates a report on quiz results for quiz creators.'),
    'file' => 'quiz_dashboard.admin.inc',
    'page callback' => 'quiz_dashboard_get_adv_stats',
    'page arguments' => array(
      5,
    ),
    'access arguments' => array(
      'access user dashboard',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['user/%/dashboard'] = array(
    'title' => t('Results Dashboard'),
    'description' => t('Generates a report on quiz results for quiz creators.'),
    'file' => 'quiz_dashboard.admin.inc',
    'page callback' => 'quiz_dashboard_get_basic_stats',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'access user dashboard',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  $items['user/%/dashboard/%/view'] = array(
    'title' => t('Results Dashboard'),
    //'description' => t('Generates a report on quiz results for quiz creators.'),
    'file' => 'quiz_dashboard.admin.inc',
    'page callback' => 'quiz_dashboard_get_adv_stats',
    'page arguments' => array(
      3,
      1,
    ),
    'access arguments' => array(
      'access user dashboard',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}

/**
 * @function
 * Implementation of hook_theme().
 */
function quiz_dashboard_theme() {
  return array(
    'quiz_dashboard_get_basic_stats' => array(
      'arguments' => array(
        'results' => NULL,
      ),
      'file' => 'quiz_dashboard.admin.inc',
    ),
    'date_vs_takeup_count' => array(
      'arguments' => array(
        'takeup' => NULL,
      ),
      'file' => 'quiz_dashboard.admin.inc',
    ),
    'get_quiz_status_chart' => array(
      'arguments' => array(
        'quiz' => NULL,
      ),
      'file' => 'quiz_dashboard.admin.inc',
    ),
    'quiz_top_scorers' => array(
      'arguments' => array(
        'scorer' => NULL,
      ),
      'file' => 'quiz_dashboard.admin.inc',
    ),
    'quiz_grade_range' => array(
      'arguments' => array(
        'range' => NULL,
      ),
      'file' => 'quiz_dashboard.admin.inc',
    ),
  );
}

Functions

Namesort descending Description
quiz_dashboard_help @function Implementation of hook_help().
quiz_dashboard_init
quiz_dashboard_menu @function Implementation of hook_menu()
quiz_dashboard_perm @function Implementation of hook_perm() Valid permissions for this module
quiz_dashboard_theme @function Implementation of hook_theme().