• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP forum_get_layout_modes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中forum_get_layout_modes函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_get_layout_modes函数的具体用法?PHP forum_get_layout_modes怎么用?PHP forum_get_layout_modes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了forum_get_layout_modes函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: forum_print_mode_form

/**
 * Print the drop down that allows the user to select how they want to have
 * the discussion displayed.
 *
 * @param int $id forum id if $forumtype is 'single',
 *              discussion id for any other forum type
 * @param mixed $mode forum layout mode
 * @param string $forumtype optional
 */
function forum_print_mode_form($id, $mode, $forumtype='') {
    global $OUTPUT;
    if ($forumtype == 'single') {
        $select = new single_select(new moodle_url("/mod/forum/view.php", array('f'=>$id)), 'mode', forum_get_layout_modes(), $mode, null, "mode");
        $select->set_label(get_string('displaymode', 'forum'), array('class' => 'accesshide'));
        $select->class = "forummode";
    } else {
        $select = new single_select(new moodle_url("/mod/forum/discuss.php", array('d'=>$id)), 'mode', forum_get_layout_modes(), $mode, null, "mode");
        $select->set_label(get_string('displaymode', 'forum'), array('class' => 'accesshide'));
    }
    echo $OUTPUT->render($select);
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:21,代码来源:lib.php


示例2: forum_print_mode_form

/**
 * Print the drop down that allows the user to select how they want to have
 * the discussion displayed.
 * @param $id - forum id if $forumtype is 'single',
 *              discussion id for any other forum type
 * @param $mode - forum layout mode
 * @param $forumtype - optional
 */
function forum_print_mode_form($id, $mode, $forumtype = '')
{
    if ($forumtype == 'single') {
        echo '<div class="forummode">';
        popup_form("view.php?f={$id}&amp;mode=", forum_get_layout_modes(), "mode", $mode, "");
        echo '</div>';
    } else {
        popup_form("discuss.php?d={$id}&amp;mode=", forum_get_layout_modes(), "mode", $mode, "");
    }
}
开发者ID:r007,项目名称:PMoodle,代码行数:18,代码来源:lib.php


示例3: defined

// 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_forum
 * @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/forum/lib.php';
    $settings->add(new admin_setting_configselect('forum_displaymode', get_string('displaymode', 'forum'), get_string('configdisplaymode', 'forum'), FORUM_MODE_NESTED, forum_get_layout_modes()));
    $settings->add(new admin_setting_configcheckbox('forum_replytouser', get_string('replytouser', 'forum'), get_string('configreplytouser', 'forum'), 1));
    // Less non-HTML characters than this is short
    $settings->add(new admin_setting_configtext('forum_shortpost', get_string('shortpost', 'forum'), get_string('configshortpost', 'forum'), 300, PARAM_INT));
    // More non-HTML characters than this is long
    $settings->add(new admin_setting_configtext('forum_longpost', get_string('longpost', 'forum'), get_string('configlongpost', 'forum'), 600, PARAM_INT));
    // Number of discussions on a page
    $settings->add(new admin_setting_configtext('forum_manydiscussions', get_string('manydiscussions', 'forum'), get_string('configmanydiscussions', 'forum'), 100, PARAM_INT));
    if (isset($CFG->maxbytes)) {
        $maxbytes = 0;
        if (isset($CFG->forum_maxbytes)) {
            $maxbytes = $CFG->forum_maxbytes;
        }
        $settings->add(new admin_setting_configselect('forum_maxbytes', get_string('maxattachmentsize', 'forum'), get_string('configmaxbytes', 'forum'), 512000, get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes)));
    }
    // Default number of attachments allowed per post in all forums
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:settings.php


示例4: defined

// 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-forum
 * @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/forum/lib.php');

    $settings->add(new admin_setting_configselect('forum_displaymode', get_string('displaymode', 'forum'),
                       get_string('configdisplaymode', 'forum'), FORUM_MODE_NESTED, forum_get_layout_modes()));

    $settings->add(new admin_setting_configcheckbox('forum_replytouser', get_string('replytouser', 'forum'),
                       get_string('configreplytouser', 'forum'), 1));

    // Less non-HTML characters than this is short
    $settings->add(new admin_setting_configtext('forum_shortpost', get_string('shortpost', 'forum'),
                       get_string('configshortpost', 'forum'), 300, PARAM_INT));

    // More non-HTML characters than this is long
    $settings->add(new admin_setting_configtext('forum_longpost', get_string('longpost', 'forum'),
                       get_string('configlongpost', 'forum'), 600, PARAM_INT));

    // Number of discussions on a page
    $settings->add(new admin_setting_configtext('forum_manydiscussions', get_string('manydiscussions', 'forum'),
                       get_string('configmanydiscussions', 'forum'), 100, PARAM_INT));
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:settings.php


