Example #1
0
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package   mod_twf
 * @copyright  2009 Petr Skoda (http://skodak.org)
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
    require_once $CFG->dirroot . '/mod/twf/lib.php';
    $settings->add(new admin_setting_configselect('twf_displaymode', get_string('displaymode', 'twf'), get_string('configdisplaymode', 'twf'), FORUM_MODE_NESTED, twf_get_layout_modes()));
    $settings->add(new admin_setting_configcheckbox('twf_replytouser', get_string('replytouser', 'twf'), get_string('configreplytouser', 'twf'), 1));
    // Less non-HTML characters than this is short
    $settings->add(new admin_setting_configtext('twf_shortpost', get_string('shortpost', 'twf'), get_string('configshortpost', 'twf'), 300, PARAM_INT));
    // More non-HTML characters than this is long
    $settings->add(new admin_setting_configtext('twf_longpost', get_string('longpost', 'twf'), get_string('configlongpost', 'twf'), 600, PARAM_INT));
    // Number of discussions on a page
    $settings->add(new admin_setting_configtext('twf_manydiscussions', get_string('manydiscussions', 'twf'), get_string('configmanydiscussions', 'twf'), 100, PARAM_INT));
    if (isset($CFG->maxbytes)) {
        $maxbytes = 0;
        if (isset($CFG->twf_maxbytes)) {
            $maxbytes = $CFG->twf_maxbytes;
        }
        $settings->add(new admin_setting_configselect('twf_maxbytes', get_string('maxattachmentsize', 'twf'), get_string('configmaxbytes', 'twf'), 512000, get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes)));
    }
    // Default number of attachments allowed per post in all twfs
Example #2
0
/**
 * Print the drop down that allows the user to select how they want to have
 * the discussion displayed.
 *
 * @param int $id twf id if $twftype is 'single',
 *              discussion id for any other twf type
 * @param mixed $mode twf layout mode
 * @param string $twftype optional
 */
function twf_print_mode_form($id, $mode, $twftype = '')
{
    global $OUTPUT;
    if ($twftype == 'single') {
        $select = new single_select(new moodle_url("/mod/twf/view.php", array('f' => $id)), 'mode', twf_get_layout_modes(), $mode, null, "mode");
        $select->set_label(get_string('displaymode', 'twf'), array('class' => 'accesshide'));
        $select->class = "twfmode";
    } else {
        $select = new single_select(new moodle_url("/mod/twf/discuss.php", array('d' => $id)), 'mode', twf_get_layout_modes(), $mode, null, "mode");
        $select->set_label(get_string('displaymode', 'twf'), array('class' => 'accesshide'));
    }
    echo $OUTPUT->render($select);
}