本文整理汇总了PHP中Format::ActivityHeadline方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::ActivityHeadline方法的具体用法?PHP Format::ActivityHeadline怎么用?PHP Format::ActivityHeadline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::ActivityHeadline方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Url
echo $Activity->ActivityID;
?>
" class="Activity<?php
echo ' ' . $Activity->ActivityType;
?>
"><?php
if ($Activity->ActivityPhoto != '' && $Activity->ShowIcon == '1') {
if ($Activity->InsertUserID == $Session->UserID) {
echo '<a href="' . Url('/garden/profile/' . urlencode($Activity->ActivityName)) . '">' . $this->Html->Image('uploads/n' . $Activity->ActivityPhoto) . '</a>';
} else {
echo $this->Html->Image('uploads/n' . $Activity->ActivityPhoto);
}
}
?>
<h3><strong><?php
echo Format::ActivityHeadline($Activity, $Session->UserID);
?>
<em><?php
echo Format::Date($Activity->DateInserted);
?>
</em></strong></h3>
<?php
if ($Activity->Story != '') {
?>
<blockquote><?php
echo Format::Html($Activity->Story);
?>
</blockquote>
<?php
}
?>
示例2: WriteActivityComment
function WriteActivityComment($Comment, &$Sender, &$Session)
{
?>
<li id="Activity_<?php
echo $Comment->ActivityID;
?>
" class="<?php
echo $Comment->ActivityType;
?>
"><?php
if ($Comment->ActivityPhoto != '') {
if ($Comment->InsertUserID == $Session->UserID) {
echo '<a href="' . Url('/garden/profile/' . urlencode($Comment->ActivityName)) . '">' . $Sender->Html->Image('uploads/n' . $Comment->ActivityPhoto) . '</a>';
} else {
echo $Sender->Html->Image('uploads/n' . $Comment->ActivityPhoto);
}
}
?>
<h3><?php
echo $Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete') ? Anchor('Delete', 'garden/activity/delete/' . $Comment->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'Delete') : '';
?>
<strong><?php
echo Format::ActivityHeadline($Comment, $Sender->ProfileUserID);
?>
<em><?php
echo Format::Date($Comment->DateInserted);
?>
</em></strong></h3>
<blockquote><?php
echo Format::Display($Comment->Story);
?>
</blockquote>
</li>
<?php
}
示例3: SendNotification
public function SendNotification($ActivityID, $Story = '')
{
$Activity = $this->GetID($ActivityID);
if (!is_object($Activity)) {
return;
}
$Story = Format::Text($Story == '' ? $Activity->Story : $Story);
// If this is a comment on another activity, fudge the activity a bit so that everything appears properly.
if (is_null($Activity->RegardingUserID) && $Activity->CommentActivityID > 0) {
$CommentActivity = $this->GetID($Activity->CommentActivityID);
$Activity->RegardingUserID = $CommentActivity->RegardingUserID;
$Activity->Route = '/profile/' . $CommentActivity->RegardingUserID . '/' . Format::Url($CommentActivity->RegardingName) . '/#Activity_' . $Activity->CommentActivityID;
}
$User = $this->SQL->Select('Name, Email, Preferences')->From('User')->Where('UserID', $Activity->RegardingUserID)->Get()->FirstRow();
if ($User) {
$Preferences = Format::Unserialize($User->Preferences);
$Preference = ArrayValue('Email.' . $Activity->ActivityType, $Preferences, Gdn::Config('Preferences.Email.' . $Activity->ActivityType));
if ($Preference) {
$ActivityHeadline = Format::Text(Format::ActivityHeadline($Activity, $Activity->ActivityUserID, $Activity->RegardingUserID));
$Email = new Gdn_Email();
$Email->Subject(sprintf(T('[%1$s] %2$s'), Gdn::Config('Garden.Title'), $ActivityHeadline));
$Email->To($User->Email, $User->Name);
$Email->From(Gdn::Config('Garden.SupportEmail'), Gdn::Config('Garden.SupportName'));
$Email->Message(sprintf(T($Story == '' ? 'EmailNotification' : 'EmailStoryNotification'), $ActivityHeadline, Url($Activity->Route == '' ? '/' : $Activity->Route, TRUE), $Story));
try {
$Email->Send();
} catch (Exception $ex) {
// Don't do anything with the exception.
}
}
}
}
示例4: explode
echo '<li class="Activity ' . $Activity->ActivityType . '">';
// If this was a status update or a wall comment, don't bother with activity strings
$ActivityType = explode(' ', $Activity->ActivityType);
// Make sure you strip out any extra css classes munged in here
$ActivityType = $ActivityType[0];
$Author = UserBuilder($Activity, 'Activity');
if (in_array($ActivityType, array('WallComment', 'AboutUpdate'))) {
echo UserAnchor($Author, 'Name');
if ($Activity->ActivityType == 'WallComment' && $Activity->RegardingUserID > 0) {
$Author = UserBuilder($Activity, 'Regarding');
echo '<span>→</span>' . UserAnchor($Author, 'Name');
}
echo Format::Display($Activity->Story);
echo '<em>' . Format::Date($Activity->DateInserted) . '</em>';
} else {
echo Format::ActivityHeadline($Activity);
echo '<em>' . Format::Date($Activity->DateInserted) . '</em>';
if ($Activity->Story != '') {
echo '<div class="Story">';
echo $Activity->Story;
echo '</div>';
}
}
echo '</li>';
}
?>
<li class="ShowAll"><?php
echo Anchor(T('↳ Show All'), 'activity');
?>
</li>
</ul>
示例5: WriteActivity
function WriteActivity($Activity, &$Sender, &$Session, $Comment)
{
?>
<li id="Activity_<?php
echo $Activity->ActivityID;
?>
" class="Activity<?php
echo ' ' . $Activity->ActivityType;
if ($Activity->ActivityPhoto != '' && $Activity->ShowIcon == '1') {
echo ' HasPhoto';
}
?>
"><?php
if ($Session->IsValid() && ($Session->UserID == $Activity->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete'))) {
echo Anchor('Delete', 'garden/activity/delete/' . $Activity->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'Delete');
}
// If this was a status update or a wall comment, don't bother with activity strings
$ActivityType = explode(' ', $Activity->ActivityType);
// Make sure you strip out any extra css classes munged in here
$ActivityType = $ActivityType[0];
if (in_array($ActivityType, array('WallComment', 'AboutUpdate'))) {
if ($Activity->ActivityPhoto != '') {
echo '<a href="' . Url('/garden/profile/' . urlencode($Activity->ActivityName)) . '" class="Photo">' . $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto) . '</a>';
}
echo '<div>';
echo UserAnchor($Activity->ActivityName, 'Name');
if ($Activity->ActivityType == 'WallComment' && $Activity->RegardingUserID > 0 && (!property_exists($Sender, 'ProfileUserID') || $Sender->ProfileUserID != $Activity->RegardingUserID)) {
echo '<span>></span>' . UserAnchor($Activity->RegardingName, 'Name');
}
echo Format::Display($Activity->Story);
echo '<div class="Meta">';
echo Format::Date($Activity->DateInserted);
echo $Activity->AllowComments == '1' && $Session->IsValid() ? '<span>•</span>' . Anchor('Comment', '#CommentForm_' . $Activity->ActivityID, 'CommentOption') : '';
echo '</div>';
echo '</div>';
} else {
if ($Activity->ActivityPhoto != '' && $Activity->ShowIcon == '1') {
echo '<a href="' . Url('/garden/profile/' . urlencode($Activity->ActivityName)) . '" class="Photo">' . $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto) . '</a>';
}
echo '<div>';
echo Format::ActivityHeadline($Activity, $Sender->ProfileUserID);
echo '<div class="Meta">';
echo Format::Date($Activity->DateInserted);
echo $Activity->AllowComments == '1' && $Session->IsValid() ? '<span>•</span>' . Anchor('Comment', '#CommentForm_' . $Activity->ActivityID, 'CommentOption') : '';
if ($Activity->Story != '') {
echo '<div class="Story">';
echo $Activity->Story;
// story should be cleaned before being saved.
echo '</div>';
}
echo '</div>';
echo '</div>';
}
if ($Activity->AllowComments == '1') {
// If there are comments, show them
$FoundComments = FALSE;
if (property_exists($Sender, 'CommentData') && is_object($Sender->CommentData)) {
foreach ($Sender->CommentData->Result() as $Comment) {
if (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
if ($FoundComments == FALSE) {
echo '<ul class="Comments">';
}
$FoundComments = TRUE;
WriteActivityComment($Comment, $Sender, $Session);
}
}
}
if ($FoundComments == FALSE) {
echo '<ul class="Comments Hidden">';
}
if ($Session->IsValid()) {
?>
<li class="CommentForm">
<?php
echo Anchor('Write a comment', '/garden/activity/comment/' . $Activity->ActivityID, 'CommentLink');
$CommentForm = Gdn::Factory('Form');
$CommentForm->SetModel($Sender->ActivityModel);
$CommentForm->AddHidden('ActivityID', $Activity->ActivityID);
$CommentForm->AddHidden('Return', Gdn_Url::Request());
echo $CommentForm->Open(array('action' => Url('/garden/activity/comment'), 'class' => 'Hidden'));
echo $CommentForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => ''));
echo $CommentForm->Close('Comment');
?>
</li>
<?php
}
?>
</ul>
<?php
}
?>
</li>
<?php
}
示例6: WriteActivity
function WriteActivity($Activity, &$Sender, &$Session, $Comment)
{
// If this was a status update or a wall comment, don't bother with activity strings
$ActivityType = explode(' ', $Activity->ActivityType);
// Make sure you strip out any extra css classes munged in here
$ActivityType = $ActivityType[0];
$Author = UserBuilder($Activity, 'Activity');
$PhotoAnchor = UserPhoto($Author, 'Photo');
$CssClass = 'Item Activity ' . $ActivityType;
if ($PhotoAnchor != '') {
$CssClass .= ' HasPhoto';
}
if (in_array($ActivityType, array('WallComment', 'AboutUpdate'))) {
$CssClass .= ' Condensed';
}
$Title = '';
$Excerpt = $Activity->Story;
if (!in_array($ActivityType, array('WallComment', 'AboutUpdate'))) {
$Title = '<div class="Title">' . Format::ActivityHeadline($Activity, $Sender->ProfileUserID) . '</div>';
} else {
if ($Activity->ActivityType == 'WallComment' && $Activity->RegardingUserID > 0 && (!property_exists($Sender, 'ProfileUserID') || $Sender->ProfileUserID != $Activity->RegardingUserID)) {
$RegardingUser = UserBuilder($Activity, 'Regarding');
$Title = '<div class="Title">' . UserAnchor($Author, 'Title Name') . ' <span>→</span> ' . UserAnchor($RegardingUser, 'Name') . '</div>';
$Excerpt = Format::Display($Excerpt);
} else {
$Title = UserAnchor($Author, 'Title Name');
$Excerpt = Format::Display($Excerpt);
}
}
?>
<li id="Activity_<?php
echo $Activity->ActivityID;
?>
" class="<?php
echo $CssClass;
?>
">
<?php
if ($Session->IsValid() && ($Session->UserID == $Activity->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete'))) {
echo '<div class="OptionButton">' . Anchor(T('Delete'), 'garden/activity/delete/' . $Activity->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'Delete') . '</div>';
}
if ($PhotoAnchor != '') {
?>
<div class="Photo"><?php
echo $PhotoAnchor;
?>
</div>
<?php
}
?>
<div class="ItemContent Activity">
<?php
echo $Title;
?>
<div class="Excerpt"><?php
echo $Excerpt;
?>
</div>
<div class="Meta">
<span class="DateCreated"><?php
echo Format::Date($Activity->DateInserted);
?>
</span>
<?php
if ($Activity->AllowComments == '1' && $Session->IsValid()) {
echo '<span class="AddComment">' . Anchor(T('Comment'), '#CommentForm_' . $Activity->ActivityID, 'CommentOption') . '</span>';
}
?>
</div>
</div>
<?php
if ($Activity->AllowComments == '1') {
// If there are comments, show them
$FoundComments = FALSE;
if (property_exists($Sender, 'CommentData') && is_object($Sender->CommentData)) {
foreach ($Sender->CommentData->Result() as $Comment) {
if (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
if ($FoundComments == FALSE) {
echo '<ul class="DataList ActivityComments">';
}
$FoundComments = TRUE;
WriteActivityComment($Comment, $Sender, $Session);
}
}
}
if ($FoundComments == FALSE) {
echo '<ul class="DataList ActivityComments Hidden">';
}
if ($Session->IsValid()) {
?>
<li class="CommentForm">
<?php
echo Anchor(T('Write a comment'), '/garden/activity/comment/' . $Activity->ActivityID, 'CommentLink');
$CommentForm = Gdn::Factory('Form');
$CommentForm->SetModel($Sender->ActivityModel);
$CommentForm->AddHidden('ActivityID', $Activity->ActivityID);
$CommentForm->AddHidden('Return', Gdn_Url::Request());
echo $CommentForm->Open(array('action' => Url('/garden/activity/comment'), 'class' => 'Hidden'));
echo $CommentForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => ''));
echo $CommentForm->Close('Comment');
//.........这里部分代码省略.........