示例#1
0
echo "<strong class='title'><a href='" . URL($conversationURL . ((ET::$session->user and $conversation["unread"]) ? "/unread" : "")) . "'>";
if (SWC_MAIN_THUMB_DISPLAY && $menuImgUrl) {
    // メニュー画像サムネイル出力
    echo "<img src='" . $menuImgUrl . "' width='28' height='20' alt='' title=''>";
}
echo highlight(sanitizeHTML($conversation["title"]), ET::$session->get("highlight")) . "</a></strong> ";
// If we're highlighting search terms (i.e. if we did a fulltext search), then output a "show matching posts" link.
if (ET::$session->get("highlight")) {
    echo "<span class='controls'><a href='" . URL($conversationURL . "/?search=" . urlencode($data["fulltextString"])) . "' class='showMatchingPosts'>" . T("Show matching posts") . "</a></span>";
}
// If this conversation is stickied, output an excerpt from its first post.
if ($conversation["sticky"]) {
    echo "<div class='excerpt'>" . ET::formatter()->init($conversation["firstPost"])->inline(true)->firstLine()->clip(200)->format()->get() . "</div>";
}
?>
</div>
<div class='col-channel'><?php 
$channel = $data["channelInfo"][$conversation["channelId"]];
echo "<a href='" . URL(searchURL("", $channel["slug"])) . "' class='channel channel-{$conversation["channelId"]}' data-channel='{$channel["slug"]}'>{$channel["title"]}</a>";
?>
</div>
<div class='col-lastPost'><?php 
echo "<span class='action'>" . avatar(array("memberId" => $conversation["lastPostMemberId"], "username" => $conversation["lastPostMember"], "avatarFormat" => $conversation["lastPostMemberAvatarFormat"], "email" => $conversation["lastPostMemberEmail"]), "thumb"), " ", sprintf(T("%s posted %s"), "<span class='lastPostMember name'>" . memberLink($conversation["lastPostMemberId"], $conversation["lastPostMember"]) . "</span>", "<a href='" . URL($conversationURL . "/unread") . "' class='lastPostTime'>" . SwcUtils::getStrfTime($conversation["lastPostTime"]) . "</a>"), "</span>";
?>
</div>
<div class='col-replies'><?php 
echo "<span><a href='" . URL($conversationURL . "/unread") . "'>" . $conversation["replies"] . "</a></span>";
?>
</div>
</li>
 /**
  * 投稿単位(post)の出力用編集メソッド
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 protected function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     // title: SWCユーザ名を表示するように設定対応
     // purl: 追加。SNSボタンリンク用に投稿単位の絶対urlを設定
     // likeCnt: 追加。いいねボタンのカウント数設定
     // mainPostFlg: 追加。テーマのメイン投稿(最初の投稿)フラグ
     $formatted = array("id" => "p" . $post["postId"], "conversationId" => $post["conversationId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteMemberId"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteMemberId"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteMemberId"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "purl" => URL(postURL($post["postId"]), TRUE), "likeCnt" => $post["likeCnt"], "mainPostFlg" => $post["mainPostFlg"], "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     // いいね済みフラグ
     $formatted["liked"] = $post["likeActivityId"] ? 1 : "";
     //	$date = smartTime($post["time"], true);
     $date = SwcUtils::getStrfTime($post["time"], T("date.short"));
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . strftime(T("date.full"), $post["time"]) . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteMemberId"]) {
         // Add the user's online status / last action next to their name.
         //		if (empty($post["preferences"]["hideOnline"])) {
         //			$lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
         //			if ($lastAction[0]) $lastAction[0] = " (".sanitizeHTML($lastAction[0]).")";
         //			if ($lastAction) array_unshift($formatted["info"], "<".(!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span")." class='online' title='".T("Online")."{$lastAction[0]}'><i class='icon-circle'></i></".(!empty($lastAction[1]) ? "a" : "span").">");
         //		}
         // Show the user's group type.
         //		$formatted["info"][] = "<span class='group'>".memberGroup($post["account"], $post["groups"])."</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . strftime(T("date.full"), $post["editTime"]) . "'>" . relativeTime($post["editTime"], true) . "</span>", name($post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . strftime(T("date.full"), $post["deleteTime"]) . "'>" . relativeTime($post["deleteTime"], true) . "</span>", name($post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
示例#3
0
文件: posts.php 项目: m-mori/forum
}
/**
 * Shows a collection of posts as list items.
 *
 * @package esoTalk
 */
$prevPost = null;
foreach ($data["posts"] as $k => $post) {
    // Format the post for the template.
    $formattedPost = $this->formatPostForTemplate($post, $data["conversation"]);
    // If the post before this one is by the same member as this one, hide the avatar.
    if ($prevPost and empty($prevPost["deleteMemberId"]) and $prevPost["memberId"] == $post["memberId"]) {
        $formattedPost["hideAvatar"] = true;
    }
    //$thisPostTime = relativeTime($post["time"]);
    $thisPostTime = SwcUtils::getStrfTime($post["time"]);
    // 年月日日時として表示
    $mainFlg = $post["mainPostFlg"];
    ?>
<li data-index='<?php 
    echo date("Y", $post["time"]) . date("m", $post["time"]);
    ?>
'>
<?php 
    if ($mainFlg) {
        $this->renderView("conversation/tagsPath", array("tags" => $this->data["tags"]));
    }
    // If the post before this one has a different relative time string to this one, output a 'time marker'.
    if (!isset($prevPost["time"]) or relativeTime($prevPost["time"]) != $thisPostTime) {
        ?>
<div class='timeMarker'<?php 
示例#4
0
文件: index.php 项目: m-mori/forum
        if (!empty($months)) {
            echo "<ul>";
            foreach ($months as $month) {
                $selected = ($startFromYear == $year and $startFromMonth == $month) ? " selected" : "";
                $name = strftime("%B", mktime(0, 0, 0, $month, 1));
                $index = $year . str_pad($month, 2, "0", STR_PAD_LEFT);
                echo "<li class='scrubber-{$index}{$selected}' data-index='{$index}'><a href='" . URL(makeURL("{$year}/{$month}")) . "'>{$name}</a></li>";
            }
            echo "</ul>";
        }
        echo "</li>";
    }
    // Now, with the last 5 months we pulled out before, output a scrubber item for each of them.
    foreach ($recentMonths as $month) {
        $selected = ($startFromYear == $currentYear and $startFromMonth == $month) ? " selected" : "";
        $name = SwcUtils::getStrfTime(mktime(0, 0, 0, $month, 1), T("month.full"));
        $index = $currentYear . str_pad($month, 2, "0", STR_PAD_LEFT);
        echo "<li class='scrubber-{$index}{$selected}' data-index='{$index}'><a href='" . URL(makeURL("{$currentYear}/{$month}")) . "'>{$name}</a>";
        echo "</li>";
    }
    // Always output a "Latest" item.
    ?>
<li class='scrubber-now scrubber-nav' data-index='last'><a href='<?php 
    echo URL(makeURL("last"));
    ?>
'><i class='icon-arrow-down'></i> <?php 
    echo T("Latest");
    ?>
</a></li>
</ul>
<?php