当前位置: 首页>>代码示例>>PHP>>正文


PHP message_get_blocked_users函数代码示例

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


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

示例1: message_mark_messages_read

    if ($countunread > 0) {
        //mark the messages we're going to display as read
        message_mark_messages_read($user1->id, $user2->id);
        if ($viewing == MESSAGE_VIEW_UNREAD_MESSAGES) {
            $viewingnewmessages = true;
        }
    }
}
$countunreadtotal = message_count_unread_messages($user1);
if ($currentuser && $countunreadtotal == 0 && $viewing == MESSAGE_VIEW_UNREAD_MESSAGES && empty($user2)) {
    // If the user has no unread messages, show the search box.
    // We don't do this when a user is viewing another user's messages as search doesn't
    // handle user A searching user B's messages properly.
    $viewing = MESSAGE_VIEW_SEARCH;
}
$blockedusers = message_get_blocked_users($user1, $user2);
$countblocked = count($blockedusers);
list($onlinecontacts, $offlinecontacts, $strangers) = message_get_contacts($user1, $user2);
message_print_contact_selector($countunreadtotal, $viewing, $user1, $user2, $blockedusers, $onlinecontacts, $offlinecontacts, $strangers, $showactionlinks, $page);
echo html_writer::start_tag('div', array('class' => 'messagearea mdl-align'));
if (!empty($user2)) {
    echo html_writer::start_tag('div', array('class' => 'mdl-left messagehistory'));
    $visible = 'visible';
    $hidden = 'hiddenelement';
    //cant just use hidden as mform adds that class to its fieldset for something else
    $recentlinkclass = $recentlabelclass = $historylinkclass = $historylabelclass = $visible;
    if ($history == MESSAGE_HISTORY_ALL) {
        $displaycount = 0;
        $recentlabelclass = $historylinkclass = $hidden;
    } else {
        if ($viewingnewmessages) {
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:31,代码来源:index.php

示例2: test_message_get_blocked_users

 /**
  * Test message_get_blocked_users.
  */
 public function test_message_get_blocked_users()
 {
     // Set this user as the admin.
     $this->setAdminUser();
     // Create a user to add to the admin's contact list.
     $user1 = $this->getDataGenerator()->create_user();
     $user2 = $this->getDataGenerator()->create_user();
     // Add users to the admin's contact list.
     message_add_contact($user1->id);
     message_add_contact($user2->id, 1);
     $this->assertCount(1, message_get_blocked_users());
     // Block other user.
     message_block_contact($user1->id);
     $this->assertCount(2, message_get_blocked_users());
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:18,代码来源:messagelib_test.php

示例3: get_blocked_users

 /**
  * Retrieve a list of users blocked
  *
  * @param  int $userid the user whose blocked users we want to retrieve
  * @return external_description
  * @since 2.9
  */
 public static function get_blocked_users($userid)
 {
     global $CFG, $USER, $PAGE;
     // Warnings array, it can be empty at the end but is mandatory.
     $warnings = array();
     // Validate params.
     $params = array('userid' => $userid);
     $params = self::validate_parameters(self::get_blocked_users_parameters(), $params);
     $userid = $params['userid'];
     // Validate context.
     $context = context_system::instance();
     self::validate_context($context);
     // Check if private messaging between users is allowed.
     if (empty($CFG->messaging)) {
         throw new moodle_exception('disabled', 'message');
     }
     $user = core_user::get_user($userid, '*', MUST_EXIST);
     core_user::require_active_user($user);
     // Check if we have permissions for retrieve the information.
     if ($userid != $USER->id and !has_capability('moodle/site:readallmessages', $context)) {
         throw new moodle_exception('accessdenied', 'admin');
     }
     // Now, we can get safely all the blocked users.
     $users = message_get_blocked_users($user);
     $blockedusers = array();
     foreach ($users as $user) {
         $newuser = array('id' => $user->id, 'fullname' => fullname($user));
         $userpicture = new user_picture($user);
         $userpicture->size = 1;
         // Size f1.
         $newuser['profileimageurl'] = $userpicture->get_url($PAGE)->out(false);
         $blockedusers[] = $newuser;
     }
     $results = array('users' => $blockedusers, 'warnings' => $warnings);
     return $results;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:43,代码来源:externallib.php

示例4: get_blocked_users

    /**
     * Retrieve a list of users blocked
     *
     * @param  int $userid the user whose blocked users we want to retrieve
     * @return external_description
     * @since 2.9
     */
    public static function get_blocked_users($userid) {
        global $CFG, $USER;
        require_once($CFG->dirroot . "/message/lib.php");

        // Warnings array, it can be empty at the end but is mandatory.
        $warnings = array();

        // Validate params.
        $params = array(
            'userid' => $userid
        );
        $params = self::validate_parameters(self::get_blocked_users_parameters(), $params);
        $userid = $params['userid'];

        // Validate context.
        $context = context_system::instance();
        self::validate_context($context);

        // Check if private messaging between users is allowed.
        if (empty($CFG->messaging)) {
            throw new moodle_exception('disabled', 'message');
        }

        $user = core_user::get_user($userid, '*', MUST_EXIST);
        core_user::require_active_user($user);

        // Check if we have permissions for retrieve the information.
        if ($userid != $USER->id and !has_capability('moodle/site:readallmessages', $context)) {
            throw new moodle_exception('accessdenied', 'admin');
        }

        // Now, we can get safely all the blocked users.
        $users = message_get_blocked_users($user);

        $blockedusers = array();
        foreach ($users as $user) {
            $newuser = array(
                'id' => $user->id,
                'fullname' => fullname($user),
            );

            $usercontext = context_user::instance($user->id, IGNORE_MISSING);
            if ($usercontext) {
                $newuser['profileimageurl'] = moodle_url::make_webservice_pluginfile_url(
                                                $usercontext->id, 'user', 'icon', null, '/', 'f1')->out(false);
            } else {
                $newuser['profileimageurl'] = '';
            }

            $blockedusers[] = $newuser;
        }

        $results = array(
            'users' => $blockedusers,
            'warnings' => $warnings
        );
        return $results;
    }
开发者ID:sfloresch,项目名称:DeportesUAI1.0,代码行数:65,代码来源:externallib.php


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