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

PHP message_print_usergroup_selector函数代码示例

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

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



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

示例1: message_print_contact_selector

function message_print_contact_selector($countunreadtotal, $usergroup, $user1, $user2, $blockedusers, $onlinecontacts, $offlinecontacts, $strangers, $showcontactactionlinks, $page = 0)
{
    global $PAGE;
    echo html_writer::start_tag('div', array('class' => 'contactselector mdl-align'));
    //if 0 unread messages and they've requested unread messages then show contacts
    if ($countunreadtotal == 0 && $usergroup == VIEW_UNREAD_MESSAGES) {
        $usergroup = VIEW_CONTACTS;
    }
    //if they have no blocked users and they've requested blocked users switch them over to contacts
    if (count($blockedusers) == 0 && $usergroup == VIEW_BLOCKED) {
        $usergroup = VIEW_CONTACTS;
    }
    $onlyactivecourses = true;
    $courses = enrol_get_users_courses($user1->id, $onlyactivecourses);
    $coursecontexts = message_get_course_contexts($courses);
    //we need one of these again so holding on to them
    $strunreadmessages = null;
    if ($countunreadtotal > 0) {
        //if there are unread messages
        $strunreadmessages = get_string('unreadmessages', 'message', $countunreadtotal);
    }
    message_print_usergroup_selector($usergroup, $courses, $coursecontexts, $countunreadtotal, count($blockedusers), $strunreadmessages);
    $refreshpage = false;
    if ($usergroup == VIEW_UNREAD_MESSAGES) {
        message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $refreshpage, $PAGE->url, 1, $showcontactactionlinks, $strunreadmessages, $user2);
    } else {
        if ($usergroup == VIEW_CONTACTS || $usergroup == VIEW_SEARCH) {
            message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $refreshpage, $PAGE->url, 0, $showcontactactionlinks, $strunreadmessages, $user2);
        } else {
            if ($usergroup == VIEW_BLOCKED) {
                message_print_blocked_users($blockedusers, $PAGE->url, $showcontactactionlinks, null, $user2);
            } else {
                if (substr($usergroup, 0, 7) == VIEW_COURSE) {
                    $courseidtoshow = intval(substr($usergroup, 7));
                    if (!empty($courseidtoshow) && array_key_exists($courseidtoshow, $coursecontexts) && has_capability('moodle/course:viewparticipants', $coursecontexts[$courseidtoshow])) {
                        message_print_participants($coursecontexts[$courseidtoshow], $courseidtoshow, $PAGE->url, $showcontactactionlinks, null, $page, $user2);
                    } else {
                        //shouldn't get here. User trying to access a course they're not in perhaps.
                        add_to_log(SITEID, 'message', 'view', 'index.php', $usergroup);
                    }
                }
            }
        }
    }
    echo html_writer::start_tag('form', array('action' => 'index.php', 'method' => 'GET'));
    echo html_writer::start_tag('fieldset');
    $managebuttonclass = 'visible';
    if ($usergroup == VIEW_SEARCH) {
        $managebuttonclass = 'hiddenelement';
    }
    $strmanagecontacts = get_string('search', 'message');
    echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'usergroup', 'value' => VIEW_SEARCH));
    echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => $strmanagecontacts, 'class' => $managebuttonclass));
    echo html_writer::end_tag('fieldset');
    echo html_writer::end_tag('form');
    echo html_writer::end_tag('div');
}
开发者ID:vuchannguyen,项目名称:web,代码行数:57,代码来源:lib.php


示例2: message_print_contact_selector

/**
 * Print the selector that allows the user to view their contacts, course participants, their recent
 * conversations etc
 *
 * @param int $countunreadtotal how many unread messages does the user have?
 * @param int $viewing What is the user viewing? ie MESSAGE_VIEW_UNREAD_MESSAGES, MESSAGE_VIEW_SEARCH etc
 * @param object $user1 the user whose messages are being viewed
 * @param object $user2 the user $user1 is talking to
 * @param array $blockedusers an array of users blocked by $user1
 * @param array $onlinecontacts an array of $user1's online contacts
 * @param array $offlinecontacts an array of $user1's offline contacts
 * @param array $strangers an array of users who have messaged $user1 who aren't contacts
 * @param bool $showactionlinks show action links (add/remove contact etc)
 * @param int $page if there are so many users listed that they have to be split into pages what page are we viewing
 * @return void
 */
