本文整理汇总了PHP中forum::get_feedtype_options方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::get_feedtype_options方法的具体用法?PHP forum::get_feedtype_options怎么用?PHP forum::get_feedtype_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forum
的用法示例。
在下文中一共展示了forum::get_feedtype_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
function definition()
{
global $CFG, $COURSE;
$mform =& $this->_form;
$coursecontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
$forumng = $this->_instance ? get_record('forumng', 'id', $this->_instance) : null;
$this->clone = $forumng ? $forumng->originalcmid : 0;
// If this is a clone, don't show the normal form
if ($this->clone) {
$mform->addElement('hidden', 'name', $forumng->name);
$mform->addElement('static', 'sharedthing', '', get_string('sharedinfo', 'forumng', $CFG->wwwroot . '/course/modedit.php?update=' . $this->clone . '&return=1'));
$this->shared_definition_part($coursecontext);
return;
}
$mform->addElement('header', 'general', get_string('general', 'form'));
// Forum name
$mform->addElement('text', 'name', get_string('forumname', 'forumng'), array('size' => '64'));
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
$mform->setType('name', PARAM_CLEAN);
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
// Forum types
$types = forum_type::get_all();
$options = array();
foreach ($types as $type) {
if ($type->is_user_selectable()) {
$options[$type->get_id()] = $type->get_name();
}
}
$mform->addElement('select', 'type', get_string('forumtype', 'forumng'), $options);
$mform->setHelpButton('type', array('forumtype', get_string('forumtype', 'forumng'), 'forumng'));
$mform->setDefault('type', 'general');
$mform->addElement('htmleditor', 'intro', get_string('forumintro', 'forumng'));
$mform->setType('intro', PARAM_RAW);
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
// Subscription option displays only if enabled at site level
if ($CFG->forumng_subscription == -1) {
$options = forum::get_subscription_options();
$mform->addElement('select', 'subscription', get_string('subscription', 'forumng'), $options);
$mform->setDefault('subscription', forum::SUBSCRIPTION_PERMITTED);
$mform->setHelpButton('subscription', array('subscription', get_string('subscription', 'forumng'), 'forumng'));
} else {
// Hidden element contains default value (not used anyhow)
$mform->addElement('hidden', 'subscription', forum::SUBSCRIPTION_PERMITTED);
}
// Max size of attachments
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
$choices[-1] = get_string('uploadnotallowed');
$choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
$mform->addElement('select', 'attachmentmaxbytes', get_string('attachmentmaxbytes', 'forumng'), $choices);
$mform->setHelpButton('attachmentmaxbytes', array('attachmentmaxbytes', get_string('attachmentmaxbytes', 'forumng'), 'forumng'));
$mform->setDefault('attachmentmaxbytes', $CFG->forumng_attachmentmaxbytes);
//Email address for reporting unacceptable post for this forum, default is blank
$mform->addElement('text', 'reportingemail', get_string('reportingemail', 'forumng'), array('size' => 48));
$mform->setType('reportingemail', PARAM_NOTAGS);
$mform->setHelpButton('reportingemail', array('reportingemail', get_string('reportingemail', 'forumng'), 'forumng'));
// Atom/RSS feed on/off/discussions-only
if ($CFG->enablerssfeeds && !empty($CFG->forumng_enablerssfeeds)) {
if ($CFG->forumng_feedtype == -1 || $CFG->forumng_feeditems == -1) {
$mform->addElement('header', '', get_string('feeds', 'forumng'));
}
if ($CFG->forumng_feedtype == -1) {
$mform->addElement('select', 'feedtype', get_string('feedtype', 'forumng'), forum::get_feedtype_options());
$mform->setDefault('feedtype', forum::FEEDTYPE_ALL_POSTS);
$mform->setHelpButton('feedtype', array('feedtype', get_string('feedtype', 'forumng'), 'forumng'));
}
// Atom/RSS feed item count
if ($CFG->forumng_feeditems == -1) {
$mform->addElement('select', 'feeditems', get_string('feeditems', 'forumng'), forum::get_feeditems_options());
$mform->setDefault('feeditems', 20);
$mform->setHelpButton('feeditems', array('feeditems', get_string('feeditems', 'forumng'), 'forumng'));
}
}
// Ratings header
/////////////////
$mform->addElement('header', '', get_string('ratings', 'forumng'));
$mform->addElement('checkbox', 'enableratings', get_string('enableratings', 'forumng'));
$mform->setHelpButton('enableratings', array('enableratings', get_string('enableratings', 'forumng'), 'forumng'));
// Scale
$mform->addElement('modgrade', 'ratingscale', get_string('scale'), null, true);
$mform->disabledIf('ratingscale', 'enableratings', 'notchecked');
$mform->setDefault('ratingscale', 5);
// From/until times
$mform->addElement('date_time_selector', 'ratingfrom', get_string('ratingfrom', 'forumng'), array('optional' => true));
$mform->disabledIf('ratingfrom', 'enableratings', 'notchecked');
$mform->addElement('date_time_selector', 'ratinguntil', get_string('ratinguntil', 'forumng'), array('optional' => true));
$mform->disabledIf('ratinguntil', 'enableratings', 'notchecked');
$mform->addElement('text', 'ratingthreshold', get_string('ratingthreshold', 'forumng'));
$mform->setType('ratingthreshold', PARAM_INT);
$mform->setDefault('ratingthreshold', 1);
$mform->addRule('ratingthreshold', get_string('error_ratingthreshold', 'forumng'), 'regex', '/[1-9][0-9]*/', 'client');
$mform->setHelpButton('ratingthreshold', array('ratingthreshold', get_string('ratingthreshold', 'forumng'), 'forumng'));
$mform->disabledIf('ratingthreshold', 'enableratings', 'notchecked');
// Grading
$mform->addElement('select', 'grading', get_string('grade'), forum::get_grading_options());
$mform->setDefault('grading', forum::GRADING_NONE);
$mform->setHelpButton('grading', array('grading', get_string('grade'), 'forumng'));
//.........这里部分代码省略.........
示例2: array
if (!isset($CFG->forumng_monitorroles)) {
$result = array();
foreach ($defaultroles as $capability) {
if ($caproles = get_roles_with_capability($capability, CAP_ALLOW)) {
foreach ($caproles as $caprole) {
if (!in_array($caprole->id, $result)) {
$result[] = $caprole->id;
}
}
}
}
$default = implode(',', $result);
}
$settings->add(new admin_setting_configtext('forumng_monitorroles', get_string('monitorroles', 'forumng'), get_string('configmonitorroles', 'forumng'), $default, PARAM_SEQUENCE));
}
$options = forum::get_feedtype_options();
$options[-1] = get_string('perforumoption', 'forumng');
$settings->add(new admin_setting_configselect('forumng_feedtype', get_string('feedtype', 'forumng'), get_string('configfeedtype', 'forumng'), -1, $options));
$options = forum::get_feeditems_options();
$options[-1] = get_string('perforumoption', 'forumng');
$settings->add(new admin_setting_configselect('forumng_feeditems', get_string('feeditems', 'forumng'), get_string('configfeeditems', 'forumng'), -1, $options));
$options = array(0 => get_string('permanentdeletion_never', 'forumng'), 1 => get_string('permanentdeletion_soon', 'forumng'), 1 * 60 * 60 * 24 => '1 ' . get_string('day'), 14 * 60 * 60 * 24 => '14 ' . get_string('days'), 30 * 60 * 60 * 24 => '30 ' . get_string('days'), 365 * 60 * 60 * 24 => '1 ' . get_string('year'));
$settings->add(new admin_setting_configselect('forumng_permanentdeletion', get_string('permanentdeletion', 'forumng'), get_string('configpermanentdeletion', 'forumng'), 30 * 60 * 60 * 24, $options));
//Start hour of deleting or archiving old discussions
$options = array();
for ($i = 0; $i < 24; $i++) {
$options[$i * 3600] = $i;
}
$settings->add(new admin_setting_configselect('forumng_housekeepingstarthour', get_string('housekeepingstarthour', 'forumng'), get_string('confighousekeepingstarthour', 'forumng'), 0, $options));
$settings->add(new admin_setting_configselect('forumng_housekeepingstophour', get_string('housekeepingstophour', 'forumng'), get_string('confighousekeepingstophour', 'forumng'), 5 * 3600, $options));
// Option about read tracking