示例5: grading_popup

 /**
  * Makes the pop up contents for the grading interface
  *
  * @param array $params
  * @param $coursemodule
  * @global moodle_database $DB
  * @global $PAGE
  * @global stdClass $CFG
  * @global $SESSION
  * @global $USER
  * @global $OUTPUT
  * @params object $coursemodule
  * @return string HTML
  */
 public function grading_popup($params, $coursemodule)
 {
     global $DB, $PAGE, $CFG, $SESSION, $USER, $OUTPUT;
     $output = '';
     // Lifted from /mod/forum/discuss.php...
     /*
      $parent = $params['parent'];       // If set, then display this post and all children.
      $mode   = $params['mode'];         // If set, changes the layout of the thread
      $move   = $params['move'];         // If set, moves this discussion to another forum
      $mark   = $params['mark'];       // Used for tracking read posts if user initiated.
      $postid = $params['postid'];       // Used for tracking read posts if user initiated.
     */
     $discussion = $DB->get_record('forum_discussions', array('id' => $params['discussionid']), '*', MUST_EXIST);
     $course = $DB->get_record('course', array('id' => $discussion->course), '*', MUST_EXIST);
     $forum = $DB->get_record('forum', array('id' => $discussion->forum), '*', MUST_EXIST);
     $cm = get_coursemodule_from_instance('forum', $forum->id, $course->id, false, MUST_EXIST);
     $modcontext = context_module::instance($cm->id);
     // Security - cmid is used to check context permissions earlier on, so it must match when
     // derived from the discussion.
     if (!($cm->id == $params['coursemoduleid'])) {
         print_error('Bad params!');
         return false;
     }
     // Add ajax-related libs.
     $PAGE->requires->yui2_lib('event');
     $PAGE->requires->yui2_lib('connection');
     $PAGE->requires->yui2_lib('json');
     // Move this down fix for MDL-6926.
     require_once $CFG->dirroot . '/mod/forum/lib.php';
     // Restrict news forums - should not be graded.
     if ($forum->type == 'news') {
         print_error('invaliddiscussionid', 'forum', "{$CFG->wwwroot}/mod/forum/view.php?f={$forum->id}");
     }
     unset($SESSION->fromdiscussion);
     // In case the user has used the drop-down to change from threaded to flat or something.
     if (isset($params['mode'])) {
         set_user_preference('forum_displaymode', $params['mode']);
     }
     $displaymode = get_user_preferences('forum_displaymode', $CFG->forum_displaymode);
     $parent = $discussion->firstpost;
     $post = forum_get_post_full($parent);
     if (!$post) {
         print_error("notexists", 'forum', "{$CFG->wwwroot}/mod/forum/view.php?f={$forum->id}");
     }
     if (!forum_user_can_view_post($post, $course, $cm, $forum, $discussion)) {
         print_error('nopermissiontoview', 'forum', "{$CFG->wwwroot}/mod/forum/view.php?id={$forum->id}");
     }
     // For now, restrict to rating only.
     $canreply = false;
     // Without this, the nesting doesn't work properly as the css isn't picked up.
     $output .= html_writer::start_tag('div', array('class' => 'path-mod-forum'));
     $output .= html_writer::start_tag('div', array('class' => 'discussioncontrols clearfix'));
     $output .= html_writer::start_tag('div', array('class' => 'discussioncontrol displaymode'));
     // We don't want to have the current mode returned in the url as well as the new one.
     unset($params['mode']);
     $newurl = new moodle_url('/blocks/ajax_marking/actions/grading_popup.php', $params);
     $select = new single_select($newurl, 'mode', forum_get_layout_modes(), $displaymode, null, "mode");
     $output .= $OUTPUT->render($select);
     $output .= html_writer::end_tag('div');
     // If user has not already posted and it's a Q & A forum...
     $forumisqanda = $forum->type == 'qanda';
     $noviewwithoutposting = !has_capability('mod/forum:viewqandawithoutposting', $modcontext);
     $hasnotposted = !forum_user_has_posted($forum->id, $discussion->id, $USER->id);
     if ($forumisqanda && $noviewwithoutposting && $hasnotposted) {
         $output .= $OUTPUT->notification(get_string('qandanotify', 'forum'));
     }
     $canrate = has_capability('mod/forum:rate', $modcontext);
     ob_start();
     forum_print_discussion($course, $cm, $forum, $discussion, $post, $displaymode, $canreply, $canrate);
     $output .= ob_get_contents();
     ob_end_clean();
     $output .= html_writer::end_tag('div');
     $output .= html_writer::end_tag('div');
     return $output;
 }
开发者ID:nadavkav,项目名称:moodle-block_ajax_marking,代码行数:89,代码来源:block_ajax_marking_forum.class.php


示例6: forum_print_mode_form

/**
 * Print the drop down that allows the user to select how they want to have
 * the discussion displayed.
 *
 * @param int $id forum id if $forumtype is 'single',
 *              discussion id for any other forum type
 * @param mixed $mode forum layout mode
 * @param string $forumtype optional
 */
function forum_print_mode_form($id, $mode, $forumtype = '')
{
    global $OUTPUT;
    $select = html_select::make_popup_form("view.php?f={$id}", 'mode', forum_get_layout_modes(), "mode", $mode);
    $select->nothinglabel = false;
    if ($forumtype == 'single') {
        echo '<div class="forummode">';
        echo $OUTPUT->select($select);
        echo '</div>';
    } else {
        echo $OUTPUT->select($select);
    }
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:22,代码来源:lib.php



注:本文中的forum_get_layout_modes函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP forum_get_post_full函数代码示例发布时间:2022-05-15
下一篇:
PHP forum_get_firstpost_from_discussion函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap