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


PHP chat_format_message函数代码示例

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


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

示例1: prepare_package

 /**
  * @todo Document this function
  */
 public function prepare_package()
 {
     $content = '';
     $lasttime = 0;
     $sessiongap = 5 * 60;
     // 5 minutes silence means a new session
     foreach ($this->messages as $message) {
         // We are walking FORWARDS through messages
         $m = clone $message;
         // grrrrrr - this causes the sha1 to change as chat_format_message changes what it's passed.
         $formatmessage = chat_format_message($m, null, $this->user);
         if (!isset($formatmessage->html)) {
             continue;
         }
         if (empty($lasttime) || $message->timestamp - $lasttime > $sessiongap) {
             $content .= '<hr />';
             $content .= userdate($message->timestamp);
         }
         $content .= $formatmessage->html;
         $lasttime = $message->timestamp;
     }
     $content = preg_replace('/\\<img[^>]*\\>/', '', $content);
     $this->exporter->write_new_file($content, clean_filename($this->cm->name . '-session.html'), false);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:27,代码来源:lib.php

示例2: sleep

     print " \n";
     print $CHAT_DUMMY_DATA;
     sleep($CFG->chat_refresh_room);
     continue;
 }
 print '<script type="text/javascript">' . "\n";
 print "//<![CDATA[\n\n";
 $chatnewrow = ($chatlastrow + $num) % 2;
 $refreshusers = false;
 $us = array();
 if ($chatlasttime != $chatnewlasttime and $messages) {
     $beep = false;
     $refreshusers = false;
     foreach ($messages as $message) {
         $chatlastrow = ($chatlastrow + 1) % 2;
         $formatmessage = chat_format_message($message, $chatuser->course, $USER, $chatlastrow);
         if ($formatmessage->beep) {
             $beep = true;
         }
         if ($formatmessage->refreshusers) {
             $refreshusers = true;
         }
         $us[$message->userid] = $timenow - $message->timestamp;
         echo "parent.msg.document.write('" . addslashes_js($formatmessage->html) . "\\n');\n";
     }
     // From the last message printed.
     // A strange case where lack of closures is useful!
     $chatlasttime = $message->timestamp;
     $chatlastid = $message->id;
 }
 if ($refreshusers) {
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:jsupdated.php

示例3: foreach

if ($newonly) {
    $lastsql = "AND timestamp > :last";
} else {
    $lastsql = "";
}

$groupselect = $groupid ? "AND (groupid=:groupid OR groupid=0)" : "";

$messages = $DB->get_records_select("chat_messages_current",
                    "chatid = :chatid AND timestamp > :chatentered $lastsql $groupselect", $params,
                    "timestamp DESC");

if ($messages) {
    foreach ($messages as $message) {
        $allmessages[] = chat_format_message($message, $course->id, $USER);
    }
}

if (empty($allmessages)) {
    echo get_string('nomessagesfound', 'message');
} else {
    foreach ($allmessages as $message) {
        echo $message->basic;
    }
}

echo '</div>';
echo $OUTPUT->container_end();
echo $OUTPUT->footer();
开发者ID:numbas,项目名称:moodle,代码行数:29,代码来源:index.php

示例4: userdate

                                             "chatid = :chatid AND timestamp >= :start AND timestamp <= :end $groupselect",
                                             $params,
                                             "timestamp ASC")) {

        echo $OUTPUT->heading(get_string('nomessages', 'chat'));

    } else {
        echo '<p class="boxaligncenter">'.userdate($start).' --> '. userdate($end).'</p>';

        echo $OUTPUT->box_start('center');
        $participates = array();
        foreach ($messages as $message) {  // We are walking FORWARDS through messages.
            if (!isset($participates[$message->userid])) {
                $participates[$message->userid] = true;
            }
            $formatmessage = chat_format_message($message, $course->id, $USER);
            if (isset($formatmessage->html)) {
                echo $formatmessage->html;
            }
        }
        $participatedcap = array_key_exists($USER->id, $participates)
                           && has_capability('mod/chat:exportparticipatedsession', $context);

        if (!empty($CFG->enableportfolios) && ($canexportsess || $participatedcap)) {
            require_once($CFG->libdir . '/portfoliolib.php');
            $buttonoptions  = array(
                'id'    => $cm->id,
                'start' => $start,
                'end'   => $end,
            );
            $button = new portfolio_add_button();
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:31,代码来源:report.php

示例5: count

    $num = count($messages);
} else {
    $num = 0;
}
$chat_newrow = ($chat_lastrow + $num) % 2;
$send_user_list = false;
if ($messages && $chat_lasttime != $chat_newlasttime) {
    foreach ($messages as $n => &$message) {
        $tmp = new stdclass();
        // when somebody enter room, user list will be updated
        if ($message->system == 1) {
            $send_user_list = true;
            $tmp->type = 'system';
            $users = format_user_list(chat_get_users($chatuser->chatid, $chatuser->groupid, $cm->groupingid), $course);
        }
        if ($html = chat_format_message($message, $chatuser->course, $USER, $chat_lastrow)) {
            if ($html->beep) {
                $tmp->type = 'beep';
            } elseif (empty($tmp->type)) {
                $tmp->type = 'user';
            }
            $tmp->msg = $html->html;
            $message = $tmp;
        } else {
            unset($message);
        }
    }
}
if (!empty($users) && $send_user_list) {
    // return users when system message coming
    $response['users'] = $users;
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:update.php


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