Exemplo n.º 1
0
    if ($choice->timeopen > $timenow) {
        print_simple_box(get_string("notopenyet", "choice", userdate($choice->timeopen)), "center");
        print_footer($course);
        exit;
    } else {
        if ($timenow > $choice->timeclose) {
            print_simple_box(get_string("expired", "choice", userdate($choice->timeclose)), "center");
            print_footer($course);
            exit;
        }
    }
}
if ((!$current or $choice->allowupdate) and ($choice->timeclose >= time() or $choice->timeclose == 0) and has_capability('mod/choice:choose', $context)) {
    // They haven't made their choice yet or updates allowed and choice is open
    echo '<form id="form" method="post" action="view.php">';
    choice_show_form($choice, $USER, $cm);
    echo '</form>';
    $choiceformshown = true;
} else {
    $choiceformshown = false;
}
if (!$choiceformshown) {
    $sitecontext = get_context_instance(CONTEXT_SYSTEM);
    if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) {
        // Guest on whole site
        $wwwroot = $CFG->wwwroot . '/login/index.php';
        if (!empty($CFG->loginhttps)) {
            $wwwroot = str_replace('http:', 'https:', $wwwroot);
        }
        notice_yesno(get_string('noguestchoose', 'choice') . '<br /><br />' . get_string('liketologin'), $wwwroot, $_SERVER['HTTP_REFERER']);
    } else {
Exemplo n.º 2
0
if ($choice->timeclose != 0) {
    if ($choice->timeopen > $timenow) {
        print_simple_box(get_string("notopenyet", "choice", userdate($choice->timeopen)), "center");
        print_footer($course);
        exit;
    } else {
        if ($timenow > $choice->timeclose) {
            print_simple_box(get_string("expired", "choice", userdate($choice->timeclose)), "center");
            $choiceopen = false;
        }
    }
}
if ((!$current or $choice->allowupdate) and $choiceopen and has_capability('mod/choice:choose', $context)) {
    // They haven't made their choice yet or updates allowed and choice is open
    echo '<form id="form" method="post" action="view.php">';
    choice_show_form($choice, $USER, $cm, $allresponses);
    echo '</form>';
    $choiceformshown = true;
} else {
    $choiceformshown = false;
}
if (!$choiceformshown) {
    $sitecontext = get_context_instance(CONTEXT_SYSTEM);
    if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) {
        // Guest on whole site
        $wwwroot = $CFG->wwwroot . '/login/index.php';
        if (!empty($CFG->loginhttps)) {
            $wwwroot = str_replace('http:', 'https:', $wwwroot);
        }
        notice_yesno(get_string('noguestchoose', 'choice') . '<br /><br />' . get_string('liketologin'), $wwwroot, $_SERVER['HTTP_REFERER']);
    } else {