コード例 #1
0
        if (is_array($selected) && !empty($selected)) {
            $seltext = implode('x', $selected);
            $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j');
            $posts = '';
            $selarray = str_split($seltext);
            foreach ($selarray as $char) {
                $posts .= $char == 'x' ? $char : $letters[$char];
            }
        } else {
            $posts = '';
        }
        // get the id of the forum
        $forumobj = $discussion->get_forum();
        $forumngid = $forumobj->get_id();
        require_once $CFG->libdir . '/portfoliolib.php';
        // check if the forum is shared and pass the cloneid in the callback options
        $linkparams = $discussion->get_link_params_array();
        if (array_key_exists('clone', $linkparams)) {
            $cloneid = $linkparams['clone'];
        } else {
            $cloneid = 0;
        }
        $button = new portfolio_add_button();
        $button->set_callback_options('forumng_all_portfolio_caller', array('forumngid' => $forumngid, 'cloneid' => $cloneid, 'posts' => $posts, 'discussionid' => $discussion->get_id()), 'mod_forumng');
        $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
        // redirect to the export page
        redirect($button->to_html(PORTFOLIO_ADD_FAKE_URL));
    }
}
forumngfeature_post_selector::go(new export_post_selector());
コード例 #2
0
    public function apply($discussion, $all, $selected, $formdata)
    {
        global $COURSE, $USER, $CFG, $PAGE;
        $d = $discussion->get_id();
        $forum = $discussion->get_forum();
        $PAGE->set_pagelayout('embedded');
        $out = mod_forumng_utils::get_renderer();
        print $out->header();
        $backlink = new moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array());
        print html_writer::start_tag('div', array('class' => 'forumng-printable-header'));
        print html_writer::tag('div', link_arrow_left($discussion->get_subject(), $backlink), array('class' => 'forumng-printable-backlink'));
        print html_writer::tag('div', get_string('printedat', 'forumngfeature_print', userdate(time())), array('class' => 'forumng-printable-date'));
        print html_writer::tag('div', '', array('class' => 'clearer'));
        print "\n";
        print $out->box(get_string('back', 'forumngfeature_print', $backlink->out()), 'generalbox forumng-donotprint');
        print html_writer::start_tag('div', array('class' => 'forumng-showprintable'));
        if ($all) {
            print $out->render_discussion($discussion, array(mod_forumng_post::OPTION_NO_COMMANDS => true, mod_forumng_post::OPTION_CHILDREN_EXPANDED => true, mod_forumng_post::OPTION_PRINTABLE_VERSION => true));
        } else {
            $allhtml = '';
            $alltext = '';
            $discussion->build_selected_posts_email($selected, $alltext, $allhtml, array(mod_forumng_post::OPTION_PRINTABLE_VERSION));
            print $allhtml;
        }
        print html_writer::end_tag('div');
        $forum->print_js(0, false);
        print $out->footer();
    }
}
forumngfeature_post_selector::go(new print_post_selector());
コード例 #3
0
                print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $formdata->email);
            }
        }
        // Log that it was sent
        $discussion->log('forward discussion', $formdata->email);
        if (!empty($formdata->ccme)) {
            if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) {
                print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $USER->email);
            }
        }
        $out = $discussion->init_page($discussion->get_moodle_url(), $this->get_page_name());
        print $out->header();
        print $out->box(get_string('forward_done', 'forumngfeature_forward'));
        print $out->continue_button(new moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array()));
        print $out->footer();
    }
    function get_content_after_form($discussion, $all, $selected, $formdata)
    {
        // Print selected messages if they have any (rather than whole
        // discussion)
        if (!$all) {
            // Display selected messages below form
            $allhtml = '';
            $alltext = '';
            $discussion->build_selected_posts_email($selected, $alltext, $allhtml);
            print '<div class="forumng-showemail">' . $allhtml . '</div>';
        }
    }
}
forumngfeature_post_selector::go(new forward_post_selector());