/** * 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. */ public 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). $formatted = array("id" => "p" . $post["postId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteTime"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteTime"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteTime"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "data" => array("id" => $post["postId"], "memberid" => $post["memberId"])); $date = smartTime($post["time"], true); // 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"]) . "' data-timestamp='" . $post["time"] . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>"; // If the post isn't deleted, add a lot of stuff! if (!$post["deleteTime"]) { // 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"]) . "' data-timestamp='" . $post["editTime"] . "'>" . relativeTime($post["editTime"], true) . "</span>", memberLink($post["editMemberId"], $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>"; } elseif (!$conversation["locked"] && !ET::$session->isSuspended() && $post["memberId"] == ET::$session->userId && (!$post["deleteMemberId"] || $post["deleteMemberId"] == ET::$session->userId) && C("esoTalk.conversation.editPostTimeLimit") == "reply") { $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-edit disabled'><i class='icon-edit'></i></span>"; $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-delete disabled'><i class='icon-remove'></i></span>"; } } 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"]) . "' data-timestamp='" . $post["deleteTime"] . "'>" . relativeTime($post["deleteTime"], true) . "</span>", memberLink($post["deleteMemberId"], $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; }
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 = _strftime("%B", mktime(0, 0, 0, $month, 1)); $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
$activity = $data["activity"]; $member = $data["member"]; ?> <div class='activity hasControls'<?php if (!empty($activity["activityId"])) { ?> id='a<?php echo $activity["activityId"]; ?> '<?php } ?> > <div class='controls'> <span class='time'><?php echo _strftime(T("date.full"), $activity["time"]); ?> </span> <?php if (($member["memberId"] == ET::$session->userId or $activity["fromMemberId"] == ET::$session->userId) and !empty($activity["activityId"])) { ?> <a href='<?php echo URL("member/deleteActivity/" . $activity["activityId"] . "/?token=" . ET::$session->token); ?> ' class='control-delete' title='<?php echo T("Delete"); ?> '><?php echo T("Delete"); ?> </a>
if (empty($member["preferences"]["hideOnline"])) { $lastAction = ET::memberModel()->getLastActionInfo($member["lastActionTime"], $member["lastActionDetail"]); if ($lastAction) { echo "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . ($lastAction[0] ? " (" . sanitizeHTML($lastAction[0]) . ")" : "") . "'><i class='icon-circle'></i></" . (!empty($lastAction[1]) ? "a" : "span") . ">"; } } ?> <span class='group subText'><?php echo memberGroup($member["account"], $member["groups"]); ?> </span> </div> <div class='col-lastActive'> <span class='subText'><?php printf(T("Last active %s"), empty($member["preferences"]["hideOnline"]) ? "<span title='" . _strftime(T("date.full"), $member["lastActionTime"]) . "'>" . relativeTime($member["lastActionTime"], true) . "</span>" : "[" . T("hidden") . "]"); ?> </span> </div> <div class='col-replies'> <span class='subText'><?php echo Ts("%s post", "%s posts", $member["countPosts"]); ?> </span> </div> </li>