function opigno_quiz_app_user_results in Opigno Quiz App 7
Page callback: view user results.
Parameters
int $uid:
Return value
string
1 string reference to 'opigno_quiz_app_user_results'
- opigno_quiz_app_menu in ./
opigno_quiz_app.module - Implements hook_menu().
File
- includes/
opigno_quiz_app.pages.inc, line 33 - Defines all page callbacks.
Code
function opigno_quiz_app_user_results($uid = NULL) {
if (!isset($uid)) {
global $user;
$uid = $user->uid;
$account = clone $user;
}
else {
$account = user_load($uid);
}
if (empty($uid)) {
drupal_set_message(t("Could not find any user to display results for."), 'error');
drupal_not_found();
}
$scores = array();
foreach (og_get_groups_by_user($account, 'node') as $gid => $nid) {
$node = node_load($nid);
if ($node->type == OPIGNO_COURSE_BUNDLE) {
if ($score_data = opigno_quiz_app_get_course_data_result($uid, $nid)) {
$scores[$node->title] = $score_data;
$scores[$node->title]['node'] = $node;
}
}
}
$path = drupal_get_path('module', 'opigno_quiz_app');
drupal_add_js($path . '/js/opigno_quiz_app.js');
drupal_add_css($path . '/css/opigno_quiz_app.css');
return theme('opigno_quiz_app_user_results', array(
'user' => $account,
'results' => $scores,
));
}