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

PHP message_print_user函数代码示例

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

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



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

示例1: message_print_search_results


//.........这里部分代码省略.........
            echo $headertdstart.get_string('timesent', 'message').$headertdend;
            echo html_writer::end_tag('tr');

            $blockedcount = 0;
            $dateformat = get_string('strftimedatetimeshort');
            $strcontext = get_string('context', 'message');
            foreach ($messages as $message) {

            /// ignore messages to and from blocked users unless $frm->includeblocked is set
                if (!optional_param('includeblocked', 0, PARAM_BOOL) and (
                      ( isset($contacts[$message->useridfrom]) and ($contacts[$message->useridfrom]->blocked == 1)) or
                      ( isset($contacts[$message->useridto]  ) and ($contacts[$message->useridto]->blocked   == 1))
                                                )
                   ) {
                    $blockedcount ++;
                    continue;
                }

            /// load up user to record
                if ($message->useridto !== $USER->id) {
                    $userto = $DB->get_record('user', array('id' => $message->useridto));
                    $tocontact = (array_key_exists($message->useridto, $contacts) and
                                    ($contacts[$message->useridto]->blocked == 0) );
                    $toblocked = (array_key_exists($message->useridto, $contacts) and
                                    ($contacts[$message->useridto]->blocked == 1) );
                } else {
                    $userto = false;
                    $tocontact = false;
                    $toblocked = false;
                }

            /// load up user from record
                if ($message->useridfrom !== $USER->id) {
                    $userfrom = $DB->get_record('user', array('id' => $message->useridfrom));
                    $fromcontact = (array_key_exists($message->useridfrom, $contacts) and
                                    ($contacts[$message->useridfrom]->blocked == 0) );
                    $fromblocked = (array_key_exists($message->useridfrom, $contacts) and
                                    ($contacts[$message->useridfrom]->blocked == 1) );
                } else {
                    $userfrom = false;
                    $fromcontact = false;
                    $fromblocked = false;
                }

            /// find date string for this message
                $date = usergetdate($message->timecreated);
                $datestring = $date['year'].$date['mon'].$date['mday'];

            /// print out message row
                echo html_writer::start_tag('tr', array('valign' => 'top'));

                echo html_writer::start_tag('td', array('class' => 'contact'));
                message_print_user($userfrom, $fromcontact, $fromblocked, $showicontext);
                echo html_writer::end_tag('td');

                echo html_writer::start_tag('td', array('class' => 'contact'));
                message_print_user($userto, $tocontact, $toblocked, $showicontext);
                echo html_writer::end_tag('td');

                echo html_writer::start_tag('td', array('class' => 'summary'));
                echo message_get_fragment($message->fullmessage, $keywords);
                echo html_writer::start_tag('div', array('class' => 'link'));

                //find the user involved that isn't the current user
                $user2id = null;
                if ($user1->id == $message->useridto) {
                    $user2id = $message->useridfrom;
                } else {
                    $user2id = $message->useridto;
                }
                message_history_link($user1->id, $user2id, false,
                                     $messagesearchstring, 'm'.$message->id, $strcontext);
                echo html_writer::end_tag('div');
                echo html_writer::end_tag('td');

                echo html_writer::tag('td', userdate($message->timecreated, $dateformat), array('class' => 'date'));

                echo html_writer::end_tag('tr');
            }


            if ($blockedcount > 0) {
                echo html_writer::start_tag('tr');
                echo html_writer::tag('td', get_string('blockedmessages', 'message', $blockedcount), array('colspan' => 4, 'align' => 'center'));
                echo html_writer::end_tag('tr');
            }
            echo html_writer::end_tag('table');

        } else {
            echo html_writer::tag('p', get_string('keywordssearchresults', 'message', 0), array('class' => 'heading'));
        }
    }

    if (!$personsearch && !$messagesearch) {
        //they didn't enter any search terms
        echo $OUTPUT->notification(get_string('emptysearchstring', 'message'));
    }

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


示例2: message_print_search_results


