コード例 #1
0
ファイル: discuss.php プロジェクト: Gavinthisisit/Moodle
    $button = new portfolio_add_button();
    $button->set_callback_options('twf_portfolio_caller', array('discussionid' => $discussion->id), 'mod_twf');
    $button = $button->to_html(PORTFOLIO_ADD_FULL_FORM, get_string('exportdiscussion', 'mod_twf'));
    $buttonextraclass = '';
    if (empty($button)) {
        // no portfolio plugin available.
        $button = ' ';
        $buttonextraclass = ' noavailable';
    }
    echo html_writer::tag('div', $button, array('class' => 'discussioncontrol exporttoportfolio' . $buttonextraclass));
} else {
    echo html_writer::tag('div', ' ', array('class' => 'discussioncontrol nullcontrol'));
}
// groups selector not needed here
echo '<div class="discussioncontrol displaymode">';
twf_print_mode_form($discussion->id, $displaymode);
echo "</div>";
if ($twf->type != 'single' && has_capability('mod/twf:movediscussions', $modcontext)) {
    echo '<div class="discussioncontrol movediscussion">';
    // Popup menu to move discussions to other twfs. The discussion in a
    // single discussion twf can't be moved.
    $modinfo = get_fast_modinfo($course);
    if (isset($modinfo->instances['twf'])) {
        $twfmenu = array();
        // Check twf types and eliminate simple discussions.
        $twfcheck = $DB->get_records('twf', array('course' => $course->id), '', 'id, type');
        foreach ($modinfo->instances['twf'] as $twfcm) {
            if (!$twfcm->uservisible || !has_capability('mod/twf:startdiscussion', context_module::instance($twfcm->id))) {
                continue;
            }
            $section = $twfcm->sectionnum;
コード例 #2
0
ファイル: view.php プロジェクト: Gavinthisisit/Moodle
// Return here if we post or set subscription etc
/// Print settings and things across the top
// If it's a simple single discussion twf, we need to print the display
// mode control.
if ($twf->type == 'single') {
    $discussion = NULL;
    $discussions = $DB->get_records('twf_discussions', array('twf' => $twf->id), 'timemodified ASC');
    if (!empty($discussions)) {
        $discussion = array_pop($discussions);
    }
    if ($discussion) {
        if ($mode) {
            set_user_preference("twf_displaymode", $mode);
        }
        $displaymode = get_user_preferences("twf_displaymode", $CFG->twf_displaymode);
        twf_print_mode_form($twf->id, $displaymode, $twf->type);
    }
}
if (!empty($twf->blockafter) && !empty($twf->blockperiod)) {
    $a = new stdClass();
    $a->blockafter = $twf->blockafter;
    $a->blockperiod = get_string('secondstotime' . $twf->blockperiod);
    echo $OUTPUT->notification(get_string('thistwfisthrottled', 'twf', $a));
}
if ($twf->type == 'qanda' && !has_capability('moodle/course:manageactivities', $context)) {
    echo $OUTPUT->notification(get_string('qandanotify', 'twf'));
}
echo "该课程模块暂不可见";
/*
    switch ($twf->type) {
        case 'single':