function message_print_contact_selector($countunreadtotal, $viewing, $user1, $user2, $blockedusers, $onlinecontacts, $offlinecontacts, $strangers, $showactionlinks, $page=0) {
    global $PAGE;

    echo html_writer::start_tag('div', array('class' => 'contactselector mdl-align'));

    //if 0 unread messages and they've requested unread messages then show contacts
    if ($countunreadtotal == 0 && $viewing == MESSAGE_VIEW_UNREAD_MESSAGES) {
        $viewing = MESSAGE_VIEW_CONTACTS;
    }

    //if they have no blocked users and they've requested blocked users switch them over to contacts
    if (count($blockedusers) == 0 && $viewing == MESSAGE_VIEW_BLOCKED) {
        $viewing = MESSAGE_VIEW_CONTACTS;
    }

    $onlyactivecourses = true;
    $courses = enrol_get_users_courses($user1->id, $onlyactivecourses);
    $coursecontexts = message_get_course_contexts($courses);//we need one of these again so holding on to them

    $strunreadmessages = null;
    if ($countunreadtotal>0) { //if there are unread messages
        $strunreadmessages = get_string('unreadmessages','message', $countunreadtotal);
    }

    message_print_usergroup_selector($viewing, $courses, $coursecontexts, $countunreadtotal, count($blockedusers), $strunreadmessages, $user1);

    if ($viewing == MESSAGE_VIEW_UNREAD_MESSAGES) {
        message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $PAGE->url, 1, $showactionlinks,$strunreadmessages, $user2);
    } else if ($viewing == MESSAGE_VIEW_CONTACTS || $viewing == MESSAGE_VIEW_SEARCH || $viewing == MESSAGE_VIEW_RECENT_CONVERSATIONS || $viewing == MESSAGE_VIEW_RECENT_NOTIFICATIONS) {
        message_print_contacts($onlinecontacts, $offlinecontacts, $strangers, $PAGE->url, 0, $showactionlinks, $strunreadmessages, $user2);
    } else if ($viewing == MESSAGE_VIEW_BLOCKED) {
        message_print_blocked_users($blockedusers, $PAGE->url, $showactionlinks, null, $user2);
    } else if (substr($viewing, 0, 7) == MESSAGE_VIEW_COURSE) {
        $courseidtoshow = intval(substr($viewing, 7));

        if (!empty($courseidtoshow)
            && array_key_exists($courseidtoshow, $coursecontexts)
            && has_capability('moodle/course:viewparticipants', $coursecontexts[$courseidtoshow])) {

            message_print_participants($coursecontexts[$courseidtoshow], $courseidtoshow, $PAGE->url, $showactionlinks, null, $page, $user2);
        }
    }

    // Only show the search button if we're viewing our own contacts.
    if ($viewing == MESSAGE_VIEW_CONTACTS && $user2 == null) {
        echo html_writer::start_tag('form', array('action' => 'index.php','method' => 'GET'));
        echo html_writer::start_tag('fieldset');
        $managebuttonclass = 'visible';
        $strmanagecontacts = get_string('search','message');
        echo html_writer::empty_tag('input', array('type' => 'hidden','name' => 'viewing','value' => MESSAGE_VIEW_SEARCH));
        echo html_writer::empty_tag('input', array('type' => 'submit','value' => $strmanagecontacts,'class' => $managebuttonclass));
        echo html_writer::end_tag('fieldset');
        echo html_writer::end_tag('form');
    }

    echo html_writer::end_tag('div');
}
开发者ID:nickbert77,项目名称:moodle,代码行数:73,代码来源:lib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP message_provider_uninstall函数代码示例发布时间:2022-05-15
下一篇:
PHP message_print_user函数代码示例发布时间: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