//.........这里部分代码省略.........
            switch ($frm->keywordsoption) {
                case 'tome':
                    $tome = true;
                    break;
                case 'fromme':
                    $fromme = true;
                    break;
                case 'allmine':
                    $tome = true;
                    $fromme = true;
                    break;
                case 'allusers':
                    $courseid = SITEID;
                    break;
                case 'courseusers':
                    $courseid = $frm->courseid;
                    break;
                default:
                    $tome = true;
                    $fromme = true;
            }
            if (($messages = message_search($keywords, $fromme, $tome, $courseid)) !== false) {
                /// get a list of contacts
                if (($contacts = get_records('message_contacts', 'userid', $USER->id, '', 'contactid, blocked')) === false) {
                    $contacts = array();
                }
                /// print heading with number of results
                echo '<p class="heading">' . get_string('keywordssearchresults', 'message', count($messages)) . ' ("' . s($keywordstring) . '")</p>';
                /// print table headings
                echo '<table class="searchresults" cellspacing="0">';
                echo '<tr>';
                echo '<td><strong>' . get_string('from') . '</strong></td>';
                echo '<td><strong>' . get_string('to') . '</strong></td>';
                echo '<td><strong>' . get_string('message', 'message') . '</strong></td>';
                echo '<td><strong>' . get_string('timesent', 'message') . '</strong></td>';
                echo "</tr>\n";
                $blockedcount = 0;
                $dateformat = get_string('strftimedatetimeshort');
                $strcontext = get_string('context', 'message');
                foreach ($messages as $message) {
                    /// ignore messages to and from blocked users unless $frm->includeblocked is set
                    if (!optional_param('includeblocked', 0, PARAM_BOOL) and (isset($contacts[$message->useridfrom]) and $contacts[$message->useridfrom]->blocked == 1 or isset($contacts[$message->useridto]) and $contacts[$message->useridto]->blocked == 1)) {
                        $blockedcount++;
                        continue;
                    }
                    /// load up user to record
                    if ($message->useridto !== $USER->id) {
                        $userto = get_record('user', 'id', $message->useridto);
                        $tocontact = (array_key_exists($message->useridto, $contacts) and $contacts[$message->useridto]->blocked == 0);
                        $toblocked = (array_key_exists($message->useridto, $contacts) and $contacts[$message->useridto]->blocked == 1);
                    } else {
                        $userto = false;
                        $tocontact = false;
                        $toblocked = false;
                    }
                    /// load up user from record
                    if ($message->useridfrom !== $USER->id) {
                        $userfrom = get_record('user', 'id', $message->useridfrom);
                        $fromcontact = (array_key_exists($message->useridfrom, $contacts) and $contacts[$message->useridfrom]->blocked == 0);
                        $fromblocked = (array_key_exists($message->useridfrom, $contacts) and $contacts[$message->useridfrom]->blocked == 1);
                    } else {
                        $userfrom = false;
                        $fromcontact = false;
                        $fromblocked = false;
                    }
                    /// find date string for this message
                    $date = usergetdate($message->timecreated);
                    $datestring = $date['year'] . $date['mon'] . $date['mday'];
                    /// print out message row
                    echo '<tr valign="top">';
                    echo '<td class="contact">';
                    message_print_user($userfrom, $fromcontact, $fromblocked);
                    echo '</td>';
                    echo '<td class="contact">';
                    message_print_user($userto, $tocontact, $toblocked);
                    echo '</td>';
                    echo '<td class="summary">' . message_get_fragment($message->message, $keywords);
                    echo '<br /><div class="link">';
                    message_history_link($message->useridto, $message->useridfrom, false, $keywordstring, 'm' . $message->id, $strcontext);
                    echo '</div>';
                    echo '</td>';
                    echo '<td class="date">' . userdate($message->timecreated, $dateformat) . '</td>';
                    echo "</tr>\n";
                }
                if ($blockedcount > 0) {
                    echo '<tr><td colspan="4" align="center">' . get_string('blockedmessages', 'message', $blockedcount) . '</td></tr>';
                }
                echo '</table>';
            } else {
                notify(get_string('nosearchresults', 'message'));
            }
            /// what the ????, probably an empty search string, duh!
        } else {
            notify(get_string('emptysearchstring', 'message'));
        }
    }
    echo '<br />';
    print_single_button('index.php', array('tab' => 'search'), get_string('newsearch', 'message'));
    echo '</div>';
}
开发者ID:r007,项目名称:PMoodle,代码行数:101,代码来源:lib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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