Beispiel #1
0
/**
 * @global object
 * @param object $course
 * @param object $user
 * @param object $mod
 * @param object $groupreg
 * @return string|void
 */
function groupreg_user_complete($course, $user, $mod, $groupreg)
{
    global $DB;
    if ($answer = $DB->get_record('groupreg_answers', array("groupregid" => $groupreg->id, "userid" => $user->id))) {
        $result = new stdClass();
        $result->info = "'" . format_string(groupreg_get_option_text($groupreg, $answer->optionid)) . "'";
        $result->time = $answer->timemodified;
        echo get_string("answered", "groupreg") . ": {$result->info}. " . get_string("updated", '', userdate($result->time));
    } else {
        print_string("notanswered", "groupreg");
    }
}
Beispiel #2
0
if ($usesections) {
    $table->head = array($strsectionname, get_string("question"), get_string("answer"));
    $table->align = array("center", "left", "left");
} else {
    $table->head = array(get_string("question"), get_string("answer"));
    $table->align = array("left", "left");
}
$currentsection = "";
foreach ($choices as $choice) {
    if (!empty($answers[$choice->id])) {
        $answer = $answers[$choice->id];
    } else {
        $answer = "";
    }
    if (!empty($answer->optionid)) {
        $aa = format_string(groupreg_get_option_text($choice, $answer->optionid));
    } else {
        $aa = "";
    }
    if ($usesections) {
        $printsection = "";
        if ($choice->section !== $currentsection) {
            if ($choice->section) {
                $printsection = get_section_name($course, $sections[$choice->section]);
            }
            if ($currentsection !== "") {
                $table->data[] = 'hr';
            }
            $currentsection = $choice->section;
        }
    }